Bug 49862

Summary: Build error due to `-Wcovered-switch-default ` in LLVM_CFLAGS unrecognized by gcc
Product: Mesa Reporter: ojab <ojab>
Component: Mesa coreAssignee: mesa-dev
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: git   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Filter out -Wcovered-switch-default from LLVM_CFLAGS/LLVM_CXXFLAGS
Filter out -Wcovered-switch-default from LLVM_CFLAGS

Description ojab 2012-05-13 03:41:15 UTC
Created attachment 61546 [details]
Filter out -Wcovered-switch-default from LLVM_CFLAGS/LLVM_CXXFLAGS

llvm built by clang has -Wcovered-switch-default in cpplags/cxxflags:

bash-4.2$ llvm-config --cppflags
-I/usr/include    -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -Wcovered-switch-default -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
bash-4.2$ llvm-config --cxxflags
-I/usr/include  -fPIC -fvisibility-inlines-hidden -O3 -DNDEBUG  -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings -pedantic -Wno-long-long -Wcovered-switch-default -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS


which leads to build error in case of mesa build using gcc:

make[3]: Leaving directory `/sources/mesa/src/mesa/x86-64'
gcc -c -o main/api_arrayelt.o main/api_arrayelt.c -DFEATURE_GL=1 -DFEATURE_ES1=1 -DFEATURE_ES2=1 -D_GNU_SOURCE -DPTHREADS -DTEXTURE_FLOAT_ENABLED -DHAVE_POSIX_MEMALIGN -DIN_DRI_DRIVER -DUSE_XCB -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_TLS -DPTHREADS -DUSE_EXTERNAL_DXTN_LIB=1 -DIN_DRI_DRIVER -DHAVE_ALIAS -DHAVE_MINCORE -DHAVE_LIBUDEV -DHAVE_XEXTPROTO_71 -DHAVE_LLVM=0x0302 -I../../include -I../../src/glsl -I../../src/mesa -I../../src/mapi -I../../src/gallium/include -I../../src/gallium/auxiliary -I/usr/include    -D_GNU_SOURCE -Wall -W -Wno-unused-parameter -Wwrite-strings  -Wno-long-long -Wcovered-switch-default -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DUSE_EXTERNAL_DXTN_LIB -g -O2 -Wall -std=c99 -Werror=implicit-function-declaration -Werror=missing-prototypes -fno-strict-aliasing -fno-builtin-memcmp -g -O2 -fPIC -DUSE_X86_64_ASM -fvisibility=hidden
gcc: error: unrecognized command line option ‘-Wcovered-switch-default’


I don't really know how to deal with it, can it be just filtered out like `-pedantic` in LLVM_CFLAGS?
Comment 1 ojab 2012-05-13 04:05:33 UTC
Created attachment 61547 [details] [review]
Filter out -Wcovered-switch-default from LLVM_CFLAGS

Removing from LLVM_CFLAGS is enough to fix the build.
Comment 2 ojab 2012-05-21 00:09:40 UTC
ping?
Comment 3 Jose Fonseca 2012-05-21 00:40:06 UTC
Commited, thanks.

But I don't understand why `llvm-config --cppflags` is passing ordinary non-CPP related flags. This should also be fixed upstream.

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.