Skip to content

Enable -Wundef compiler warning #5526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 13 commits into from

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented May 5, 2020

This is not enabled by -Wextra and seems like something sane to have which is not much effort to make work.

Except for this one:

In file included from Zend/zend_language_scanner.l:38:0:
Zend/zend_language_parser.h:38:5: warning: "YYDEBUG" is not defined [-Wundef]
 #if YYDEBUG
     ^

Which is generated by Bison but I also don't understand why the compilers are complaining as the generated code is (at least locally):

/* Debug traces.  */
#ifndef ZENDDEBUG
# if defined YYDEBUG
#if YYDEBUG
#   define ZENDDEBUG 1
#  else
#   define ZENDDEBUG 0
#  endif
# else /* ! defined YYDEBUG */
#  define ZENDDEBUG 0
# endif /* ! defined YYDEBUG */
#endif  /* ! defined ZENDDEBUG */

Note, I realized that the following macros are always defined, but only on Windows:

AC_DEFINE('HAVE_GAI_STRERROR', main_network_has_ipv6);
AC_DEFINE('HAVE_IPV6', main_network_has_ipv6);

Fixed with: ca6dd7e

AC_DEFINE('HAVE_GETADDRINFO', main_network_has_ipv6);
See https://heap.space/xref/php-src/win32/build/config.w32?r=84854a72#283

Review list:

  • Extensions:
    • BCMath
    • BZ2
    • Calendar
    • COM_DotNet
    • CType
    • cURL
    • Date
    • DBA
    • Dom
    • Enchant: about HAVE_ENCHANT_BROKER_SET_PARAM or need to always be defined for Nux* or need to drop always defined on Windows and adjust #if/#ifdef accordingly
    • EXIF
    • FFI - does #if FFI_CLOSURES need to be #ifdef FFI_CLOSURES?
    • Fileinfo
    • Filter
    • FTP
    • GD
    • GetText
    • GMP
    • Hash
    • Iconv
    • IMAP
    • INTL
    • JSON
    • LDAP
    • LibXML
    • MBString
    • MySQLi
    • MySQLnd
    • OCI8 - currently bundling with Some cleanup in OCI8 extension for PHP 8 #5603
    • ODBC
    • OpCache - Needs to be reviewed
    • OpenSSL
    • PCNTL
    • PCRE
    • PDO
    • PDO_DBLIB
    • PDO_FIREBIRD
    • PDO_MYSQL
    • PDO_OCI
    • PDO_ODBC
    • PDO_PGSQL
    • PDO_SQLite
    • PGSQL
    • PHAR
    • POSIX
    • PSpell
    • Readline
    • Reflection
    • Session
    • SHMOP
    • SimpleXML
    • Skeleton
    • SNMP - Need to resolve HAVE_GETADDRINFO issue before finished
    • Soap
    • Sockets - Need to resolve HAVE_GETADDRINFO issue before finished
    • Sodium
    • SPL
    • SQLite3
    • Standard:
      • base64
    • Sysvmsg
    • Sysvsem
    • Sysvshm
    • Tidy
    • Tokenizer
    • XML
    • XMLReader
    • XMLRPC Ignoring this as it's getting unbundled
    • XMLWriter
    • XSL
    • zend_test
    • ZIP
    • ZLib
  • main/
  • SAPIs:
    • Apache2Handler
    • CGI
    • CLI (may want to reconfirm)
    • Embed
    • FPM (may want to reconfirm)
    • Fuzzer
    • LiteSpeed
    • PHPDBG (may want to reconfirm)
  • TSRM
  • Win32
  • Zend/

