From 54086de15853994a25e4d3a681cfab229d3815bd Mon Sep 17 00:00:00 2001 From: Tim Orling Date: Sun, 17 Jul 2016 11:37:23 -0700 Subject: nss: fix build for gcc-6 [YOCTO #9897] (Fedora-24 host is gcc-6) (From OE-Core rev: 1882abd101d211e5ab3f1a0a77580395778e6301) Signed-off-by: Tim Orling Signed-off-by: Armin Kuster Signed-off-by: Richard Purdie --- meta/recipes-support/nss/nss/nss-gcc6-fix.patch | 343 ++++++++++++++++++++++++ meta/recipes-support/nss/nss_3.21.bb | 1 + 2 files changed, 344 insertions(+) create mode 100644 meta/recipes-support/nss/nss/nss-gcc6-fix.patch (limited to 'meta/recipes-support') diff --git a/meta/recipes-support/nss/nss/nss-gcc6-fix.patch b/meta/recipes-support/nss/nss/nss-gcc6-fix.patch new file mode 100644 index 0000000000..97422f6286 --- /dev/null +++ b/meta/recipes-support/nss/nss/nss-gcc6-fix.patch @@ -0,0 +1,343 @@ +Fix gcc-6 -Werror=misleading-indentation errors + +Patch did not apply cleanly, so re-create the same changes. +Also fixed some whitespace errors not addressed in the original patch. + +Upstream-Status: Backport +Signed-off-by: Tim Orling + +From: Michel Normand +Subject: nss gcc6 change +Date: Mon, 18 Apr 2016 19:11:03 +0200 + +nss changes required to avoid build error with gcc6 like: +=== +[ 58s] h_page.c: In function 'new_lseek': +[ 58s] h_page.c:117:8: error: this 'if' clause does not guard... [-Werror=misleading-indentation] +[ 58s] if(offset < 1) +[ 58s] ^~ +[ 58s] h_page.c:120:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' +[ 58s] cur_pos = lseek(fd, 0, SEEK_CUR); +[ 58s] ^~~~~~~ +=== + +Signed-off-by: Michel Normand + +Index: nss-3.21/nss/cmd/bltest/blapitest.c +=================================================================== +--- nss-3.21.orig/nss/cmd/bltest/blapitest.c ++++ nss-3.21/nss/cmd/bltest/blapitest.c +@@ -1571,8 +1571,7 @@ bltest_seed_init(bltestCipherInfo *ciphe + cipherInfo->cipher.symmkeyCipher = seed_Encrypt; + else + cipherInfo->cipher.symmkeyCipher = seed_Decrypt; +- +- return SECSuccess; ++ return SECSuccess; + } + + SECStatus +Index: nss-3.21/nss/cmd/vfychain/vfychain.c +=================================================================== +--- nss-3.21.orig/nss/cmd/vfychain/vfychain.c ++++ nss-3.21/nss/cmd/vfychain/vfychain.c +@@ -439,7 +439,8 @@ main(int argc, char *argv[], char *envp[ + case 0 : /* positional parameter */ goto breakout; + case 'a' : isAscii = PR_TRUE; break; + case 'b' : secStatus = DER_AsciiToTime(&time, optstate->value); +- if (secStatus != SECSuccess) Usage(progName); break; ++ if (secStatus != SECSuccess) Usage(progName); ++ break; + case 'd' : certDir = PL_strdup(optstate->value); break; + case 'e' : ocsp_fetchingFailureIsAFailure = PR_FALSE; break; + case 'f' : certFetching = PR_TRUE; break; +Index: nss-3.21/nss/lib/dbm/src/h_page.c +=================================================================== +--- nss-3.21.orig/nss/lib/dbm/src/h_page.c ++++ nss-3.21/nss/lib/dbm/src/h_page.c +@@ -112,26 +112,25 @@ long new_lseek(int fd, long offset, int + long end_pos=0; + long seek_pos=0; + +- if(origin == SEEK_CUR) +- { +- if(offset < 1) +- return(lseek(fd, offset, SEEK_CUR)); ++ if (origin == SEEK_CUR) { ++ if (offset < 1) ++ return(lseek(fd, offset, SEEK_CUR)); + + cur_pos = lseek(fd, 0, SEEK_CUR); + +- if(cur_pos < 0) ++ if (cur_pos < 0) + return(cur_pos); +- } +- ++ } ++ + end_pos = lseek(fd, 0, SEEK_END); +- if(end_pos < 0) ++ if (end_pos < 0) + return(end_pos); + +- if(origin == SEEK_SET) ++ if (origin == SEEK_SET) + seek_pos = offset; +- else if(origin == SEEK_CUR) ++ else if (origin == SEEK_CUR) + seek_pos = cur_pos + offset; +- else if(origin == SEEK_END) ++ else if (origin == SEEK_END) + seek_pos = end_pos + offset; + else + { +@@ -143,7 +142,7 @@ long new_lseek(int fd, long offset, int + * end of the file. We don't need + * to do anything special except the seek. + */ +- if(seek_pos <= end_pos) ++ if (seek_pos <= end_pos) + return(lseek(fd, seek_pos, SEEK_SET)); + + /* the seek position is beyond the end of the +@@ -161,7 +160,7 @@ long new_lseek(int fd, long offset, int + memset(buffer, 0, 1024); + while(len > 0) + { +- if(write(fd, buffer, (size_t)(1024 > len ? len : 1024)) < 0) ++ if (write(fd, buffer, (size_t)(1024 > len ? len : 1024)) < 0) + return(-1); + len -= 1024; + } +@@ -245,10 +244,10 @@ __delpair(HTAB *hashp, BUFHEAD *bufp, in + * Once we know dst_offset is < BSIZE, we can subtract it from BSIZE + * to get an upper bound on length. + */ +- if(dst_offset > (uint32)hashp->BSIZE) ++ if (dst_offset > (uint32)hashp->BSIZE) + return(DATABASE_CORRUPTED_ERROR); + +- if(length > (uint32)(hashp->BSIZE - dst_offset)) ++ if (length > (uint32)(hashp->BSIZE - dst_offset)) + return(DATABASE_CORRUPTED_ERROR); + + memmove(dst, src, length); +@@ -324,7 +323,7 @@ __split_page(HTAB *hashp, uint32 obucket + * off. If it is then the database has + * been corrupted. + */ +- if(ino[n] > off) ++ if (ino[n] > off) + return(DATABASE_CORRUPTED_ERROR); + + key.size = off - ino[n]; +@@ -355,7 +354,7 @@ __split_page(HTAB *hashp, uint32 obucket + * wrong. LJM + */ + tmp_uint16_array = (uint16*)np; +- if(!PAIRFITS(tmp_uint16_array, &key, &val)) ++ if (!PAIRFITS(tmp_uint16_array, &key, &val)) + return(DATABASE_CORRUPTED_ERROR); + + putpair(np, &key, &val); +@@ -440,7 +439,7 @@ ugly_split(HTAB *hashp, uint32 obucket, + */ + loop_detection++; + +- if(loop_detection > MAX_UGLY_SPLIT_LOOPS) ++ if (loop_detection > MAX_UGLY_SPLIT_LOOPS) + return DATABASE_CORRUPTED_ERROR; + + if (ino[2] < REAL_KEY && ino[2] != OVFLPAGE) { +@@ -736,7 +735,7 @@ __get_page(HTAB *hashp, + * the maximum number of entries + * in the array + */ +- if((unsigned)max > (size / sizeof(uint16))) ++ if ((unsigned)max > (size / sizeof(uint16))) + return(DATABASE_CORRUPTED_ERROR); + + /* do the byte order swap +@@ -749,7 +748,7 @@ __get_page(HTAB *hashp, + /* check the validity of the page here + * (after doing byte order swaping if necessary) + */ +- if(!is_bitmap && bp[0] != 0) ++ if (!is_bitmap && bp[0] != 0) + { + uint16 num_keys = bp[0]; + uint16 offset; +@@ -760,11 +759,11 @@ __get_page(HTAB *hashp, + * bp[0] is too large (larger than the whole + * page) then the page is corrupted + */ +- if(bp[0] > (size / sizeof(uint16))) ++ if (bp[0] > (size / sizeof(uint16))) + return(DATABASE_CORRUPTED_ERROR); + + /* bound free space */ +- if(FREESPACE(bp) > size) ++ if (FREESPACE(bp) > size) + return(DATABASE_CORRUPTED_ERROR); + + /* check each key and data offset to make +@@ -776,10 +775,10 @@ __get_page(HTAB *hashp, + for(i=1 ; i <= num_keys; i+=2) + { + /* ignore overflow pages etc. */ +- if(bp[i+1] >= REAL_KEY) ++ if (bp[i+1] >= REAL_KEY) + { + +- if(bp[i] > offset || bp[i+1] > bp[i]) ++ if (bp[i] > offset || bp[i+1] > bp[i]) + return(DATABASE_CORRUPTED_ERROR); + + offset = bp[i+1]; +@@ -832,7 +831,7 @@ __put_page(HTAB *hashp, char *p, uint32 + * the maximum number of entries + * in the array + */ +- if((unsigned)max > (size / sizeof(uint16))) ++ if ((unsigned)max > (size / sizeof(uint16))) + return(DATABASE_CORRUPTED_ERROR); + + for (i = 0; i <= max; i++) +@@ -1091,7 +1090,7 @@ __free_ovflpage(HTAB *hashp, BUFHEAD *ob + uint32 bit_address, free_page, free_bit; + uint16 ndx; + +- if(!obufp || !obufp->addr) ++ if (!obufp || !obufp->addr) + return; + + addr = obufp->addr; +Index: nss-3.21/nss/lib/dbm/src/hash.c +=================================================================== +--- nss-3.21.orig/nss/lib/dbm/src/hash.c ++++ nss-3.21/nss/lib/dbm/src/hash.c +@@ -154,7 +154,7 @@ __hash_open(const char *file, int flags, + return NULL; + } + hashp->fp = NO_FILE; +- if(file) ++ if (file) + hashp->filename = strdup(file); + + /* +@@ -172,7 +172,7 @@ __hash_open(const char *file, int flags, + errno = 0; /* Just in case someone looks at errno */ + new_table = 1; + } +- else if(statbuf.st_mtime && statbuf.st_size == 0) ++ else if (statbuf.st_mtime && statbuf.st_size == 0) + { + /* check for a zero length file and delete it + * if it exists +@@ -288,7 +288,7 @@ hash_close(DB *dbp) + return (DBM_ERROR); + + hashp = (HTAB *)dbp->internal; +- if(!hashp) ++ if (!hashp) + return (DBM_ERROR); + + retval = hdestroy(hashp); +@@ -304,7 +304,7 @@ static int hash_fd(const DB *dbp) + return (DBM_ERROR); + + hashp = (HTAB *)dbp->internal; +- if(!hashp) ++ if (!hashp) + return (DBM_ERROR); + + if (hashp->fp == -1) { +@@ -480,7 +480,7 @@ hdestroy(HTAB *hashp) + if (hashp->fp != -1) + (void)close(hashp->fp); + +- if(hashp->filename) { ++ if (hashp->filename) { + #if defined(_WIN32) || defined(_WINDOWS) || defined(XP_OS2) + if (hashp->is_temp) + (void)unlink(hashp->filename); +@@ -578,7 +578,7 @@ hash_sync(const DB *dbp, uint flags) + return (DBM_ERROR); + + hashp = (HTAB *)dbp->internal; +- if(!hashp) ++ if (!hashp) + return (DBM_ERROR); + + if (!hashp->save_file) +@@ -670,7 +670,7 @@ hash_get( + + rv = hash_access(hashp, HASH_GET, (DBT *)key, data); + +- if(rv == DATABASE_CORRUPTED_ERROR) ++ if (rv == DATABASE_CORRUPTED_ERROR) + { + #if defined(unix) && defined(DEBUG) + printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); +@@ -707,7 +707,7 @@ hash_put( + rv = hash_access(hashp, flag == R_NOOVERWRITE ? + HASH_PUTNEW : HASH_PUT, (DBT *)key, (DBT *)data); + +- if(rv == DATABASE_CORRUPTED_ERROR) ++ if (rv == DATABASE_CORRUPTED_ERROR) + { + #if defined(unix) && defined(DEBUG) + printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); +@@ -741,7 +741,7 @@ hash_delete( + } + rv = hash_access(hashp, HASH_DELETE, (DBT *)key, NULL); + +- if(rv == DATABASE_CORRUPTED_ERROR) ++ if (rv == DATABASE_CORRUPTED_ERROR) + { + #if defined(unix) && defined(DEBUG) + printf("\n\nDBM Database has been corrupted, tell Lou...\n\n"); +@@ -802,27 +802,27 @@ hash_access( + ndx += 2; + } else if (bp[1] == OVFLPAGE) { + +- /* database corruption: overflow loop detection */ +- if(last_overflow_page_no == (int32)*bp) ++ /* database corruption: overflow loop detection */ ++ if (last_overflow_page_no == (int32)*bp) + return (DATABASE_CORRUPTED_ERROR); + +- last_overflow_page_no = *bp; ++ last_overflow_page_no = *bp; + +- rbufp = __get_buf(hashp, *bp, rbufp, 0); +- if (!rbufp) { +- save_bufp->flags &= ~BUF_PIN; +- return (DBM_ERROR); +- } ++ rbufp = __get_buf(hashp, *bp, rbufp, 0); ++ if (!rbufp) { ++ save_bufp->flags &= ~BUF_PIN; ++ return (DBM_ERROR); ++ } + +- ovfl_loop_count++; +- if(ovfl_loop_count > MAX_OVERFLOW_HASH_ACCESS_LOOPS) ++ ovfl_loop_count++; ++ if (ovfl_loop_count > MAX_OVERFLOW_HASH_ACCESS_LOOPS) + return (DATABASE_CORRUPTED_ERROR); + +- /* FOR LOOP INIT */ +- bp = (uint16 *)rbufp->page; +- n = *bp++; +- ndx = 1; +- off = hashp->BSIZE; ++ /* FOR LOOP INIT */ ++ bp = (uint16 *)rbufp->page; ++ n = *bp++; ++ ndx = 1; ++ off = hashp->BSIZE; + } else if (bp[1] < REAL_KEY) { + if ((ndx = + __find_bigpair(hashp, rbufp, ndx, kp, (int)size)) > 0) diff --git a/meta/recipes-support/nss/nss_3.21.bb b/meta/recipes-support/nss/nss_3.21.bb index d2e24112de..05d81c27e1 100644 --- a/meta/recipes-support/nss/nss_3.21.bb +++ b/meta/recipes-support/nss/nss_3.21.bb @@ -21,6 +21,7 @@ SRC_URI = "\ file://nss-fix-incorrect-shebang-of-perl.patch \ file://nss-fix-nsinstall-build.patch \ file://0001-Fix-build-failure-on-opensuse-13.1.patch \ + file://nss-gcc6-fix.patch \ file://nss.pc.in \ file://signlibs.sh \ " -- cgit v1.2.3-54-g00ecf