[Olsr-cvs] olsrd-current gcc-warnings, NONE, 1.1 Makefile, 1.83, 1.84 Makefile.inc, 1.12, 1.13
Bernd Petrovitsch
(spam-protected)
Tue May 1 23:36:52 CEST 2007
Update of /cvsroot/olsrd/olsrd-current
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv13773
Modified Files:
Makefile Makefile.inc
Added Files:
gcc-warnings
Log Message:
Makefile tweaking:
- gcc accepts different warnings on different versions. In an ideal world gcc could
compare numbers to check for versions. Since make doesn't do this, we have now a shell scripts
which kills not understand warnings.
- gather the -W options for CFLAGS in the WARNINGS variable so that we can pass them
to the above script and on sub-makes.
- and pass said WARNINGS variable actually down
- if we have a default CC variable is is not empty, so the "?=" operator doesn't
work that well.
--- NEW FILE: gcc-warnings ---
#!/bin/bash --norc
#
# We expect warning options for gcc as argumenst and return the ones which are accepted
# by the given gcc.
#
# $Id: gcc-warnings,v 1.1 2007/05/01 21:36:50 bernd67 Exp $
set -ue
#set -vx
OPTS=""
for param; do
case "$param" in
-W?*) OPTS="$OPTS $param";;
*) echo "Ignoring $param" >&2
esac
done
while read error; do
case "$error" in
*error:\ unrecognized\ option*) opt="${error#*\`}"
opt="${opt%\'*}"
OPTS="${OPTS//$opt/}"
;;
esac
done < <(cat <<EOF | $CC $OPTS -E - 2>&1 >/dev/null
int main(void) {
return 0;
}
EOF)
echo $OPTS
exit 0
Index: Makefile
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/Makefile,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** Makefile 22 Apr 2007 21:33:33 -0000 1.83
--- Makefile 1 May 2007 21:36:50 -0000 1.84
***************
*** 45,49 ****
CFLAGS += -DVERSION=\"$(VERS)\"
! MAKECMD = $(MAKE) OS=$(OS)
LIBS += $(OS_LIB_DYNLOAD)
--- 45,49 ----
CFLAGS += -DVERSION=\"$(VERS)\"
! MAKECMD = $(MAKE) OS="$(OS)" WARNINGS="$(WARNINGS)"
LIBS += $(OS_LIB_DYNLOAD)
Index: Makefile.inc
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/Makefile.inc,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Makefile.inc 27 Apr 2007 11:45:31 -0000 1.12
--- Makefile.inc 1 May 2007 21:36:50 -0000 1.13
***************
*** 1,5 ****
--- 1,9 ----
# programs
CCACHE ?= $(shell sh -c "type -path ccache")
+ ifeq ($(origin CC),default)
+ CC = $(CCACHE) gcc
+ else
CC ?= $(CCACHE) gcc
+ endif
STRIP ?= strip
BISON ?= bison
***************
*** 19,50 ****
INCLUDES = -Isrc -I$(TOPDIR)/src
- GCC_VERSION := $(shell v=$$($(CC) -dumpversion); echo $${v//./ })
-
# add gcc warnings and optimizations if CFLAGS not set
ifndef CFLAGS
! CFLAGS += -Wall
# gcc-3.3.5 on Debian sarge doesn't know the following warnings
! ifneq ("$(GCC_VERSION)","3 3 5")
! CFLAGS += -Wextra
! CFLAGS += -Wold-style-definition
! CFLAGS += -Wdeclaration-after-statement
endif
! CFLAGS += -Wmissing-prototypes
! CFLAGS += -Wstrict-prototypes
! CFLAGS += -Wmissing-declarations
! CFLAGS += -Wsign-compare
! CFLAGS += -Waggregate-return
! CFLAGS += -Wmissing-noreturn
! CFLAGS += -Wmissing-format-attribute
! CFLAGS += -Wno-multichar
! CFLAGS += -Wno-deprecated-declarations
! #CFLAGS += -Wredundant-decls
! CFLAGS += -Wnested-externs
! #CFLAGS += -Wunreachable-code
! CFLAGS += -Winline
! CFLAGS += -Wdisabled-optimization
CFLAGS += -O2
CFLAGS += -g
- #CFLAGS += -Werror
endif
--- 23,54 ----
INCLUDES = -Isrc -I$(TOPDIR)/src
# add gcc warnings and optimizations if CFLAGS not set
ifndef CFLAGS
! ifndef WARNINGS
! WARNINGS += -Wall
# gcc-3.3.5 on Debian sarge doesn't know the following warnings
! WARNINGS += -Wextra
! WARNINGS += -Wold-style-definition
! WARNINGS += -Wdeclaration-after-statement
! WARNINGS += -Wmissing-prototypes
! WARNINGS += -Wstrict-prototypes
! WARNINGS += -Wmissing-declarations
! WARNINGS += -Wsign-compare
! WARNINGS += -Waggregate-return
! WARNINGS += -Wmissing-noreturn
! WARNINGS += -Wmissing-format-attribute
! WARNINGS += -Wno-multichar
! WARNINGS += -Wno-deprecated-declarations
! #WARNINGS += -Wredundant-decls
! WARNINGS += -Wnested-externs
! #WARNINGS += -Wunreachable-code
! WARNINGS += -Winline
! WARNINGS += -Wdisabled-optimization
! WARNINGS += -Werror
! WARNINGS := $(shell CC="$(CC)" $(TOPDIR)/gcc-warnings $(WARNINGS))
endif
! CFLAGS += $(WARNINGS)
CFLAGS += -O2
CFLAGS += -g
endif
More information about the Olsr-cvs
mailing list