fio: move _FORTIFY_SOURCE to only when optimization is turned on
authorDave Jiang <dave.jiang@intel.com>
Thu, 15 Dec 2016 21:51:28 +0000 (14:51 -0700)
committerJens Axboe <axboe@fb.com>
Thu, 15 Dec 2016 21:55:00 +0000 (14:55 -0700)
When compile with debug, without the proper -O flag the compiler complains:
/usr/include/features.h:331:4: warning: #warning _FORTIFY_SOURCE requires
compiling with optimization (-O) [-Wcpp]
#  warning _FORTIFY_SOURCE requires compiling with optimization (-O)
Moving _FORTIFY_SOURCE to optimized compile option.

Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Makefile

index 262ceeaa4ae44d5a2a6f83550ab1ecccf661c06d..d27380bdf5a25f1a98fa810c427f5e88d6a87915 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -20,7 +20,7 @@ all:
 include config-host.mak
 endif
 
 include config-host.mak
 endif
 
-DEBUGFLAGS = -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -DFIO_INC_DEBUG
+DEBUGFLAGS = -DFIO_INC_DEBUG
 CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS)
 OPTFLAGS= -g -ffast-math
 CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS) -I. -I$(SRCDIR)
 CPPFLAGS= -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DFIO_INTERNAL $(DEBUGFLAGS)
 OPTFLAGS= -g -ffast-math
 CFLAGS = -std=gnu99 -Wwrite-strings -Wall -Wdeclaration-after-statement $(OPTFLAGS) $(EXTFLAGS) $(BUILD_CFLAGS) -I. -I$(SRCDIR)
@@ -29,7 +29,7 @@ PROGS = fio
 SCRIPTS = $(addprefix $(SRCDIR)/,tools/fio_generate_plots tools/plot/fio2gnuplot tools/genfio tools/fiologparser.py tools/fio_latency2csv.py tools/hist/fiologparser_hist.py)
 
 ifndef CONFIG_FIO_NO_OPT
 SCRIPTS = $(addprefix $(SRCDIR)/,tools/fio_generate_plots tools/plot/fio2gnuplot tools/genfio tools/fiologparser.py tools/fio_latency2csv.py tools/hist/fiologparser_hist.py)
 
 ifndef CONFIG_FIO_NO_OPT
-  CFLAGS += -O3
+  CFLAGS += -O3 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2
 endif
 
 ifdef CONFIG_GFIO
 endif
 
 ifdef CONFIG_GFIO