Commit eb67d10a authored by Keith Packard's avatar Keith Packard

Add compiler warning flags and fix warnings

Mostly signed vs unsigned comparisons
Signed-off-by: Keith Packard's avatarKeith Packard <keithp@keithp.com>
parent d6877a7c
......@@ -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
......
......@@ -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
......
......@@ -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);
}
......
......@@ -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)];
......
......@@ -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"); }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment