Skip to contentSkip to conversation

MCONFIG: allow developers to override CFLAGS

PATCH New Theodore Ts'o 1 participant 2 messages Sep 21, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 MCONFIG: allow developers to override CFLAGS

Move other C compiler flags to ALL_CFLAGS so that CFLAGS only controls the debugging and optimization flags. This allows a developer to build with "make CFLAGS=-g" in order to compile w/o optimization.

---
 MCONFIG.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
MCONFIG.in +4 -4
index 4751176..29505da 100644
@@ -73,9 +73,9 @@ pkgconfigdir = $(libdir)/pkgconfig
 
 CC = @CC@
 BUILD_CC = @BUILD_CC@
-CFLAGS = @CFLAGS@ @DEFS@ $(LOCAL_CFLAGS)
+CFLAGS = @CFLAGS@
 CPPFLAGS = @INCLUDES@
-ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS)
+ALL_CFLAGS = $(CPPFLAGS) $(CFLAGS) @DEFS@ $(LOCAL_CFLAGS)
 LDFLAGS = @LDFLAGS@
 ALL_LDFLAGS = $(LDFLAGS) @LDFLAG_DYNAMIC@
 LDFLAGS_STATIC = $(LDFLAGS) @LDFLAG_STATIC@
@@ -197,14 +197,14 @@ WFLAGS=		-std=gnu99 -D_XOPEN_SOURCE=600 -D_GNU_SOURCE \
 			-UENABLE_NLS
 
 gcc-wall-new:
-	($(MAKE) CFLAGS="@CFLAGS@ $(WFLAGS)" > /dev/null) 2>&1 | sed -f $(top_srcdir)/util/gcc-wall-cleanup
+	($(MAKE) CFLAGS="$(ALL_CFLAGS) $(WFLAGS)" > /dev/null) 2>&1 | sed -f $(top_srcdir)/util/gcc-wall-cleanup
 
 gcc-wall:
 	$(MAKE) clean > /dev/null
 	$(MAKE) gcc-wall-new
 
 static-check:
-	($(MAKE) C=1 V=1 CFLAGS="@CFLAGS@ $(WFLAGS)") 2>&1 | sed -f $(top_srcdir)/util/static-analysis-cleanup
+	($(MAKE) C=1 V=1 CFLAGS="$(ALL_CFLAGS) $(WFLAGS)") 2>&1 | sed -f $(top_srcdir)/util/static-analysis-cleanup
 
 static-check-all:
 	$(MAKE) clean > /dev/null
Signature · 1 line
2.1.0
#1 lore raw

PATCH 2/2 libext2fs: use ~0UL instead of -1UL to avoid static checker warnings

---
 lib/ext2fs/ext2fs.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/ext2fs/ext2fs.h +2 -2
index d931fff..fef6910 100644
@@ -1712,7 +1712,7 @@ _INLINE_ errcode_t ext2fs_get_memzero(unsigned long size, void *ptr)
 
 _INLINE_ errcode_t ext2fs_get_array(unsigned long count, unsigned long size, void *ptr)
 {
-	if (count && (-1UL)/count<size)
+	if (count && (~0UL)/count < size)
 		return EXT2_ET_NO_MEMORY;
 	return ext2fs_get_mem(count*size, ptr);
 }
@@ -1722,7 +1722,7 @@ _INLINE_ errcode_t ext2fs_get_arrayzero(unsigned long count,
 {
 	void *pp;
 
-	if (count && (-1UL)/count<size)
+	if (count && (~0UL)/count < size)
 		return EXT2_ET_NO_MEMORY;
 	pp = calloc(count, size);
 	if (!pp)
Signature · 1 line
2.1.0