]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
Disable "embedded NUL in string" messages in libopts, when we can.
authorHarlan Stenn <stenn@ntp.org>
Sun, 16 Apr 2023 07:12:16 +0000 (02:12 -0500)
committerHarlan Stenn <stenn@ntp.org>
Sun, 16 Apr 2023 07:12:16 +0000 (02:12 -0500)
bk: 643b9fd0PJrUtVRe-7c-rj7db45kXg

ChangeLog
sntp/libopts/Makefile.am
sntp/m4/ntp_compiler.m4

index d6af397823ae357316b275bbb0cb9ad83621b204..5a6d7836eeb3408a298fe42d9f189b8e7b6b29b7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -75,6 +75,7 @@
              Integrated patch from Brian Utterback. <hart@ntp.org>
 * [Bug 2525] Turn on automake subdir-objects across the project. <hart@ntp.org>
 * [Bug 2410] syslog an error message on panic exceeded. <brian.utterback@oracle.com>
+* Disable "embedded NUL in string" messages in libopts, when we can. <stenn@>
 * Use https in the AC_INIT URLs in configure.ac.  <stenn@ntp.org>
 * Implement NTP_FUNC_REALPATH.  <stenn@ntp.org>
 * Lose a gmake construct in ntpd/Makefile.am.  <stenn@ntp.org>
index 8248ba76aa4c8ae9485f5e326e43812926fbb587..0456b02a1af9868e7fe92406c09fbdd87b5c0811 100644 (file)
@@ -8,6 +8,8 @@ endif
 libopts_la_SOURCES      = libopts.c
 libopts_la_CPPFLAGS     = -I$(srcdir)
 libopts_la_LDFLAGS      = -version-info  42:1:17
+# HMS: we're not currently otherwise using AM_CFLAGS>..
+AM_CFLAGS              = $(CC_NOFORMAT)
 EXTRA_DIST             =
 BUILT_SOURCES          =
 MOSTLYCLEANFILES       =
index ae897e72a08e725bc6049af6977cb7cef99a6cf6..ddce106fe5229e8393dbff5856795a02c439957d 100644 (file)
@@ -12,10 +12,12 @@ AC_REQUIRE([AC_PROG_CC_STDC])
 dnl AC_REQUIRE([AC_PROG_CC_C89])
 dnl AC_REQUIRE([AC_PROG_CC_C99])
 
+CC_NOFORMAT=
 CFLAGS_NTP=
 CPPFLAGS_NTP=
 LDADD_NTP=
 LDFLAGS_NTP=
+AC_SUBST([CC_NOFORMAT])
 AC_SUBST([CFLAGS_NTP])
 AC_SUBST([CPPFLAGS_NTP])
 AC_SUBST([LDADD_NTP])
@@ -75,7 +77,7 @@ AH_VERBATIM(
 case "$GCC" in
  yes)
     SAVED_CFLAGS="$CFLAGS"
-    CFLAGS="$CFLAGS -Wstrict-overflow"
+    CFLAGS="$SAVED_CFLAGS -Wstrict-overflow"
     AC_CACHE_CHECK(
        [if $CC can handle -Wstrict-overflow], 
        [ntp_cv_gcc_Wstrict_overflow], 
@@ -101,6 +103,32 @@ case "$GCC" in
            )
        ]
     )
+    #
+    # libopts specifically builds a string with embedded NULs.
+    # This causes a bunch of distracting warnings due to -Wformat.
+    # Let's see if we can figure out how to disable these.
+    #
+    CFLAGS="$SAVED_CFLAGS -Wno-format"
+    AC_CACHE_CHECK(
+       [if $CC can handle -Wno-format], 
+       [ntp_cv_gcc_Wno_format],
+       [
+           AC_COMPILE_IFELSE(
+               [AC_LANG_PROGRAM([[]], [[]])],
+               [ntp_cv_gcc_Wno_format=yes],
+               [ntp_cv_gcc_Wno_format=no]
+           )
+       ]
+    )
+
+    case "$ntp_cv_gcc_Wno_format" in
+     yes)
+       CC_NOFORMAT="$CC_NOFORMAT -Wno-format"
+       ;;
+     no)
+       ;;
+    esac
+
     CFLAGS="$SAVED_CFLAGS"
     AS_UNSET([SAVED_CFLAGS])
     #