summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-12-07 15:46:13 -0800
committerKeith Packard <keithp@keithp.com>2015-12-08 20:36:38 -0800
commiteb67d10ae82b364a4324e96ce53baaa4e5e75f97 (patch)
treef02278d58e2326e35dcdc5640ea6f44f02eda909
parentd6877a7c1c35985f6a75b6cd4e814595e781adc4 (diff)
Add compiler warning flags and fix warnings
Mostly signed vs unsigned comparisons Signed-off-by: Keith Packard <keithp@keithp.com>
-rw-r--r--configure.ac24
-rw-r--r--src/FreeType/ftfuncs.c12
-rw-r--r--src/bitmap/bdfread.c4
-rw-r--r--src/bitmap/pcfread.c1
-rw-r--r--src/fc/fstrans.c2
5 files changed, 34 insertions, 9 deletions
diff --git a/configure.ac b/configure.ac
index 640cc92..dddef8a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,7 @@ AC_INIT([libXfont], [1.5.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libXfont])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h include/X11/fonts/fontconf.h])
+AC_CONFIG_MACRO_DIR([m4])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2])
@@ -57,6 +58,27 @@ AC_CHECK_FUNCS([poll readlink])
# must first be located explicitly.
PKG_PROG_PKG_CONFIG
+with_cflags=""
+if test "x$GCC" = "xyes"; then
+ CC_CHECK_FLAGS_APPEND([with_cflags], [CFLAGS], [\
+ -Wall \
+ -Wextra \
+ -Wno-sign-compare \
+ -Wno-missing-field-initializers \
+ -Wno-unused-parameter \
+ -Wstrict-prototypes \
+ -Wmissing-prototypes \
+ -fvisibility=hidden \
+ -pipe \
+ -fno-strict-aliasing \
+ -ffunction-sections \
+ -fdata-sections \
+ -fno-strict-aliasing \
+ -fdiagnostics-show-option \
+ -fno-common])
+fi
+AC_SUBST([GCC_CFLAGS], $with_cflags)
+
#
# select libraries to include
#
@@ -217,6 +239,8 @@ case $host_os in
OS_CFLAGS=
;;
esac
+OS_CFLAGS="$OS_CFLAGS $GCC_CFLAGS"
+
AC_SUBST([OS_CFLAGS])
AC_CONFIG_FILES([Makefile
diff --git a/src/FreeType/ftfuncs.c b/src/FreeType/ftfuncs.c
index c440fde..df64f5e 100644
--- a/src/FreeType/ftfuncs.c
+++ b/src/FreeType/ftfuncs.c
@@ -474,7 +474,7 @@ FreeTypeOpenInstance(FTInstancePtr *instance_return, FTFacePtr face,
if( FT_IS_SFNT( face->face ) ) {
#if 1
FT_F26Dot6 tt_char_width, tt_char_height, tt_dim_x, tt_dim_y;
- FT_UInt nn;
+ FT_Int nn;
instance->strike_index=0xFFFFU;
@@ -1454,7 +1454,7 @@ FreeTypeRasteriseGlyph(unsigned idx, int flags, CharInfoPtr tgp,
}
for( i = MAX(0, dy) ; i<ht ; i++ ){
int prev_jj,jj;
- if( bitmap->rows <= i-dy ) break;
+ if( bitmap->rows <= (unsigned) (i-dy) ) break;
current_buffer=(unsigned char *)(bitmap->buffer+bitmap->pitch*(i-dy));
current_raster=(unsigned char *)(raster+i*bpr);
j = MAX(0,div_dx);
@@ -2985,13 +2985,13 @@ ft_compute_bounds(FTFontPtr font, FontInfoPtr pinfo, FontScalablePtr vals )
c = row<<8|col;
flags=0;
if ( !force_c_outside ) {
- if ( c <= instance->ttcap.forceConstantSpacingEnd
- && instance->ttcap.forceConstantSpacingBegin <= c )
+ if ( (signed) c <= instance->ttcap.forceConstantSpacingEnd
+ && instance->ttcap.forceConstantSpacingBegin <= (signed) c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
else { /* for GB18030 proportional */
- if ( c <= instance->ttcap.forceConstantSpacingEnd
- || instance->ttcap.forceConstantSpacingBegin <= c )
+ if ( (signed) c <= instance->ttcap.forceConstantSpacingEnd
+ || instance->ttcap.forceConstantSpacingBegin <= (signed) c )
flags|=FT_FORCE_CONSTANT_SPACING;
}
#if 0
diff --git a/src/bitmap/bdfread.c b/src/bitmap/bdfread.c
index eccd7b7..f343eed 100644
--- a/src/bitmap/bdfread.c
+++ b/src/bitmap/bdfread.c
@@ -298,7 +298,7 @@ bdfReadCharacters(FontFilePtr file, FontPtr pFont, bdfFileState *pState,
bdfError("invalid number of CHARS in BDF file\n");
return (FALSE);
}
- if (nchars > INT32_MAX / sizeof(CharInfoRec)) {
+ if (nchars > (signed) (INT32_MAX / sizeof(CharInfoRec))) {
bdfError("Couldn't allocate pCI (%d*%d)\n", nchars,
(int) sizeof(CharInfoRec));
goto BAILOUT;
@@ -631,7 +631,7 @@ bdfReadProperties(FontFilePtr file, FontPtr pFont, bdfFileState *pState)
}
if ((sscanf((char *) line, "STARTPROPERTIES %d", &nProps) != 1) ||
(nProps <= 0) ||
- (nProps > ((INT32_MAX / sizeof(FontPropRec)) - BDF_GENPROPS))) {
+ (nProps > (signed) ((INT32_MAX / sizeof(FontPropRec)) - BDF_GENPROPS))) {
bdfError("bad 'STARTPROPERTIES'\n");
return (FALSE);
}
diff --git a/src/bitmap/pcfread.c b/src/bitmap/pcfread.c
index 34eeeb7..33871ae 100644
--- a/src/bitmap/pcfread.c
+++ b/src/bitmap/pcfread.c
@@ -487,7 +487,6 @@ pcfReadFont(FontPtr pFont, FontFilePtr file,
for (i = 0; i < GLYPHPADOPTIONS; i++) {
bitmapSizes[i] = pcfGetINT32(file, format);
if (IS_EOF(file)) goto Bail;
- if (bitmapSizes[i] < 0) goto Bail;
}
sizebitmaps = bitmapSizes[PCF_GLYPH_PAD_INDEX(format)];
diff --git a/src/fc/fstrans.c b/src/fc/fstrans.c
index 24fceee..9b21864 100644
--- a/src/fc/fstrans.c
+++ b/src/fc/fstrans.c
@@ -26,3 +26,5 @@
#define FONT_t
#define TRANS_CLIENT
#include <X11/Xtrans/transport.c>
+/* inhibit warning about is_numeric */
+static inline void foo(void) { (void) is_numeric("a"); }