`mach static-analysis check-syntax` fails on files in gfx/src
Categories
(Developer Infrastructure :: Developer Environment Integration, defect)
Tracking
(Not tracked)
People
(Reporter: botond, Assigned: andi)
References
Details
(Keywords: in-triage)
Attachments
(2 files, 1 obsolete file)
When ./mach static-analysis check-syntax
is run on gfx/src
, the check fails on every file with an error like this:
clang-9: error: no such file or directory: ''-DMOZ_APP_VERSION="76.0a1"''
The commands look like this:
/usr/bin/ccache /home/botond/.mozbuild/clang/bin/clang++ -fdiagnostics-color -std=gnu++17 -o /dev/null -c -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/system_wrappers -include /home/botond/dev/projects/mozilla/central/config/gcc_hidden.h -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 '-DMOZ_APP_VERSION="76.0a1"' -DOS_POSIX=1 -DOS_LINUX=1 -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/home/botond/dev/projects/mozilla/central/gfx/src -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/gfx/src -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I/home/botond/dev/projects/mozilla/central/ipc/chromium/src -I/home/botond/dev/projects/mozilla/central/ipc/glue -I/home/botond/dev/projects/mozilla/central/dom/ipc -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/nspr -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -pthread -pipe -g -fno-omit-frame-pointer -funwind-tables -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/cairo -I/home/botond/dev/projects/mozilla/central/widget/gtk/compat-gtk3 -pthread -I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -fexperimental-new-pass-manager -ferror-limit=0 /home/botond/dev/projects/mozilla/central/gfx/src/DriverCrashGuard.cpp -fsyntax-only
Note in particular this argument:
'-DMOZ_APP_VERSION="76.0a1"'
I guess the double quotes in the value cause something in the build system to add single quotes around the entire argument, and the compiler then treats it as a positional parameter rather than an option.
Comment 1•5 years ago
|
||
I can't reproduce this. (For reference, the extra quotes are necessary in certain circumstances to get the shell to note freak out about certain special characters.)
Can you provide any more information (the exact steps needed to reproduce, which platform are you running on, etc.?)
Reporter | ||
Comment 2•5 years ago
|
||
I'm on Linux (Debian stable), steps to reproduce are just to run ./mach build
followed by ./mach static-analysis check-syntax gfx/src
.
I don't think there's anything unusual about my configuration, but perhaps the fact that I have ccache
enabled is relevant -- perhaps ccache
is failing to propagate the argument correctly to the actual compiler?
It would be interesting to see an example compile command that is outputted when you run ./mach static-analysis check-syntax gfx/src
, to see how it compares to the command from comment 0.
Comment 3•5 years ago
|
||
Comment 4•5 years ago
|
||
Sylvestre, do we have a person working on static analysis who might be knowledgeable about this mach command that could take a look at it?
Reporter | ||
Comment 6•5 years ago
|
||
The patch from comment 3 breaks ./mach static-analysis check-syntax
command for me, not just in gfx/src, but anywhere. Every translation unit gives an error like the following:
/usr/bin/ccache /home/botond/.mozbuild/clang/bin/clang++ -fdiagnostics-color -std=gnu++17 -o /dev/null -c -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/stl_wrappers -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/system_wrappers -include /home/botond/dev/projects/mozilla/central/config/gcc_hidden.h -fstack-protector-strong -ftrivial-auto-var-init=pattern -DDEBUG=1 -DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -DOS_POSIX=1 -DOS_LINUX=1 -DD3D_DEBUG_INFO -DMOZ_HAS_MOZGLUE -DMOZILLA_INTERNAL_API -DIMPL_LIBXUL -DSTATIC_EXPORTABLE_JS_API -I/home/botond/dev/projects/mozilla/central/gfx/layers -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/gfx/layers -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/ipc/ipdl/_ipdlheaders -I/home/botond/dev/projects/mozilla/central/ipc/chromium/src -I/home/botond/dev/projects/mozilla/central/ipc/glue -I/home/botond/dev/projects/mozilla/central/docshell/base -I/home/botond/dev/projects/mozilla/central/layout/base -I/home/botond/dev/projects/mozilla/central/layout/generic -I/home/botond/dev/projects/mozilla/central/media/libyuv/libyuv/include -I/home/botond/dev/projects/mozilla/central/gfx/skia -I/home/botond/dev/projects/mozilla/central/gfx/skia/skia -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/nspr -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/nss -fPIC -DMOZILLA_CLIENT -include /home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/mozilla-config.h -Qunused-arguments -Qunused-arguments -Wall -Wbitfield-enum-conversion -Wempty-body -Wignored-qualifiers -Woverloaded-virtual -Wpointer-arith -Wshadow-field-in-constructor-modified -Wsign-compare -Wtype-limits -Wunreachable-code -Wunreachable-code-return -Wwrite-strings -Wno-invalid-offsetof -Wclass-varargs -Wempty-init-stmt -Wfloat-overflow-conversion -Wfloat-zero-conversion -Wloop-analysis -Wc++2a-compat -Wcomma -Wimplicit-fallthrough -Wunused-function -Wunused-variable -Wstring-conversion -Wtautological-overlap-compare -Wtautological-unsigned-enum-zero-compare -Wtautological-unsigned-zero-compare -Wno-error=tautological-type-limit-compare -Wno-inline-new-delete -Wno-error=deprecated-declarations -Wno-error=array-bounds -Wno-error=backend-plugin -Wno-error=return-std-move -Wno-error=atomic-alignment -Wformat -Wformat-security -Wno-gnu-zero-variadic-macro-arguments -Wno-unknown-warning-option -fno-sized-deallocation -fno-aligned-new -fno-exceptions -fno-strict-aliasing -fno-rtti -fno-exceptions -fno-math-errno -pthread -pipe -g -fno-omit-frame-pointer -funwind-tables -I/home/botond/dev/projects/mozilla/central/obj-x86_64-pc-linux-gnu/dist/include/cairo -I/home/botond/dev/projects/mozilla/central/widget/gtk/compat-gtk3 -pthread -I/usr/include/gtk-3.0/unix-print -I/usr/include/gtk-3.0 -I/usr/include/at-spi2-atk/2.0 -I/usr/include/at-spi-2.0 -I/usr/include/dbus-1.0 -I/usr/lib/x86_64-linux-gnu/dbus-1.0/include -I/usr/include/gtk-3.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/harfbuzz -I/usr/include/pango-1.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/libpng16 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -Wno-error=shadow -Wno-maybe-uninitialized -fexperimental-new-pass-manager -ferror-limit=0 /home/botond/dev/projects/mozilla/central/gfx/layers/apz/src/AutoscrollAnimation.cpp -fsyntax-only
Usage:
ccache [options]
ccache compiler [compiler options]
compiler [compiler options] (via symbolic link)
Options:
-c, --cleanup delete old files and recalculate size counters
(normally not needed as this is done automatically)
-C, --clear clear the cache completely (except configuration)
-F, --max-files=N set maximum number of files in cache to N (use 0 for
no limit)
-M, --max-size=SIZE set maximum size of cache to SIZE (use 0 for no
limit); available suffixes: k, M, G, T (decimal) and
Ki, Mi, Gi, Ti (binary); default suffix: G
-o, --set-config=K=V set configuration key K to value V
-p, --print-config print current configuration options
-s, --show-stats show statistics summary
-z, --zero-stats zero statistics counters
-h, --help print this help text
-V, --version print version and copyright information
See also <https://ccache.samba.org>.
Assignee | ||
Comment 7•5 years ago
|
||
Assignee | ||
Comment 8•5 years ago
|
||
I think this is an issue on the way how we create the compile_commands.json
we had this with Coverity
also and we did a trick with a regex, please try the attached patch.
:botond I've tried this locally on my mac and it fixes the issues, also it should be fixed on linux
.
Assignee | ||
Updated•5 years ago
|
Reporter | ||
Comment 9•5 years ago
|
||
Andi, I can confirm your patch fixes the issue. Thanks!
Updated•4 years ago
|
Assignee | ||
Comment 10•4 years ago
|
||
Updated•4 years ago
|
Comment 11•4 years ago
|
||
Comment 13•4 years ago
|
||
bugherder |
Updated•2 years ago
|
Description
•