dragonegg now requires clang

Duncan,
   I am unable to complile dragonegg 3.2 with FSF gcc 4.7 due the the
compiler errors...

GCC=/sw/lib/gcc4.7/bin/gcc-4 LLVM_CONFIG=/sw/opt/llvm-3.2/bin/llvm-config VERBOSE=1 ENABLE_LLVM_PLUGINS=1 make CPPFLAGS="-g -DENABLE_LTO -I/sw/include"
/sw/lib/gcc4.7/bin/gcc-4 --version > /dev/null
/sw/opt/llvm-3.2/bin/llvm-config --version > /dev/null
Compiling utils/TargetInfo.cpp
/sw/lib/gcc4.7/bin/g++-4 -c -DTARGET_TRIPLE=\"x86_64-apple-darwin12.2.0\" \
  -g -DENABLE_LTO -I/sw/include -I/sw/opt/llvm-3.2/include -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 -fno-rtti -MD -MP -DIN_GCC -DLLVM_VERSION=\"3.2svn\" -DGCC_MAJOR=4 -DGCC_MINOR=7 -DGCC_MICRO=2 -I/sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/include -isystem/sw/lib/gcc4.7/lib/gcc/x86_64-apple-darwin12.2.0/4.7.2/plugin/include -Wall -Wextra -DENABLE_LLVM_PLUGINS -I/sw/opt/llvm-3.2/include -fPIC -fvisibility-inlines-hidden -g -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 /sw/src/fink.build/dragonegg-gcc47-3.2-0/dragonegg-3.2/utils/TargetInfo.cpp
g++-4: error: unrecognized command line option '-Wcovered-switch-default'
g++-4: error: unrecognized command line option '-Wcovered-switch-default'
make: *** [TargetInfo.o] Error 1

Have you noticed this issue on linux? It seems to introduce an unwanted compiler dependency for building
dragonegg.
      Jack

Hi Jack, this occurs because you compiled LLVM with clang (right?) and
dragonegg is compiled with the same flags used to compile LLVM (it is
an llvm-config bug in my opinion that llvm-config output includes these
kinds of optional flags).

Ciao, Duncan.

Hi Jack, this occurs because you compiled LLVM with clang (right?) and
dragonegg is compiled with the same flags used to compile LLVM (it is
an llvm-config bug in my opinion that llvm-config output includes these
kinds of optional flags).

Duncan,
   Yes. I believe both fink and MacPorts now default to the clang compiler
on later darwin. The following change to the dragonegg 3.2 Makefile solves
the problem here...

--- dragonegg-3.2/Makefile.orig 2012-12-07 12:50:30.000000000 -0500
+++ dragonegg-3.2/Makefile 2012-12-07 12:51:21.000000000 -0500
@@ -42,8 +42,8 @@
else
COMMON_FLAGS+=-fvisibility=hidden
endif
-CFLAGS+=$(COMMON_FLAGS) $(shell $(LLVM_CONFIG) --cflags)
-CXXFLAGS+=$(COMMON_FLAGS) $(shell $(LLVM_CONFIG) --cxxflags)
+CFLAGS+=$(COMMON_FLAGS) $(shell $(LLVM_CONFIG) --cflags | sed -e 's/-Wcovered-switch-default//')
+CXXFLAGS+=$(COMMON_FLAGS) $(shell $(LLVM_CONFIG) --cxxflags | sed -e 's/-Wcovered-switch-default//')

ifeq ($(shell uname),Darwin)
LOADABLE_MODULE_OPTIONS=-bundle -undefined dynamic_lookup
@@ -76,7 +76,7 @@

ALL_OBJECTS=$(PLUGIN_OBJECTS) $(TARGET_OBJECT) $(TARGET_UTIL_OBJECTS)

-CPP_OPTIONS+=$(CPPFLAGS) $(shell $(LLVM_CONFIG) --cppflags) \
+CPP_OPTIONS+=$(CPPFLAGS) $(shell $(LLVM_CONFIG) --cppflags | sed -e 's/-Wcovered-switch-default//') \
             -fno-rtti \
             -MD -MP \
             -DIN_GCC -DLLVM_VERSION=\"$(LLVM_VERSION)\" \

so that FSF gcc 4.7.2 can be used to build dragonegg again.
         Jack

Hi Jack, can you please open a bug report asking that llvm-config only
provide the minimum set of flags needed to compile code that interfaces
with LLVM, rather than (as now) all kinds of unneeded flags such as -g
and warnings.

Thanks, Duncan.

Hi Jack, can you please open a bug report asking that llvm-config only
provide the minimum set of flags needed to compile code that interfaces
with LLVM, rather than (as now) all kinds of unneeded flags such as -g
and warnings.

Thanks, Duncan.

Duncan,
   I have opened 14539 – llvm-config should only provide minimum set of flags needed to compile code that interfaces with LLVM for this issue.
In the meanwhile, can apply the attached patch for the dragonegg 3.2 release?
Since dragonegg is designed to run under FSF gcc, it seems logical that users
will assume that it can be compiled under the same FSF gcc compiler.
         Jack

pr14539_hack.diff (1 KB)

Hi Jack, I applied it to 3.2.

Ciao, Duncan.