@Girgias Girgias force-pushed the undef-compiler-warning branch 3 times, most recently from 04ee8ee to 2da480a Compare May 5, 2020 12:06
@Girgias Girgias marked this pull request as draft May 5, 2020 12:24
@Girgias Girgias force-pushed the undef-compiler-warning branch from 2da480a to 2d52c13 Compare May 5, 2020 16:40
@Girgias Girgias mentioned this pull request May 5, 2020
@Girgias Girgias force-pushed the undef-compiler-warning branch 2 times, most recently from d789c7a to a32cc30 Compare May 5, 2020 20:14
@Girgias Girgias marked this pull request as ready for review May 6, 2020 16:31
@Girgias Girgias force-pushed the undef-compiler-warning branch 2 times, most recently from 1d9f817 to ed23794 Compare May 12, 2020 21:31
@Girgias Girgias mentioned this pull request May 13, 2020
@Girgias Girgias force-pushed the undef-compiler-warning branch 2 times, most recently from ce4316d to 5c19ecf Compare May 16, 2020 14:11
@Girgias Girgias force-pushed the undef-compiler-warning branch 5 times, most recently from 9cff451 to c6fad3d Compare May 20, 2020 13:42
@Girgias Girgias force-pushed the undef-compiler-warning branch 2 times, most recently from 91b2ad7 to b859ca2 Compare May 23, 2020 14:13
@Girgias Girgias force-pushed the undef-compiler-warning branch from b859ca2 to 5ea966d Compare June 10, 2020 23:28
@Girgias Girgias force-pushed the undef-compiler-warning branch 3 times, most recently from 5ddec73 to 1e4cf4f Compare August 7, 2020 18:44
@Girgias Girgias force-pushed the undef-compiler-warning branch from 1e4cf4f to ec13b80 Compare September 3, 2020 12:36
@Girgias Girgias force-pushed the undef-compiler-warning branch 2 times, most recently from b84801e to 0057709 Compare September 23, 2020 10:13
@Girgias
Copy link
Member Author

Girgias commented May 30, 2024

Closing this as the current PR is very outdated and follow-up work for this has been done.

@Girgias Girgias closed this May 30, 2024
@Girgias Girgias deleted the undef-compiler-warning branch May 30, 2024 11:49
petk added a commit to petk/php-src that referenced this pull request May 31, 2024
These are either undefined or defined to value 1:
- HAVE_CRYPT
- HAVE_CRYPT_H
- HAVE_UNISTD_H

Follow up of phpGH-5526 (-Wundef)
petk added a commit that referenced this pull request Jun 1, 2024
These are either undefined or defined to value 1:
- HAVE_CRYPT
- HAVE_CRYPT_H
- HAVE_UNISTD_H

Follow up of GH-5526 (-Wundef)
petk added a commit that referenced this pull request Jun 7, 2024
These are either undefined or defined to value 1 in Autotools and
Windows:
- HAVE_COMMONCRYPTO_COMMONRANDOM_H
- HAVE_EXIF
- HAVE_FOPENCOOKIE
- HAVE_IF_NAMETOINDEX
- HAVE_LIBICONV
- HAVE_SOCKETS
- HAVE_STRUCT_STAT_ST_RDEV
- HAVE_STRUCT_TM_TM_GMTOFF
- HAVE_STRUCT_TM_TM_ZONE

Follow up of GH-5526 (-Wundef)
petk added a commit to petk/php-src that referenced this pull request Jun 8, 2024
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

Follow up of phpGH-5526 (-Wundef).
petk added a commit to petk/php-src that referenced this pull request Jun 8, 2024
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of phpGH-5526 (-Wundef).
@petk petk mentioned this pull request Jun 8, 2024
petk added a commit to petk/php-src that referenced this pull request Jun 8, 2024
These are either undefined or defined to value 1:
- ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE
- ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PROTO
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR

Follow up of phpGH-5526 (-Wundef)
@petk petk mentioned this pull request Jun 8, 2024
petk added a commit to petk/php-src that referenced this pull request Jun 8, 2024
These are either undefined or defined to 1:
- HAVE_LIBEDIT
- HAVE_LIBREADLINE
- ZEND_MAX_EXECUTION_TIMERS

Follow up of phpGH-5526 (-Wundef)
petk added a commit that referenced this pull request Jun 9, 2024
These are either undefined or defined to value 1:
- ZEND_INTRIN_SSE4_2_PCLMUL_NATIVE
- ZEND_INTRIN_SSE4_2_PCLMUL_RESOLVER
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PROTO
- ZEND_INTRIN_SSE4_2_PCLMUL_FUNC_PTR

Follow up of GH-5526 (-Wundef)
petk added a commit to petk/php-src that referenced this pull request Jun 9, 2024
These are either undefined or defined (to value 1):
- __DragonFly__
- __FreeBSD__
- HAS_MCAST_EXT
- HAVE_GETCWD
- HAVE_GETWD
- HAVE_GLIBC_ICONV
- HAVE_JIT
- HAVE_LCHOWN
- HAVE_NL_LANGINFO
- HAVE_RL_CALLBACK_READ_CHAR
- HAVE_RL_ON_NEW_LINE
- HAVE_SQL_EXTENDED_FETCH
- HAVE_UTIME

