Skip to content

Commit

Permalink
Makefile/configure: add -Wunused-result check
Browse files Browse the repository at this point in the history
  • Loading branch information
perexg committed Jun 23, 2015
1 parent 5fa3343 commit b1909a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ LANGUAGES ?= bg cs de en en_GB fr he hr it pl pt sv
# Common compiler flags
#

CFLAGS += -g -O2 -Wunused-result
CFLAGS += -g -O2
ifeq ($(CONFIG_W_UNUSED_RESULT),yes)
CFLAGS += -Wunused-result
endif
CFLAGS += -Wall -Werror -Wwrite-strings -Wno-deprecated-declarations
CFLAGS += -Wmissing-prototypes
CFLAGS += -fms-extensions -funsigned-char -fno-strict-aliasing
Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ check_cc || die 'No C compiler found'
check_cc_header execinfo
check_cc_option mmx
check_cc_option sse2
check_cc_optionW unused-result

if check_cc '
#if !defined(__clang__)
Expand Down
20 changes: 20 additions & 0 deletions support/configure.inc
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,26 @@ check_cc_option ()
fi
}

# Check compiler option
check_cc_optionW ()
{
local opt=$1
local nam=$2
[ -z "$nam" ] && nam=$opt
nam=$(echo "W_$nam" | sed -e 's/-/_/')

printf "$TAB" "checking for cc -W$opt ..."

# Enable if supported
if check_cc "" -W${opt}; then
echo "ok"
enable $nam
else
echo "fail"
return 1
fi
}

# Check compiler library
check_cc_lib ()
{
Expand Down

0 comments on commit b1909a0

Please sign in to comment.