Bug 108082 - warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
Summary: warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-o...
Alias: None
Product: Mesa
Classification: Unclassified
Component: Other (show other bugs)
Version: git
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Keywords: bisected, regression
Depends on:
Blocks: mesa-18.3
  Show dependency treegraph
Reported: 2018-09-27 03:01 UTC by Vinson Lee
Modified: 2018-10-30 17:35 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

workaround (2.41 KB, patch)
2018-10-01 10:58 UTC, Illia Iorin
Details | Splinter Review

Description Vinson Lee 2018-09-27 03:01:32 UTC
These warning messages are appearing with clang.

warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]

Introduced with this commit.

commit 97ae5a858d2a2da9144ea9793b67b360a3a7c5fa
Author: Eric Engestrom <eric.engestrom@intel.com>
Date:   Fri Sep 21 11:42:38 2018 +0100

    meson+autotools: get rid of spammy GCC warning -Wformat-truncation
    That warning fires every time a string function takes an argument that
    could possibly be longer than its max output, which triggers all over
    the place, especially when working with file paths ("what if every file
    path is MAX_PATH long?" is what GCC is saying, which is really annoying
    when we *know* that "/dev/dri/cardN" is not gonna be 4096 char long and
    it's safe to store it in a 32-char array).
    Anyway, we either add a ton of dead code all over the place to make GCC
    happy, or we get rid of its spam. I chose the latter.
    Signed-off-by: Eric Engestrom <eric.engestrom@intel.com>
    Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Comment 1 Illia Iorin 2018-09-27 11:35:35 UTC
I haven't got this warning at this  commit. I used these meson parameters: 
1. meson -Dbuildtype=debug -Dvalgrind=false -Ddri-drivers=i965 
-Dgallium-drivers= -Dvulkan-drivers= -Dgallium-omx="disabled" 
-Dplatforms=x11,drm,surfaceless -Dtools=intel ./mbuild64/
2. meson -Dbuildtype=realese -Dvalgrind=false -Ddri-drivers=i965 
-Dgallium-drivers= -Dvulkan-drivers= -Dgallium-omx="disabled" 
-Dplatforms=x11,drm,surfaceless -Dtools=intel ./mbuild64/

clang version is 6.0

Could you please provide command line by which you run meson, and your clang version.
Comment 2 Vinson Lee 2018-09-28 03:02:08 UTC
The warnings appear with autotools.

./autogen.sh --disable-egl --with-dri-drivers=swrast --with-gallium-drivers=swrast --with-platforms=x11

$ clang --version
Apple LLVM version 10.0.0 (clang-1000.10.44.2)
Target: x86_64-apple-darwin17.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Comment 3 Illia Iorin 2018-10-01 10:58:23 UTC
Created attachment 141819 [details] [review]

I've got this warning, and another one:
warning: unknown warning option '-Wno-override-init'; did you mean '-Wno-override-module'? [-Wunknown-warning-option]

It looks like  the reason of problem  is "AX_CHECK_COMPILE_FLAG". There is  need ed to report problem to  their bug tracer.  I've wrote workaround for this issue which  hides the problem, until  this problem will be fixed  in autoconf.
Comment 4 Eric Engestrom 2018-10-01 11:55:58 UTC
(In reply to Illia from comment #3)
> I've wrote workaround for
> this issue which  hides the problem, until  this problem will be fixed  in
> autoconf.

You can't have any logic based on the value of $CC (or $CXX), because `gcc` might be a symlink to `clang` (as is the case by default on MacOS for instance, but I've seen it on Linux as well), and users also use it to add compiler flags.

As for the issue, do you guys see the same warning for any other -Wno-foo from our list?
I'm 90% sure this is NOTOURBUG as we're already doing all the checks needed, but I want to figure out if it's clang or autotools going bad.

Vinson, can you also try meson on your system? It would help narrow down the issue.

(I've also checked that there's no typo in the configure.ac check, just in case, and there isn't)
Comment 5 Vinson Lee 2018-10-01 20:21:55 UTC
The warning messages do not appear with meson.
Comment 6 Vinson Lee 2018-10-04 18:48:52 UTC
These warnings also appear with Intel C Compiler.

icc: command line warning #10148: option '-Wno-format-truncation' not supported
Comment 7 Dylan Baker 2018-10-24 16:15:45 UTC
We're not going to track down every ICC unsupported argument warning, ICC is very spammy about unsupported arguments, and getting compiler checks to work with ICC is a huge pain. As long as they're just warnings lets not worry about them.

As an aside, I'm trying to get ICC in shape for meson, and there are lots of annoying "helpful" features in that compiler. Hopeuflly it'll be basically working by meson 0.49.0.
Comment 8 Emil Velikov 2018-10-30 17:35:56 UTC
Should be fixed with

commit 29283921b72fa9386322fc9eb301d00e88b634b6
Author: Emil Velikov <emil.velikov@collabora.com>
Date:   Wed Oct 24 18:53:11 2018 +0100

    m4: add Werror when checking for compiler flags

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.