LINUX: Check for -Wno-error=frame-larger-than= 62/13762/3
authorAndrew Deason <adeason@sinenomine.net>
Sat, 10 Aug 2019 03:36:17 +0000 (22:36 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 6 Sep 2019 16:33:24 +0000 (12:33 -0400)
Commit cc7f942a (LINUX: Disable kernel fortuna large frame errors)
added -Wno-error=frame-larger-than= to the CFLAGS for a file, but
older gcc (like 4.3.4 from SLES 11.x) does not support this flag,
causing a compiler error.

To avoid this, add a configure check for
-Wno-error=frame-larger-than=, and only use it if the compiler
supports it.

Thanks to mvitale@sinenomine.net for discovering the error.

Change-Id: I5486d2d4711f2c301be1cb79f0aaad69a22e9d3a
Reviewed-on: https://gerrit.openafs.org/13762
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: Benjamin Kaduk <kaduk@mit.edu>

src/cf/linux-checks.m4
src/cf/linux-test5.m4
src/libafs/MakefileProto.LINUX.in

index d4a6c97..0fc9c4d 100644 (file)
@@ -51,6 +51,8 @@ case $AFS_SYSNAME in *_linux* | *_umlinux*)
         OPENAFS_LINUX_KERNEL_PACKAGING_CHECKS
         OPENAFS_LINUX_KERNEL_SYSCALL_PROBE_CHECKS
         OPENAFS_LINUX_KERNEL_MORE_ASSORTED_CHECKS
+
+        OPENAFS_GCC_SUPPORTS_WNO_ERROR_FRAME_LARGER_THAN
     fi
     OPENAFS_LINUX_MISC_DEFINES
 esac
index 59bdbfc..da0d363 100644 (file)
@@ -86,3 +86,24 @@ AC_DEFUN([OPENAFS_GCC_SUPPORTS_PIPE], [
   AS_IF([test x$openafs_cv_gcc_supports_pipe = xyes],
          [LINUX_GCC_KOPTS="$LINUX_GCC_KOPTS -pipe"])
 ])
+
+AC_DEFUN([OPENAFS_GCC_SUPPORTS_WNO_ERROR_FRAME_LARGER_THAN], [
+  AC_CACHE_CHECK([if $CC supports -Wno-error=frame-larger-than=],
+    [openafs_cv_gcc_supports_wno_error_frame_larger_than],
+    [save_CFLAGS="$CFLAGS"
+     CFLAGS="-Wno-error=frame-larger-than="
+     AC_COMPILE_IFELSE(
+       [AC_LANG_PROGRAM(
+         [[]],
+         [[int x;]])],
+       [openafs_cv_gcc_supports_wno_error_frame_larger_than=yes],
+       [openafs_cv_gcc_supports_wno_error_frame_larger_than=no])
+  CFLAGS="$save_CFLAGS"
+  ])
+  AS_IF([test x$openafs_cv_gcc_supports_wno_error_frame_larger_than = xyes && test x"$CFLAGS_NOERROR" != x],
+        dnl Only use -Wno-error=frame-larger-than= if gcc supports it, and if
+        dnl CFLAGS_NOERROR is nonempty (so if --enable-checking=all is used, we
+        dnl don't pass -Wno-error=frame-larger-than=)
+       [CFLAGS_WNOERROR_FRAME_LARGER_THAN="-Wno-error=frame-larger-than="])
+  AC_SUBST([CFLAGS_WNOERROR_FRAME_LARGER_THAN])
+])
index 8c659c7..b64c993 100644 (file)
@@ -82,7 +82,7 @@ CFLAGS_evp.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto \
               -DHAVE_CONFIG_H
 CFLAGS_evp-algs.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_evp-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
-CFLAGS_rand-fortuna-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto -Wno-error=frame-larger-than=
+CFLAGS_rand-fortuna-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto @CFLAGS_WNOERROR_FRAME_LARGER_THAN@
 CFLAGS_rand-timer-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_rand-kernel.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto
 CFLAGS_aes.o = -I$(TOP_SRCDIR)/external/heimdal/hcrypto