|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[1999-06-26 14:02 UTC] sas at cvs dot php dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Jun 14 21:00:02 2026 UTC |
language-scanner.c & configuration parser.c contain the following code (generated by flex): #if __STDC__ #define YY_USE_CONST #endif /* __STDC__ */ #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif Unfortunately, not all compilers that support the const keyword define __STDC__ to a true value. For instance, Sun's C compiler only defines __STDC__ to be true if the compiler is invoked with -Xc (strict ANSI compliance mode, no non-ANSI features allowed). The following patch works around this behavior, and generates a libmodphp.a that makes the large parser tables read-only so they can be shared between http processes and lowers the per-process memory requirements: diff -crwb php-3.0.9/configure.in php-3.0.9-mine/configure.in *** php-3.0.9/configure.in Thu Jun 3 05:03:05 1999 --- php-3.0.9-mine/configure.in Fri Jun 25 18:20:00 1999 *************** *** 36,41 **** --- 36,50 ---- CFLAGS=`echo $CFLAGS | sed -e 's/-g//'` fi + dnl Make flex scanners use const if they can, even if __STDC__ is not + dnl true, for compilers like Sun's that only set __STDC__ true in + dnl "limit-to-ANSI-standard" mode, not in "ANSI-compatible" mode + AC_C_CONST + if test $ac_cv_c_const = yes; then + LEX_CFLAGS="-DYY_USE_CONST" + fi + AC_SUBST(LEX_CFLAGS) + dnl check for -R, etc. switch AC_MSG_CHECKING(if compiler supports -R) AC_CACHE_VAL(php_cv_cc_dashr,[ diff -crwb php-3.0.9/Makefile.in php-3.0.9-mine/Makefile.in *** php-3.0.9/Makefile.in Thu Jun 3 07:05:10 1999 --- php-3.0.9-mine/Makefile.in Fri Jun 25 18:23:27 1999 *************** *** 52,57 **** --- 52,58 ---- APXS = @APXS@ APXS_LDFLAGS = @PHP_LIBS@ @APXS_LDFLAGS@ @LIBS@ WARNING_LEVEL = @WARNING_LEVEL@ + LEX_CFLAGS = -w$(WARNING_LEVEL) @LEX_CFLAGS@ SOURCE = language-parser.tab.c language-scanner.c main.c php3_hash.c operators .c \ variables.c token_cache.c stack.c internal_functions.c \ *************** *** 141,147 **** bison -p php -v -d $(srcdir)/language-parser.y -o language-parser.tab.c language-scanner.o: ! $(CC) $(CFLAGS) -w$(WARNING_LEVEL) -c language-scanner.c language-scanner.c: $(srcdir)/language-scanner.lex flex -Pphp -olanguage-scanner.c -i $(srcdir)/language-scanner.lex --- 142,148 ---- bison -p php -v -d $(srcdir)/language-parser.y -o language-parser.tab.c language-scanner.o: ! $(CC) $(CFLAGS) $(LEX_CFLAGS) -c language-scanner.c language-scanner.c: $(srcdir)/language-scanner.lex flex -Pphp -olanguage-scanner.c -i $(srcdir)/language-scanner.lex *************** *** 150,156 **** bison -p cfg -v -d $(srcdir)/configuration-parser.y -o configuration-par ser.tab.c configuration-scanner.o: ! $(CC) $(CFLAGS) -w$(WARNING_LEVEL) -c configuration-scanner.c configuration-scanner.c: $(srcdir)/configuration-scanner.lex flex -Pcfg -oconfiguration-scanner.c -i $(srcdir)/configuration-scanner. lex --- 151,157 ---- bison -p cfg -v -d $(srcdir)/configuration-parser.y -o configuration-par ser.tab.c configuration-scanner.o: ! $(CC) $(CFLAGS) $(LEX_CFLAGS) -c configuration-scanner.c configuration-scanner.c: $(srcdir)/configuration-scanner.lex flex -Pcfg -oconfiguration-scanner.c -i $(srcdir)/configuration-scanner. lex