Mercurial > gnulib
comparison m4/manywarnings-c++.m4 @ 39906:39f09bed8945
Make better use of Autoconf.
* m4/environ.m4: Use AC_CACHE_CHECK where possible.
* m4/manywarnings.m4: Likewise.
* m4/manywarnings-c++.m4: Likewise.
* m4/socklen.m4: Likewise.
* m4/sockpfaf.m4: Likewise.
* m4/stdarg.m4: Likewise.
* m4/visibility.m4: Likewise.
* m4/fsusage.m4: Use AC_CACHE_CHECK where possible. Modernize
indentation.
* m4/ls-mntd-fs.m4: Likewise.
author | Bruno Haible <bruno@clisp.org> |
---|---|
date | Fri, 12 Oct 2018 02:42:44 +0200 |
parents | 65d6b6e14d50 |
children | b06060465f09 |
comparison
equal
deleted
inserted
replaced
39905:c3122bb580fe | 39906:39f09bed8945 |
---|---|
1 # manywarnings-c++.m4 serial 2 | 1 # manywarnings-c++.m4 serial 3 |
2 dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. | 2 dnl Copyright (C) 2008-2018 Free Software Foundation, Inc. |
3 dnl This file is free software; the Free Software Foundation | 3 dnl This file is free software; the Free Software Foundation |
4 dnl gives unlimited permission to copy and/or distribute it, | 4 dnl gives unlimited permission to copy and/or distribute it, |
5 dnl with or without modifications, as long as this notice is preserved. | 5 dnl with or without modifications, as long as this notice is preserved. |
6 | 6 |
15 AC_REQUIRE([AC_PROG_CXX]) | 15 AC_REQUIRE([AC_PROG_CXX]) |
16 if test -n "$GXX"; then | 16 if test -n "$GXX"; then |
17 | 17 |
18 dnl Check if -W -Werror -Wno-missing-field-initializers is supported | 18 dnl Check if -W -Werror -Wno-missing-field-initializers is supported |
19 dnl with the current $CXX $CXXFLAGS $CPPFLAGS. | 19 dnl with the current $CXX $CXXFLAGS $CPPFLAGS. |
20 AC_MSG_CHECKING([whether -Wno-missing-field-initializers is supported]) | 20 AC_CACHE_CHECK([whether -Wno-missing-field-initializers is supported], |
21 AC_CACHE_VAL([gl_cv_cxx_nomfi_supported], [ | 21 [gl_cv_cxx_nomfi_supported], |
22 gl_save_CXXFLAGS="$CXXFLAGS" | 22 [gl_save_CXXFLAGS="$CXXFLAGS" |
23 CXXFLAGS="$CXXFLAGS -W -Werror -Wno-missing-field-initializers" | 23 CXXFLAGS="$CXXFLAGS -W -Werror -Wno-missing-field-initializers" |
24 AC_COMPILE_IFELSE( | 24 AC_COMPILE_IFELSE( |
25 [AC_LANG_PROGRAM([[]], [[]])], | 25 [AC_LANG_PROGRAM([[]], [[]])], |
26 [gl_cv_cxx_nomfi_supported=yes], | 26 [gl_cv_cxx_nomfi_supported=yes], |
27 [gl_cv_cxx_nomfi_supported=no]) | 27 [gl_cv_cxx_nomfi_supported=no]) |
28 CXXFLAGS="$gl_save_CXXFLAGS"]) | 28 CXXFLAGS="$gl_save_CXXFLAGS" |
29 AC_MSG_RESULT([$gl_cv_cxx_nomfi_supported]) | 29 ]) |
30 | 30 |
31 if test "$gl_cv_cxx_nomfi_supported" = yes; then | 31 if test "$gl_cv_cxx_nomfi_supported" = yes; then |
32 dnl Now check whether -Wno-missing-field-initializers is needed | 32 dnl Now check whether -Wno-missing-field-initializers is needed |
33 dnl for the { 0, } construct. | 33 dnl for the { 0, } construct. |
34 AC_MSG_CHECKING([whether -Wno-missing-field-initializers is needed]) | 34 AC_CACHE_CHECK([whether -Wno-missing-field-initializers is needed], |
35 AC_CACHE_VAL([gl_cv_cxx_nomfi_needed], [ | 35 [gl_cv_cxx_nomfi_needed], |
36 gl_save_CXXFLAGS="$CXXFLAGS" | 36 [gl_save_CXXFLAGS="$CXXFLAGS" |
37 CXXFLAGS="$CXXFLAGS -W -Werror" | 37 CXXFLAGS="$CXXFLAGS -W -Werror" |
38 AC_COMPILE_IFELSE( | 38 AC_COMPILE_IFELSE( |
39 [AC_LANG_PROGRAM( | 39 [AC_LANG_PROGRAM( |
40 [[int f (void) | 40 [[int f (void) |
41 { | 41 { |
42 typedef struct { int a; int b; } s_t; | 42 typedef struct { int a; int b; } s_t; |
43 s_t s1 = { 0, }; | 43 s_t s1 = { 0, }; |
44 return s1.b; | 44 return s1.b; |
45 } | 45 } |
46 ]], | 46 ]], |
47 [[]])], | 47 [[]])], |
48 [gl_cv_cxx_nomfi_needed=no], | 48 [gl_cv_cxx_nomfi_needed=no], |
49 [gl_cv_cxx_nomfi_needed=yes]) | 49 [gl_cv_cxx_nomfi_needed=yes]) |
50 CXXFLAGS="$gl_save_CXXFLAGS" | 50 CXXFLAGS="$gl_save_CXXFLAGS" |
51 ]) | 51 ]) |
52 AC_MSG_RESULT([$gl_cv_cxx_nomfi_needed]) | |
53 fi | 52 fi |
54 | 53 |
55 dnl Next, check if -Werror -Wuninitialized is useful with the | 54 dnl Next, check if -Werror -Wuninitialized is useful with the |
56 dnl user's choice of $CXXFLAGS; some versions of gcc warn that it | 55 dnl user's choice of $CXXFLAGS; some versions of gcc warn that it |
57 dnl has no effect if -O is not also used | 56 dnl has no effect if -O is not also used |
58 AC_MSG_CHECKING([whether -Wuninitialized is supported]) | 57 AC_CACHE_CHECK([whether -Wuninitialized is supported], |
59 AC_CACHE_VAL([gl_cv_cxx_uninitialized_supported], [ | 58 [gl_cv_cxx_uninitialized_supported], |
60 gl_save_CXXFLAGS="$CXXFLAGS" | 59 [gl_save_CXXFLAGS="$CXXFLAGS" |
61 CXXFLAGS="$CXXFLAGS -Werror -Wuninitialized" | 60 CXXFLAGS="$CXXFLAGS -Werror -Wuninitialized" |
62 AC_COMPILE_IFELSE( | 61 AC_COMPILE_IFELSE( |
63 [AC_LANG_PROGRAM([[]], [[]])], | 62 [AC_LANG_PROGRAM([[]], [[]])], |
64 [gl_cv_cxx_uninitialized_supported=yes], | 63 [gl_cv_cxx_uninitialized_supported=yes], |
65 [gl_cv_cxx_uninitialized_supported=no]) | 64 [gl_cv_cxx_uninitialized_supported=no]) |
66 CXXFLAGS="$gl_save_CXXFLAGS"]) | 65 CXXFLAGS="$gl_save_CXXFLAGS" |
67 AC_MSG_RESULT([$gl_cv_cxx_uninitialized_supported]) | 66 ]) |
68 | 67 |
69 fi | 68 fi |
70 | 69 |
71 # List all gcc warning categories. | 70 # List all gcc warning categories. |
72 # To compare this list to your installed GCC's, run this Bash command: | 71 # To compare this list to your installed GCC's, run this Bash command: |