Follow up of phpGH-5526 (-Wundef)
@petk petk mentioned this pull request Jun 9, 2024
petk added a commit that referenced this pull request Jun 9, 2024
This syncs CPP macro conditions:
- _WIN32
- _WIN64
- HAVE_ALLOCA_H
- HAVE_ALPHASORT
- HAVE_ARPA_INET_H
- HAVE_CONFIG_H
- HAVE_DIRENT_H
- HAVE_DLFCN_H
- HAVE_GETTIMEOFDAY
- HAVE_LIBDL
- HAVE_POLL_H
- HAVE_PWD_H
- HAVE_SCANDIR
- HAVE_SYS_FILE_H
- HAVE_SYS_PARAM_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_TIME_H
- HAVE_SYS_TYPES_H
- HAVE_SYS_WAIT_H
- HAVE_UNISTD_H
- PHP_WIN32
- ZEND_WIN32

These are either undefined or defined to 1 in Autotools and Windows.

Follow up of GH-5526 (-Wundef).
petk added a commit to petk/php-src that referenced this pull request Jun 9, 2024
This fixes few more -Wundef warnings in ext/fileinfo. The
PHP_FILEINFO_UNCOMPRESS seems to be present to be defined at some point
but is currently unused in all build systems. Leaving this intact for
now.

Follow up of phpGH-5526 (-Wundef)
petk added a commit that referenced this pull request Jun 10, 2024
This fixes few more -Wundef warnings in ext/fileinfo. The
PHP_FILEINFO_UNCOMPRESS seems to be present to be defined at some point
but is currently unused in all build systems. Leaving this intact for
now.

Follow up of GH-5526 (-Wundef)
petk added a commit that referenced this pull request Jun 10, 2024
These are either undefined or defined to 1:
- HAVE_LIBEDIT
- HAVE_LIBREADLINE
- ZEND_MAX_EXECUTION_TIMERS

Follow up of GH-5526 (-Wundef)
petk added a commit that referenced this pull request Jun 11, 2024
These are either undefined or defined (to value 1):
- __DragonFly__
- __FreeBSD__
- HAS_MCAST_EXT
- HAVE_GETCWD
- HAVE_GETWD
- HAVE_GLIBC_ICONV
- HAVE_JIT
- HAVE_LCHOWN
- HAVE_NL_LANGINFO
- HAVE_RL_CALLBACK_READ_CHAR
- HAVE_RL_ON_NEW_LINE
- HAVE_SQL_EXTENDED_FETCH
- HAVE_UTIME

Follow up of GH-5526 (-Wundef)
petk added a commit to petk/php-src that referenced this pull request Jun 20, 2024
The libmagic library also uses the HAVE_VISIBILITY macro that should be
defined to 1 if visibility is supported or 0 if not.

Follow-up of phpGH-5526 (-Wundef)
petk added a commit to petk/php-src that referenced this pull request Jun 21, 2024
These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of phpGH-5526
petk added a commit that referenced this pull request Jun 21, 2024
The libmagic library also uses the HAVE_VISIBILITY macro that should be
defined to 1 if visibility is supported or 0 if not.

Follow-up of GH-5526 (-Wundef)
devnexen pushed a commit to devnexen/php-src that referenced this pull request Jun 21, 2024
The libmagic library also uses the HAVE_VISIBILITY macro that should be
defined to 1 if visibility is supported or 0 if not.

Follow-up of phpGH-5526 (-Wundef)
petk added a commit that referenced this pull request Jun 24, 2024
These are either define (to value 1) or undefined:
- __GNUC__
- DBA_CDB_BUILTIN
- DBA_GDBM
- HAVE_FORK
- HAVE_PUTENV
- HAVE_SETENV
- HAVE_SYS_SELECT_H
- HAVE_SYS_SOCKET_H
- HAVE_SYS_WAIT_H
- HAVE_UNSETENV
- RFC3678_API
- ZEND_ENABLE_ZVAL_LONG64
- ZTS

Follow-up of GH-5526
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants