-Wimplicit-function-declaration with C++ warnings

John (Eljay) Love-Jensen eljay@adobe.com
Mon Mar 23 14:08:00 GMT 2009


Hi Dale,

> Due to our existing make setup, I would prefer to not have to make a set
> of flags that is only applicable to C compiles, as that would have a
> cascade effect on our makefiles. Is there a way to have the compiler not
> complain about the flag during C++ compiles, that does not involve
> removing it ?

Alas, no, I don't think so.

Using make -p, I see these builtin productions:

COMPILE.cc = $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
COMPILE.cpp = $(COMPILE.cc)
COMPILE.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c

So it seems to me if you distangle your C, C++ and common C/C++ warning
flags into three separate categories, and add them to make like:

CFLAGS += $(WARN_C) $(WARN_C_CXX)
CXXFLAGS += $(WARN_CXX) $(WARN_C_CXX)

You'd be all set.

HTH,
--Eljay



More information about the Gcc-help mailing list