diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-08-19 11:25:24 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-08-19 11:25:24 -0700 |
commit | 3dc736d939536bcd843597cb655fcba28268705c (patch) | |
tree | 6c69e8113f12d847aa00e1c56df66c5777a43137 /aclocal.m4 | |
parent | 297bf6343f27ea1d18e5dad529c253ffd3935d41 (diff) | |
download | tcpdump-3dc736d939536bcd843597cb655fcba28268705c.tar.gz |
Handle attributes for function pointers by checking the compiler version.
Handle attributes for function pointers the same way we handle
attributes for functions, by explicitly checking for the compiler
version with #if rather than with a configure script check. That's one
fewer thing that, if you're not using autoconf, has to be done in some
other fashion.
While we're at it, put NORETURN in the right place to have it work with
Microsoft Visual Studio as well as various UN*X compilers.
Diffstat (limited to 'aclocal.m4')
-rw-r--r-- | aclocal.m4 | 90 |
1 files changed, 0 insertions, 90 deletions
@@ -1234,96 +1234,6 @@ AC_MSG_RESULT($ac_cv___attribute___unused) ]) dnl -dnl Test whether __attribute__((format)) can be used without warnings -dnl - -AC_DEFUN(AC_C___ATTRIBUTE___FORMAT, [ -AC_MSG_CHECKING([whether __attribute__((format)) can be used without warnings]) -AC_CACHE_VAL(ac_cv___attribute___format, [ -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors" -AC_COMPILE_IFELSE([ - AC_LANG_SOURCE([[ -#include <stdlib.h> - -extern int foo(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); - -int -main(int argc, char **argv) -{ - foo("%s", "test"); -} - ]])], -ac_cv___attribute___format=yes, -ac_cv___attribute___format=no)]) -CFLAGS="$save_CFLAGS" -if test "$ac_cv___attribute___format" = "yes"; then - AC_DEFINE(__ATTRIBUTE___FORMAT_OK, 1, - [define if your compiler allows __attribute__((format)) without a warning]) -fi -AC_MSG_RESULT($ac_cv___attribute___format) -]) - -dnl -dnl Test whether __attribute__((format)) can be applied to function -dnl pointers -dnl - -AC_DEFUN(AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER, [ -AC_MSG_CHECKING([whether __attribute__((format)) can be applied to function pointers]) -AC_CACHE_VAL(ac_cv___attribute___format_function_pointer, [ -AC_COMPILE_IFELSE([ - AC_LANG_SOURCE([[ -#include <stdlib.h> - -extern int (*foo)(const char *fmt, ...) - __attribute__ ((format (printf, 1, 2))); - -int -main(int argc, char **argv) -{ - (*foo)("%s", "test"); -} - ]])], -ac_cv___attribute___format_function_pointer=yes, -ac_cv___attribute___format_function_pointer=no)]) -if test "$ac_cv___attribute___format_function_pointer" = "yes"; then - AC_DEFINE(__ATTRIBUTE___FORMAT_OK_FOR_FUNCTION_POINTERS, 1, - [define if your compiler allows __attribute__((format)) to be applied to function pointers]) -fi -AC_MSG_RESULT($ac_cv___attribute___format_function_pointer) -]) - -AC_DEFUN(AC_C___ATTRIBUTE___NORETURN_FUNCTION_POINTER, [ -AC_MSG_CHECKING([whether __attribute__((noreturn)) can be applied to function pointers without warnings]) -AC_CACHE_VAL(ac_cv___attribute___noreturn_function_pointer, [ -save_CFLAGS="$CFLAGS" -CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors" -AC_COMPILE_IFELSE([ - AC_LANG_SOURCE([[ -#include <stdlib.h> - -extern int (*foo)(int i) - __attribute__ ((noreturn)); - -int -main(int argc, char **argv) -{ - (*foo)(1); -} - ]])], -ac_cv___attribute___noreturn_function_pointer=yes, -ac_cv___attribute___noreturn_function_pointer=no)]) -CFLAGS="$save_CFLAGS" -if test "$ac_cv___attribute___noreturn_function_pointer" = "yes"; then - AC_DEFINE(__ATTRIBUTE___NORETURN_OK_FOR_FUNCTION_POINTERS, 1, - [define if your compiler allows __attribute__((noreturn)) to be applied to function pointers]) -fi -AC_MSG_RESULT($ac_cv___attribute___noreturn_function_pointer) -]) - -dnl dnl Test whether __attribute__((fallthrough)) can be used without warnings dnl |