Handle some Autoconf/make errors better.
Fix "make releasetar" on AIX and Solaris.
Mend "make check" on Solaris 9 with Autoconf.
+ Address assorted compiler warnings.
Wednesday, June 9, 2021 by gharris
Summary for 4.99.1 tcpdump release
"$CC" --version
;;
xl*)
- # XL C for AIX recognizes -qversion, prints to stdout and exits with 0,
- # but on an unknown command-line flag displays its man page and waits.
- "$CC" -qversion
+ # XL C 12.1 and 13.1 recognize "-qversion", print to stdout and exit
+ # with 0. XL C 12.1 on an unknown command-line flag displays its man
+ # page and waits.
+ # XL C 16.1 recognizes "-qversion" and "--version", prints to stdout
+ # and exits with 0. Community Edition also prints a banner to stderr.
+ "$CC" -qversion 2>/dev/null
;;
sun*)
# Sun compilers recognize -V, print to stderr and exit with an error.
return
fi
- cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^IBM XL C.* for AIX, V\([0-9\.]*\).*$/xlc-\1/'`
+ cc_id_guessed=`echo "$cc_id_firstline" | sed 's/^IBM XL C.*, V\([0-9\.]*\).*$/xlc-\1/'`
if [ "$cc_id_firstline" != "$cc_id_guessed" ]; then
echo "$cc_id_guessed"
return
echo '-Werror'
;;
xlc-*)
+ # XL C 12.1 and 13.1 recognize "-qhalt=w". XL C 16.1 recognizes that
+ # and "-Werror".
echo '-qhalt=w'
;;
suncc-*)
*
* The version number in __xlC__ has the major version in the
* upper 8 bits and the minor version in the lower 8 bits.
+ * On AIX __xlC__ is always defined, __ibmxl__ becomes defined in XL C 16.1.
+ * On Linux since XL C 13.1.6 __xlC__ is not defined by default anymore, but
+ * __ibmxl__ is defined since at least XL C 13.1.1.
*/
#if ! defined(__xlC__)
+#if ! defined(__ibmxl__)
#define ND_IS_AT_LEAST_XL_C_VERSION(major,minor) 0
#else
+#define ND_IS_AT_LEAST_XL_C_VERSION(major, minor) \
+ (__ibmxl_version__ > (major) || \
+ (__ibmxl_version__ == (major) && __ibmxl_release__ >= (minor)))
+#endif /* ! __ibmxl__ */
+#else /* ! __xlC__ */
#define ND_IS_AT_LEAST_XL_C_VERSION(major, minor) \
(__xlC__ >= (((major) << 8) | (minor)))
#endif
#define DIAG_DO_PRAGMA(x) _Pragma (#x)
#endif
+/*
+ * XL C 12.1 and 13.1 for AIX require no attention in this department.
+ * XL C 16.1 defines both __GNUC__ and __clang__, so has to be tested first.
+ */
+#if ND_IS_AT_LEAST_XL_C_VERSION(16,1)
+ /*
+ * See respective Clang note below.
+ */
+ #define DIAG_OFF_ASSIGN_ENUM \
+ DIAG_DO_PRAGMA(clang diagnostic push) \
+ DIAG_DO_PRAGMA(clang diagnostic ignored "-Wassign-enum")
+ #define DIAG_ON_ASSIGN_ENUM \
+ DIAG_DO_PRAGMA(clang diagnostic pop)
+
+ #define DIAG_OFF_CAST_QUAL
+ #define DIAG_ON_CAST_QUAL
+ #define DIAG_OFF_DEPRECATION
+ #define DIAG_ON_DEPRECATION
/*
* The current clang compilers also define __GNUC__ and __GNUC_MINOR__
* thus we need to test the clang case before the GCC one
*/
-#if ND_IS_AT_LEAST_CLANG_VERSION(2,8)
+#elif ND_IS_AT_LEAST_CLANG_VERSION(2,8)
/*
* Clang complains if you OR together multiple enum values of a
* given enum type and them pass it as an argument of that enum
/*
* However, GCC didn't support that for function *pointers* until GCC
* 4.1.0; see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3481.
+ * XL C 16.1 (and possibly some earlier versions, but not 12.1 or 13.1) has
+ * a similar bug, a bugfix for which should be available later:
+ * https://www.ibm.com/support/pages/apar/LI81402
*/
- #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) < 401))
+ #if (defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) < 401)) || \
+ (ND_IS_AT_LEAST_XL_C_VERSION(16,1) && !ND_IS_AT_LEAST_XL_C_VERSION(16,2))
#define PRINTFLIKE_FUNCPTR(x,y)
#else
#define PRINTFLIKE_FUNCPTR(x,y) __attribute__((__format__(__printf__,x,y)))