From c9b3436bd51a4dcf7d6cc6817d4c7a8ad99538d4 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Mon, 17 Oct 2016 10:37:39 +0200 Subject: [PATCH] autoconf: split into subdirectories; redirect calls in debug builds --- Makefile.frag | 3 ++ config.m4 | 70 +++++++++++++++++------------------ m4/{ => ax}/ax_check_sign.m4 | 0 m4/{ => ax}/ax_pthread.m4 | 0 m4/{ => posix}/errno.m4 | 0 m4/{ => posix}/fcntl.m4 | 0 m4/{ => posix}/glob.m4 | 3 +- m4/{ => posix}/locale.m4 | 0 m4/{ => posix}/ndbm.m4 | 0 m4/{ => posix}/netdb.m4 | 2 +- m4/{ => posix}/netinet_in.m4 | 0 m4/{ => posix}/netinet_tcp.m4 | 0 m4/{ => posix}/poll.m4 | 0 m4/{ => posix}/signal.m4 | 0 m4/{ => posix}/stddef.m4 | 0 m4/{ => posix}/stdint.m4 | 0 m4/{ => posix}/stdio.m4 | 0 m4/{ => posix}/stdlib.m4 | 6 +-- m4/{ => posix}/sys_select.m4 | 0 m4/{ => posix}/sys_socket.m4 | 0 m4/{ => posix}/sys_stat.m4 | 0 m4/{ => posix}/sys_time.m4 | 1 - m4/{ => posix}/sys_times.m4 | 0 m4/{ => posix}/sys_types.m4 | 0 m4/{ => posix}/sys_uio.m4 | 0 m4/{ => posix}/sys_utsname.m4 | 0 m4/{ => posix}/syslog.m4 | 0 m4/{ => posix}/time.m4 | 0 m4/{ => posix}/unistd.m4 | 0 m4/{ => posix}/wchar.m4 | 0 m4/{ => posix}/wctype.m4 | 0 m4/{ => psi}/psi.m4 | 8 ++-- m4/{ => psi}/psi_const.m4 | 0 m4/{ => psi}/psi_decl.m4 | 11 +++++- m4/{ => psi}/psi_macro.m4 | 0 m4/{ => psi}/psi_struct.m4 | 0 m4/{ => psi}/psi_type.m4 | 6 +++ psi.d/glob.psi | 7 +++- src/calc.c | 4 +- tests/glob/glob002.phpt | 10 ++--- 40 files changed, 75 insertions(+), 56 deletions(-) rename m4/{ => ax}/ax_check_sign.m4 (100%) rename m4/{ => ax}/ax_pthread.m4 (100%) rename m4/{ => posix}/errno.m4 (100%) rename m4/{ => posix}/fcntl.m4 (100%) rename m4/{ => posix}/glob.m4 (84%) rename m4/{ => posix}/locale.m4 (100%) rename m4/{ => posix}/ndbm.m4 (100%) rename m4/{ => posix}/netdb.m4 (98%) rename m4/{ => posix}/netinet_in.m4 (100%) rename m4/{ => posix}/netinet_tcp.m4 (100%) rename m4/{ => posix}/poll.m4 (100%) rename m4/{ => posix}/signal.m4 (100%) rename m4/{ => posix}/stddef.m4 (100%) rename m4/{ => posix}/stdint.m4 (100%) rename m4/{ => posix}/stdio.m4 (100%) rename m4/{ => posix}/stdlib.m4 (92%) rename m4/{ => posix}/sys_select.m4 (100%) rename m4/{ => posix}/sys_socket.m4 (100%) rename m4/{ => posix}/sys_stat.m4 (100%) rename m4/{ => posix}/sys_time.m4 (89%) rename m4/{ => posix}/sys_times.m4 (100%) rename m4/{ => posix}/sys_types.m4 (100%) rename m4/{ => posix}/sys_uio.m4 (100%) rename m4/{ => posix}/sys_utsname.m4 (100%) rename m4/{ => posix}/syslog.m4 (100%) rename m4/{ => posix}/time.m4 (100%) rename m4/{ => posix}/unistd.m4 (100%) rename m4/{ => posix}/wchar.m4 (100%) rename m4/{ => posix}/wctype.m4 (100%) rename m4/{ => psi}/psi.m4 (99%) rename m4/{ => psi}/psi_const.m4 (100%) rename m4/{ => psi}/psi_decl.m4 (94%) rename m4/{ => psi}/psi_macro.m4 (100%) rename m4/{ => psi}/psi_struct.m4 (100%) rename m4/{ => psi}/psi_type.m4 (97%) diff --git a/Makefile.frag b/Makefile.frag index 4efd8b3..f98715d 100644 --- a/Makefile.frag +++ b/Makefile.frag @@ -52,3 +52,6 @@ $(PHP_PSI_SRCDIR)/src/parser.re: $(PHP_PSI_SRCDIR)/src/parser_proc.h touch $@ $(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re $(RE2C) -o $@ $< + +$(PHP_PSI_SRCDIR)/src/types/decl.c: $(PHP_PSI_SRCDIR)/php_psi_macros.h $(PHP_PSI_SRCDIR)/php_psi_redirs.h +$(PHP_PSI_SRCDIR)/src/context.c: $(PHP_PSI_SRCDIR)/php_psi_consts.h $(PHP_PSI_SRCDIR)/php_psi_decls.h $(PHP_PSI_SRCDIR)/php_psi_fn_decls.h $(PHP_PSI_SRCDIR)/php_psi_structs.h $(PHP_PSI_SRCDIR)/php_psi_types.h $(PHP_PSI_SRCDIR)/php_psi_unions.h $(PHP_PSI_SRCDIR)/php_psi_va_decls.h diff --git a/config.m4 b/config.m4 index 47ee1b0..f5c82c1 100644 --- a/config.m4 +++ b/config.m4 @@ -2,41 +2,41 @@ PHP_PSI_SRCDIR=PHP_EXT_SRCDIR(psi) PHP_PSI_BUILDDIR=PHP_EXT_BUILDDIR(psi) m4_foreach(incfile, [ - [ax_check_sign.m4], - [ax_pthread.m4], - [psi.m4], - [psi_type.m4], - [psi_const.m4], - [psi_decl.m4], - [psi_macro.m4], - [psi_struct.m4], - [errno.m4], - [fcntl.m4], - [glob.m4], - [locale.m4], - [stddef.m4], - [stdio.m4], - [stdint.m4], - [stdlib.m4], - [sys_select.m4], - [sys_socket.m4], - [sys_stat.m4], - [sys_time.m4], - [sys_times.m4], - [sys_types.m4], - [sys_uio.m4], - [sys_utsname.m4], - [ndbm.m4], - [netdb.m4], - [netinet_in.m4], - [netinet_tcp.m4], - [poll.m4], - [signal.m4], - [syslog.m4], - [time.m4], - [unistd.m4], - [wchar.m4], - [wctype.m4]], [ + [ax/ax_check_sign.m4], + [ax/ax_pthread.m4], + [psi/psi.m4], + [psi/psi_type.m4], + [psi/psi_const.m4], + [psi/psi_decl.m4], + [psi/psi_macro.m4], + [psi/psi_struct.m4], + [posix/errno.m4], + [posix/fcntl.m4], + [posix/glob.m4], + [posix/locale.m4], + [posix/stddef.m4], + [posix/stdio.m4], + [posix/stdint.m4], + [posix/stdlib.m4], + [posix/sys_select.m4], + [posix/sys_socket.m4], + [posix/sys_stat.m4], + [posix/sys_time.m4], + [posix/sys_times.m4], + [posix/sys_types.m4], + [posix/sys_uio.m4], + [posix/sys_utsname.m4], + [posix/ndbm.m4], + [posix/netdb.m4], + [posix/netinet_in.m4], + [posix/netinet_tcp.m4], + [posix/poll.m4], + [posix/signal.m4], + [posix/syslog.m4], + [posix/time.m4], + [posix/unistd.m4], + [posix/wchar.m4], + [posix/wctype.m4]], [ dnl pecl build sinclude([m4/]incfile) dnl php-src build diff --git a/m4/ax_check_sign.m4 b/m4/ax/ax_check_sign.m4 similarity index 100% rename from m4/ax_check_sign.m4 rename to m4/ax/ax_check_sign.m4 diff --git a/m4/ax_pthread.m4 b/m4/ax/ax_pthread.m4 similarity index 100% rename from m4/ax_pthread.m4 rename to m4/ax/ax_pthread.m4 diff --git a/m4/errno.m4 b/m4/posix/errno.m4 similarity index 100% rename from m4/errno.m4 rename to m4/posix/errno.m4 diff --git a/m4/fcntl.m4 b/m4/posix/fcntl.m4 similarity index 100% rename from m4/fcntl.m4 rename to m4/posix/fcntl.m4 diff --git a/m4/glob.m4 b/m4/posix/glob.m4 similarity index 84% rename from m4/glob.m4 rename to m4/posix/glob.m4 index da5dc0e..f727d5e 100644 --- a/m4/glob.m4 +++ b/m4/posix/glob.m4 @@ -8,7 +8,8 @@ PSI_CHECK_GLOB() { int gl_flags, char **gl_pathv]) - PSI_DECL(int glob, [(char *path, int flags, void *err, glob_t *buf)]) + PSI_FUNCTOR_TYPE(int glob_err, [(const char *epath, int eerrno)]) + PSI_DECL(int glob, [(char *path, int flags, glob_err err, glob_t *buf)]) PSI_DECL(void globfree, [(glob_t *buf)]) PSI_CONST(GLOB_APPEND, int) diff --git a/m4/locale.m4 b/m4/posix/locale.m4 similarity index 100% rename from m4/locale.m4 rename to m4/posix/locale.m4 diff --git a/m4/ndbm.m4 b/m4/posix/ndbm.m4 similarity index 100% rename from m4/ndbm.m4 rename to m4/posix/ndbm.m4 diff --git a/m4/netdb.m4 b/m4/posix/netdb.m4 similarity index 98% rename from m4/netdb.m4 rename to m4/posix/netdb.m4 index 43008e5..8d5b49a 100644 --- a/m4/netdb.m4 +++ b/m4/posix/netdb.m4 @@ -76,7 +76,7 @@ PSI_CHECK_NETDB() { PSI_DECL(void endprotoent, [(void)]) PSI_DECL(void endservent, [(void)]) PSI_DECL(void freeaddrinfo, [(struct addrinfo *res)]) - PSI_DECL(char *gai_strerror, [(int errcode)]) + PSI_DECL(const char *gai_strerror, [(int errcode)]) PSI_DECL(int getaddrinfo, [(char *node, char *service, struct addrinfo *hints, struct addrinfo **res)]) PSI_DECL(struct hostent *gethostent, [(void)]) PSI_DECL(int getnameinfo, [(struct sockaddr *sa, socklen_t salen, char *host, socklen_t hostlen, char *serv, socklen_t servlen, int flags)]) diff --git a/m4/netinet_in.m4 b/m4/posix/netinet_in.m4 similarity index 100% rename from m4/netinet_in.m4 rename to m4/posix/netinet_in.m4 diff --git a/m4/netinet_tcp.m4 b/m4/posix/netinet_tcp.m4 similarity index 100% rename from m4/netinet_tcp.m4 rename to m4/posix/netinet_tcp.m4 diff --git a/m4/poll.m4 b/m4/posix/poll.m4 similarity index 100% rename from m4/poll.m4 rename to m4/posix/poll.m4 diff --git a/m4/signal.m4 b/m4/posix/signal.m4 similarity index 100% rename from m4/signal.m4 rename to m4/posix/signal.m4 diff --git a/m4/stddef.m4 b/m4/posix/stddef.m4 similarity index 100% rename from m4/stddef.m4 rename to m4/posix/stddef.m4 diff --git a/m4/stdint.m4 b/m4/posix/stdint.m4 similarity index 100% rename from m4/stdint.m4 rename to m4/posix/stdint.m4 diff --git a/m4/stdio.m4 b/m4/posix/stdio.m4 similarity index 100% rename from m4/stdio.m4 rename to m4/posix/stdio.m4 diff --git a/m4/stdlib.m4 b/m4/posix/stdlib.m4 similarity index 92% rename from m4/stdlib.m4 rename to m4/posix/stdlib.m4 index 4f2f739..60a3015 100644 --- a/m4/stdlib.m4 +++ b/m4/posix/stdlib.m4 @@ -56,7 +56,7 @@ PSI_CHECK_STDLIB() { PSI_DECL(long random, [()]) PSI_DECL(char *realpath, [(char *path, char *resolved)]) PSI_DECL(unsigned short *seed48, [(unsigned short seed16v@<:@3@:>@)]) - PSI_DECL(int setenv, [(char *var)]) + PSI_DECL(int setenv, [(char *var, char *val, int overwrite)]) AC_SEARCH_LIBS(setkey, crypt, [ PSI_DECL(void setkey, [(char *key)]) @@ -68,9 +68,9 @@ PSI_CHECK_STDLIB() { PSI_DECL(void srandom, [(unsigned seed)]) PSI_DECL(double strtod, [(char *nptr, char **endptr)]) PSI_DECL(float strtof, [(char *nptr, char **endptr)]) - PSI_DECL(long strtol, [(char *nptr, char **endptr)]) + PSI_DECL(long strtol, [(char *nptr, char **endptr, int base)]) PSI_DECL(long double strtold, [(const char *nptr, char **endptr)]) - PSI_DECL(unsigned long strtoul, [(char *nptr, char **endptr)]) + PSI_DECL(unsigned long strtoul, [(char *nptr, char **endptr, int base)]) PSI_DECL(int system, [(char *command)]) PSI_DECL(int unlockpt, [(int fd)]) PSI_DECL(int unsetenv, [(char *var)]) diff --git a/m4/sys_select.m4 b/m4/posix/sys_select.m4 similarity index 100% rename from m4/sys_select.m4 rename to m4/posix/sys_select.m4 diff --git a/m4/sys_socket.m4 b/m4/posix/sys_socket.m4 similarity index 100% rename from m4/sys_socket.m4 rename to m4/posix/sys_socket.m4 diff --git a/m4/sys_stat.m4 b/m4/posix/sys_stat.m4 similarity index 100% rename from m4/sys_stat.m4 rename to m4/posix/sys_stat.m4 diff --git a/m4/sys_time.m4 b/m4/posix/sys_time.m4 similarity index 89% rename from m4/sys_time.m4 rename to m4/posix/sys_time.m4 index 9c1f744..7dfecfd 100644 --- a/m4/sys_time.m4 +++ b/m4/posix/sys_time.m4 @@ -22,5 +22,4 @@ PSI_CHECK_SYS_TIME() { PSI_DECL(int setitimer, [(int which, struct itimerval *value, struct itimerval *ovalue)]) PSI_DECL(int gettimeofday, [(struct timeval *tp, struct timezone *tz)]) PSI_DECL(int utimes, [(char *path, struct timeval times@<:@2@:>@)]) - PSI_DECL(int utimensat, [(int fd, char *path, struct timespec times@<:@2@:>@)]) } diff --git a/m4/sys_times.m4 b/m4/posix/sys_times.m4 similarity index 100% rename from m4/sys_times.m4 rename to m4/posix/sys_times.m4 diff --git a/m4/sys_types.m4 b/m4/posix/sys_types.m4 similarity index 100% rename from m4/sys_types.m4 rename to m4/posix/sys_types.m4 diff --git a/m4/sys_uio.m4 b/m4/posix/sys_uio.m4 similarity index 100% rename from m4/sys_uio.m4 rename to m4/posix/sys_uio.m4 diff --git a/m4/sys_utsname.m4 b/m4/posix/sys_utsname.m4 similarity index 100% rename from m4/sys_utsname.m4 rename to m4/posix/sys_utsname.m4 diff --git a/m4/syslog.m4 b/m4/posix/syslog.m4 similarity index 100% rename from m4/syslog.m4 rename to m4/posix/syslog.m4 diff --git a/m4/time.m4 b/m4/posix/time.m4 similarity index 100% rename from m4/time.m4 rename to m4/posix/time.m4 diff --git a/m4/unistd.m4 b/m4/posix/unistd.m4 similarity index 100% rename from m4/unistd.m4 rename to m4/posix/unistd.m4 diff --git a/m4/wchar.m4 b/m4/posix/wchar.m4 similarity index 100% rename from m4/wchar.m4 rename to m4/posix/wchar.m4 diff --git a/m4/wctype.m4 b/m4/posix/wctype.m4 similarity index 100% rename from m4/wctype.m4 rename to m4/posix/wctype.m4 diff --git a/m4/psi.m4 b/m4/psi/psi.m4 similarity index 99% rename from m4/psi.m4 rename to m4/psi/psi.m4 index 8d8797c..2a1e681 100644 --- a/m4/psi.m4 +++ b/m4/psi/psi.m4 @@ -11,6 +11,8 @@ PSI_DECLS=$PHP_PSI_SRCDIR/php_psi_decls.h PSI_VA_DECLS=$PHP_PSI_SRCDIR/php_psi_va_decls.h PSI_FN_DECLS=$PHP_PSI_SRCDIR/php_psi_fn_decls.h +PSI_CONFIG_APPEND= + dnl PSI_CONFIG_INIT() dnl Creates stubs of the headers with pre-defined types etc. dnl These headers are included by src/context.c. @@ -107,12 +109,12 @@ AC_DEFUN(PSI_CONFIG_DONE, [ cat >$PSI_STDINC <var = PSI_CALC(v1->var, v2->var); \ - if (!res->var) fprintf(stderr, fmt, v1->var, v2->var, res->var); \ + if (!res->var && (v1->var || v2->var)) fprintf(stderr, fmt, v1->var, v2->var, res->var); \ } while (0) #define PSI_CALC_OP2(vres, var1, var2) do { \ const char *fmt = "calc %" PRI##var1 ", %" PRI##var2 ": %" PRI##vres "\n"; \ res->vres = PSI_CALC(v1->var1, v2->var2); \ - if (!res->vres) fprintf(stderr, fmt, v1->var1, v2->var2, res->vres); \ + if (!res->vres && (v1->var1 || v2->var2)) fprintf(stderr, fmt, v1->var1, v2->var2, res->vres); \ } while(0) #ifdef HAVE_LONG_DOUBLE diff --git a/tests/glob/glob002.phpt b/tests/glob/glob002.phpt index 4ac964a..36edb4d 100644 --- a/tests/glob/glob002.phpt +++ b/tests/glob/glob002.phpt @@ -12,7 +12,7 @@ PHP_OS === "Linux" or die("skip - only for Linux"); 5]; -var_dump(psi\glob("*.php{,t}", psi\GLOB_BRACE|psi\GLOB_DOOFFS, $glob)); +var_dump(psi\glob("*002.php{,t}", psi\GLOB_BRACE|psi\GLOB_DOOFFS, $glob)); var_dump($glob); ?> ===DONE=== @@ -21,13 +21,13 @@ var_dump($glob); int(0) array(4) { ["gl_pathc"]=> - int(4) + int(2) ["gl_offs"]=> int(5) ["gl_flags"]=> int(%d) ["gl_pathv"]=> - array(9) { + array(7) { [0]=> string(0) "" [1]=> @@ -41,11 +41,7 @@ array(4) { [5]=> string(11) "glob002.php" [6]=> - string(12) "glob001.phpt" - [7]=> string(12) "glob002.phpt" - [8]=> - string(12) "glob003.phpt" } } ===DONE=== -- 2.30.2