Opened 6 years ago
Closed 6 years ago
#57971 closed defect (duplicate)
nss @3.41.1 does not build on PPC Tiger, Mac OS X 10.4.11, because "'for' loop initial declaration used outside C99 mode"
Reported by: | ballapete (Peter "Pete" Dyballa) | Owned by: | |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | 2.5.4 |
Keywords: | tiger | Cc: | |
Port: | nss |
Description
/opt/local/bin/gcc-apple-4.2 -arch ppc -o Output.OBJD/tls13esni.o -c -Os -fPIC -Dppc -fno-common -pipe -DDARWIN -DHAVE_STRERROR -DHAVE_BSD_FLOCK -Wall -Wshadow -DNSS_NO_GCC48 -DXP_UNIX -UDEBUG -DNDEBUG -DNSS_NO_INIT_SUPPORT -DUSE_UTIL_DIRECTLY -DNO_NSPR_10_SUPPORT -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES -I/opt/local/include/nspr -I../../../dist/Output.OBJD/include -I../../../dist/public/nss -I../../../dist/private/nss tls13esni.c tls13esni.c: In function 'tls13_CopyESNIKeys': tls13esni.c:72: error: 'for' loop initial declaration used outside C99 mode tls13esni.c: In function 'SSLExp_EncodeESNIKeys': tls13esni.c:288: error: 'for' loop initial declaration used outside C99 mode make[2]: *** [Output.OBJD/tls13esni.o] Error 1 make[2]: Leaving directory `/opt/local/var/macports/build/_opt_local_var_macports_sources_lil.fr.rsync.macports.org_release_tarballs_ports_net_nss/nss/work/nss-3.41.1/nss/lib/ssl'
First case is this loop:
71 for (PRCList *cur_p = PR_LIST_HEAD(&okeys->keyShares); 72 cur_p != &okeys->keyShares; 73 cur_p = PR_NEXT_LINK(cur_p)) { 74 TLS13KeyShareEntry *copy = tls13_CopyKeyShareEntry( 75 (TLS13KeyShareEntry *)cur_p); 76 if (!copy) { 77 goto loser; 78 } 79 PR_APPEND_LINK(©->link, &nkeys->keyShares); 80 }
and second case is this loop:
288 for (unsigned int i = 0; i < cipherSuiteCount; i++) { 289 rv = sslBuffer_AppendNumber(&b, cipherSuites[i], 2); 290 if (rv != SECSuccess) { 291 goto loser; 292 } 293 }
In the first case the C pre-processor produces
for (PRCList *cur_p = (&okeys->keyShares)->next; cur_p != &okeys->keyShares; cur_p = ((cur_p)->next)) { TLS13KeyShareEntry *copy = tls13_CopyKeyShareEntry( (TLS13KeyShareEntry *)cur_p); if (!copy) { goto loser; } do { (©->link)->next = (&nkeys->keyShares); (©->link)->prev = (&nkeys->keyShares)->prev; (&nkeys->keyShares)->prev->next = (©->link); (&nkeys->keyShares)->prev = (©->link); } while (0); }
and in the second case:
for (unsigned int i = 0; i < cipherSuiteCount; i++) { rv = sslBuffer_AppendNumber(&b, cipherSuites[i], 2); if (rv != SECSuccess) { goto loser; } }
The fault seems to be that neither cur_p nor i are declared before and outside the loop declarations…
Attachments (1)
Change History (7)
Changed 6 years ago by ballapete (Peter "Pete" Dyballa)
comment:1 follow-up: 2 Changed 6 years ago by kencu (Ken)
Hi Pete -- would you like to try adding the fix? This might do it, in the Portfile:
configure.cflags-append -std=c99
Other option is rewrite the code and move the declaration of i
before the loop I guess, (but if it's done this way in one place it's likely done this way elsewhere, and who's got time for that?):
unsigned int i; for (i = 0; i < cipherSuiteCount; i++) { rv = sslBuffer_AppendNumber(&b, cipherSuites[i], 2); if (rv != SECSuccess) { goto loser; } } }
comment:2 follow-up: 3 Changed 6 years ago by ballapete (Peter "Pete" Dyballa)
Replying to kencu:
Hi Pete -- would you like to try adding the fix? This might do it, in the Portfile:
configure.cflags-append -std=c99
Ken,
this might fail because nss
does not use configure
. I think
build.args-append -std=c99
is necessary…
comment:3 follow-up: 4 Changed 6 years ago by ballapete (Peter "Pete" Dyballa)
… which does not work. So I changed these two lines
114 CC=\"${configure.cc} -arch ${build_arch} -std=c99\" \ 115 CCC=\"${configure.cxx} -arch ${build_arch} -std=c99\"
The lines #122,123 might need the same update.
comment:5 Changed 6 years ago by kencu (Ken)
OK, thanks. Now to see if that should go into the Portfile, or ....
comment:6 Changed 6 years ago by ryandesign (Ryan Carsten Schmidt)
Resolution: | → duplicate |
---|---|
Status: | new → closed |
Duplicate of #57606.
Main.log from build on PowerPC 7447A