
libkate - issue #18
libkate unconditionally uses "-Wall -W" which rarely works with compilers != gcc
What steps will reproduce the problem? 1. Compile e.g. with Sun Studio 12 compiler
What is the expected output? What do you see instead? Clean compilation on Solaris with Sun Studio compiler without patching the source
What version of the product are you using? On what operating system? libkate 0.3.8 and Sun Studio 12 on Solaris 9 Sparc.
Please provide any additional information below. This affects Makefile and tools/Makefile after configuring and the respective autoconf input files.
Comment #1
Posted on Mar 15, 2011 by Massive RabbitIt seems that gcc, while it complains about an option it does not know about, still continues succesfully (provided the rest of the command line makes sense). I need to know if Sun CC do the same: Create a file with just "int main(){return 0;}" in it, say ctest.c, then what does the following line output: cc -qwerty ctest.c ; echo $? This should run on Bourne shell. I'm assuming that Sun CC will not see -qwerty as a valid option - you never know :) Thanks
Comment #2
Posted on Mar 16, 2011 by Happy CamelNope, it does not work:
current9s% /opt/SUNWspro/bin/cc -qwerty ctest.c ; echo $?
cc: illegal option -qwerty
1
current9s% /opt/SUNWspro/bin/cc -Wall ctest.c ; echo $?
cc: illegal option -Wall
1
Best regards -- Dago
Comment #3
Posted on Mar 16, 2011 by Happy CamelBTW, other projects use a check for flags, e.g. http://git.gnome.org/browse/libxml2/tree/configure.in#n872 http://git.gnome.org/browse/libxslt/tree/configure.in#n497
Comment #4
Posted on Mar 16, 2011 by Massive RabbitIt seems fine actually: it returns an error for unknown options. I intended to run tests for compiler options, and omit them if the tests fail. However, the method used in the links you provided seems safer, so I've done that. Since I can't test myself, could you please try this patch ? Thanks.
diff --git a/configure.ac b/configure.ac index bcc253a..8c67a3f 100644 --- a/configure.ac +++ b/configure.ac @@ -172,18 +172,26 @@ then fi AM_CONDITIONAL(HAVE_PNG,test "${HAVE_PNG}" = "yes")
-CWARNFLAGS_LIGHT="-Wall -W" +CWARNFLAGS_LIGHT="" +if test "x$GCC" = "xyes" +then + CWARNFLAGS_LIGHT="$CWARNFLAGS_LIGHT -Wall -W" +fi + CWARNFLAGS_FULL="$CWARNFLAGS_LIGHT"
AC_ARG_ENABLE(more_warnings, [ --enable-more-warnings Enable more warnings (default disabled)]) if test "x$enable_more_warnings" = "xyes" then - CWARNFLAGS_LIGHT="$CWARNFLAGS_LIGHT -Wdeclaration-after-statement -Wcast-qual -Wcast-align" - CWARNFLAGS_LIGHT="$CWARNFLAGS_LIGHT -Winit-self -Wcast-align -pedantic -Wformat=2 -Wunused" - CWARNFLAGS_LIGHT="$CWARNFLAGS_LIGHT -Wstrict-aliasing=2 -Wpointer-arith -Wbad-function-cast -Waggregate-return" + if test "x$GCC" = "xyes" + then + CWARNFLAGS_LIGHT="$CWARNFLAGS_LIGHT -Wdeclaration-after-statement -Wcast-qual -Wcast-align" + CWARNFLAGS_LIGHT="$CWARNFLAGS_LIGHT -Winit-self -Wcast-align -pedantic -Wformat=2 -Wunused" + CWARNFLAGS_LIGHT="$CWARNFLAGS_LIGHT -Wstrict-aliasing=2 -Wpointer-arith -Wbad-function-cast -Waggregate-return"
- CWARNFLAGS_FULL="$CWARNFLAGS_LIGHT"
- CWARNFLAGS_FULL="$CWARNFLAGS_FULL -Wshadow -Wsign-compare -Wredundant-decls -Wmissing-prototypes -Wundef -Wmissing-declarations"
- CWARNFLAGS_FULL="$CWARNFLAGS_LIGHT"
- CWARNFLAGS_FULL="$CWARNFLAGS_FULL -Wshadow -Wsign-compare -Wredundant-decls -Wmissing-prototypes -Wundef -Wmissing-declarations"
fi fi
ifeq ($(SPAMMY_WARNINGS),1)
Comment #5
Posted on Mar 17, 2011 by Happy CamelThe patch seems to work, please apply.
Best regards -- Dago
Comment #6
Posted on Mar 18, 2011 by Massive RabbitPushed, thanks.
Status: Fixed
Labels:
Type-Defect
Priority-Medium