Andrew Geissler | 82c905d | 2020-04-13 13:39:40 -0500 | [diff] [blame] | 1 | Detect warning options during configure |
| 2 | |
| 3 | Certain options maybe compiler specific therefore its better |
| 4 | to detect them before use. |
| 5 | |
| 6 | nfs_error copies the format string and appends newline to it |
| 7 | but compiler can forget that it was format string since its not |
| 8 | same fmt string that was passed. Ignore the warning |
| 9 | |
| 10 | Wdiscarded-qualifiers is gcc specific and this is no longer needed |
| 11 | |
| 12 | Upstream-Status: Pending |
| 13 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 14 | |
| 15 | --- a/configure.ac |
| 16 | +++ b/configure.ac |
| 17 | @@ -599,7 +599,6 @@ my_am_cflags="\ |
| 18 | -Werror=parentheses \ |
| 19 | -Werror=aggregate-return \ |
| 20 | -Werror=unused-result \ |
| 21 | - -Wno-cast-function-type \ |
| 22 | -fno-strict-aliasing \ |
| 23 | " |
| 24 | |
| 25 | @@ -619,9 +618,10 @@ CHECK_CCSUPPORT([-Werror=format-overflow |
| 26 | CHECK_CCSUPPORT([-Werror=int-conversion], [flg2]) |
| 27 | CHECK_CCSUPPORT([-Werror=incompatible-pointer-types], [flg3]) |
| 28 | CHECK_CCSUPPORT([-Werror=misleading-indentation], [flg4]) |
| 29 | +CHECK_CCSUPPORT([-Wno-cast-function-type], [flg5]) |
| 30 | AX_GCC_FUNC_ATTRIBUTE([format]) |
| 31 | |
| 32 | -AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4"]) |
| 33 | +AC_SUBST([AM_CFLAGS], ["$my_am_cflags $flg1 $flg2 $flg3 $flg4 $flg5"]) |
| 34 | |
| 35 | # Make sure that $ACLOCAL_FLAGS are used during a rebuild |
| 36 | AC_SUBST([ACLOCAL_AMFLAGS], ["-I $ac_macro_dir \$(ACLOCAL_FLAGS)"]) |
| 37 | --- a/support/nfs/xcommon.c |
| 38 | +++ b/support/nfs/xcommon.c |
| 39 | @@ -98,7 +98,10 @@ nfs_error (const char *fmt, ...) { |
| 40 | |
| 41 | fmt2 = xstrconcat2 (fmt, "\n"); |
| 42 | va_start (args, fmt); |
| 43 | +#pragma GCC diagnostic push |
| 44 | +#pragma GCC diagnostic ignored "-Wformat-nonliteral" |
| 45 | vfprintf (stderr, fmt2, args); |
| 46 | +#pragma GCC diagnostic pop |
| 47 | va_end (args); |
| 48 | free (fmt2); |
| 49 | } |
| 50 | --- a/utils/mount/stropts.c |
| 51 | +++ b/utils/mount/stropts.c |
| 52 | @@ -1094,9 +1094,7 @@ static int nfsmount_fg(struct nfsmount_i |
| 53 | if (nfs_try_mount(mi)) |
| 54 | return EX_SUCCESS; |
| 55 | |
| 56 | -#pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" |
| 57 | if (errno == EBUSY && is_mountpoint(mi->node)) { |
| 58 | -#pragma GCC diagnostic warning "-Wdiscarded-qualifiers" |
| 59 | /* |
| 60 | * EBUSY can happen when mounting a filesystem that |
| 61 | * is already mounted or when the context= are |