diff configure.ac @ 30536:492a37a18b81 stable

Guard usage of non-standard pragmas. * configure.ac (HAVE_PRAGMA_GCC_VISIBILITY): Add new test for "#pragma GCC visibility". (HAVE_PRAGMA_GCC_DIAGNOSTIC): Fix typo in test. * libinterp/template-inst/Array-tc.cc: Use HAVE_PRAGMA_GCC_VISIBILITY. * liboctave/util/blaswrap.c: Use HAVE_PRAGMA_GCC_DIAGNOSTIC. * liboctave/wrappers/stat-wrappers.c, liboctave/wrappers/wait-wrappers.c: Fix indentation.
author Markus Mützel <markus.muetzel@gmx.de>
date Thu, 23 Dec 2021 11:55:09 +0100
parents 9b41aba64c12
children 5ff87e646505 c94757297640
line wrap: on
line diff
--- a/configure.ac	Thu Dec 23 15:24:55 2021 +0100
+++ b/configure.ac	Thu Dec 23 11:55:09 2021 +0100
@@ -2842,11 +2842,11 @@
 ### Check for GCC-specific pragmas to control warnings.
 
 AC_LANG_PUSH(C++)
-AC_CACHE_CHECK([for @%:@pragma GCC diagnostic push/pop/ignore],
+AC_CACHE_CHECK([for @%:@pragma GCC diagnostic push/pop/ignored],
   [octave_cv_gcc_has_pragma_GCC_diagnostic],
   [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
 #pragma GCC diagnostic push
-#pragma GCC diagnostic ignore "-Wold-style-cast"
+#pragma GCC diagnostic ignored "-Wold-style-cast"
   int three = (int) 3.1415926;
 #pragma GCC diagnostic pop
     ]])],
@@ -2857,14 +2857,30 @@
 
 if test $octave_cv_gcc_has_pragma_GCC_diagnostic = yes; then
   AC_DEFINE(HAVE_PRAGMA_GCC_DIAGNOSTIC, 1,
-    [Define to 1 if GCC supports @%:@pragma GCC diagnostic ...])
+    [Define to 1 if compiler supports @%:@pragma GCC diagnostic ...])
+fi
+
+AC_CACHE_CHECK([for @%:@pragma GCC visibility push/pop],
+  [octave_cv_gcc_has_pragma_GCC_visiblity],
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[
+#pragma GCC visibility push(default)
+  int three = 3;
+#pragma GCC visiblity pop(default)
+    ]])],
+    [octave_cv_gcc_has_pragma_GCC_visiblity=yes],
+    [octave_cv_gcc_has_pragma_GCC_visiblity=no])],
+  ])
+
+if test $octave_cv_gcc_has_pragma_GCC_visiblity = yes; then
+  AC_DEFINE(HAVE_PRAGMA_GCC_VISIBILITY, 1,
+    [Define to 1 if compiler supports @%:@pragma GCC visiblity ...])
 fi
 
 ## Check for one unusual warning used in pragmas that is not always available
 if test $octave_cv_gcc_has_pragma_GCC_diagnostic = yes; then
   OCTAVE_CC_FLAG([-Wimplicit-fallthrough],
     [AC_DEFINE(HAVE_WARN_IMPLICIT_FALLTHROUGH, 1,
-      [Define to 1 if GCC supports -Wimplicit-fallthrough warning])])
+      [Define to 1 if compiler supports -Wimplicit-fallthrough warning])])
 fi
 
 ### These are recommended by the gnulib bootstrap script: