efl: Fixes to support compiling with CFLAGS=-Werror

This allows compiling with gcc 4.7.2 without errors (using the
default configuration).
This commit is contained in:
Henrique Dante de Almeida 2013-01-24 16:57:42 -02:00 committed by Lucas De Marchi
parent cbc203e0bf
commit ca8fc827a3
8 changed files with 67 additions and 26 deletions

View File

@ -51,7 +51,8 @@ m4/eio_check_options.m4 \
m4/evas_check_engine.m4 \ m4/evas_check_engine.m4 \
m4/evas_check_loader.m4 \ m4/evas_check_loader.m4 \
m4/evil_windows.m4 \ m4/evil_windows.m4 \
m4/libgcrypt.m4 m4/libgcrypt.m4 \
m4/gcc_check_builtin.m4
EXTRA_DIST += \ EXTRA_DIST += \
autogen.sh \ autogen.sh \

View File

@ -1534,7 +1534,11 @@ AC_CHECK_TYPES([struct sigaction], [], [],
AC_CHECK_FUNCS([siglongjmp]) AC_CHECK_FUNCS([siglongjmp])
AC_CHECK_LIB([m], [lround], [AC_DEFINE([HAVE_LROUND], [1], [C99 lround function exists])]) AC_CHECK_LIB([m], [lround],
[AC_DEFINE([HAVE_LROUND], [1], [C99 lround function exists])],
[EFL_CHECK_GCC_BUILTIN([lround], [HAVE_LROUND])]
)
if test "x${want_evas_image_loader_generic}" = "xyes" || test "x${want_evas_cserve2}" = "xyes" ; then if test "x${want_evas_image_loader_generic}" = "xyes" || test "x${want_evas_cserve2}" = "xyes" ; then
EFL_ADD_LIBS([EVAS], [${requirements_libs_shm}]) EFL_ADD_LIBS([EVAS], [${requirements_libs_shm}])

20
m4/gcc_check_builtin.m4 Normal file
View File

@ -0,0 +1,20 @@
AC_DEFUN([EFL_CHECK_GCC_BUILTIN],
[efl_check_gcc_builtin_save_libs=$LIBS
LIBS="-lm $LIBS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM(
[[#ifndef __GNUC__
choke me
#else
#undef $1
/* Declare this function with same prototype as __builtin_$1.
This removes warning about conflicting type with builtin */
__typeof__(__builtin_$1) $1;
__typeof__(__builtin_$1) *f = $1;
#endif
]], [[return f != $1;]]
)],
[AC_DEFINE([$2], [123], [GCC builtin $1 exists])])
LIBS=$efl_check_gcc_builtin_save_libs])

View File

@ -3521,18 +3521,18 @@ doif(void)
static void static void
dowhile(void) dowhile(void)
{ {
int wq[wqSIZE]; /* allocate local queue */ int lwq[wqSIZE]; /* allocate local queue */
addwhile(wq); /* add entry to queue for "break" */ addwhile(lwq); /* add entry to queue for "break" */
setlabel(wq[wqLOOP]); /* loop label */ setlabel(lwq[wqLOOP]); /* loop label */
/* The debugger uses the "line" opcode to be able to "break" out of /* The debugger uses the "line" opcode to be able to "break" out of
* a loop. To make sure that each loop has a line opcode, even for the * a loop. To make sure that each loop has a line opcode, even for the
* tiniest loop, set it below the top of the loop */ * tiniest loop, set it below the top of the loop */
setline(fline, fcurrent); setline(fline, fcurrent);
test(wq[wqEXIT], TRUE, FALSE); /* branch to wq[wqEXIT] if false */ test(lwq[wqEXIT], TRUE, FALSE); /* branch to lwq[wqEXIT] if false */
statement(NULL, FALSE); /* if so, do a statement */ statement(NULL, FALSE); /* if so, do a statement */
jumplabel(wq[wqLOOP]); /* and loop to "while" start */ jumplabel(lwq[wqLOOP]); /* and loop to "while" start */
setlabel(wq[wqEXIT]); /* exit label */ setlabel(lwq[wqEXIT]); /* exit label */
delwhile(); /* delete queue entry */ delwhile(); /* delete queue entry */
} }
@ -3543,18 +3543,18 @@ dowhile(void)
static void static void
dodo(void) dodo(void)
{ {
int wq[wqSIZE], top; int lwq[wqSIZE], top;
addwhile(wq); /* see "dowhile" for more info */ addwhile(lwq); /* see "dowhile" for more info */
top = getlabel(); /* make a label first */ top = getlabel(); /* make a label first */
setlabel(top); /* loop label */ setlabel(top); /* loop label */
statement(NULL, FALSE); statement(NULL, FALSE);
needtoken(tWHILE); needtoken(tWHILE);
setlabel(wq[wqLOOP]); /* "continue" always jumps to WQLOOP. */ setlabel(lwq[wqLOOP]); /* "continue" always jumps to WQLOOP. */
setline(fline, fcurrent); setline(fline, fcurrent);
test(wq[wqEXIT], TRUE, FALSE); test(lwq[wqEXIT], TRUE, FALSE);
jumplabel(top); jumplabel(top);
setlabel(wq[wqEXIT]); setlabel(lwq[wqEXIT]);
delwhile(); delwhile();
needtoken(tTERM); needtoken(tTERM);
} }
@ -3562,7 +3562,7 @@ dodo(void)
static void static void
dofor(void) dofor(void)
{ {
int wq[wqSIZE], skiplab; int lwq[wqSIZE], skiplab;
cell save_decl; cell save_decl;
int save_nestlevel, idx; int save_nestlevel, idx;
int *ptr; int *ptr;
@ -3570,7 +3570,7 @@ dofor(void)
save_decl = declared; save_decl = declared;
save_nestlevel = nestlevel; save_nestlevel = nestlevel;
addwhile(wq); addwhile(lwq);
skiplab = getlabel(); skiplab = getlabel();
needtoken('('); needtoken('(');
if (matchtoken(';') == 0) if (matchtoken(';') == 0)
@ -3600,7 +3600,7 @@ dofor(void)
ptr[wqBRK] = (int)declared; ptr[wqBRK] = (int)declared;
ptr[wqCONT] = (int)declared; ptr[wqCONT] = (int)declared;
jumplabel(skiplab); /* skip expression 3 1st time */ jumplabel(skiplab); /* skip expression 3 1st time */
setlabel(wq[wqLOOP]); /* "continue" goes to this label: expr3 */ setlabel(lwq[wqLOOP]); /* "continue" goes to this label: expr3 */
setline(fline, fcurrent); setline(fline, fcurrent);
/* Expressions 2 and 3 are reversed in the generated code: /* Expressions 2 and 3 are reversed in the generated code:
* expression 3 precedes expression 2. * expression 3 precedes expression 2.
@ -3617,7 +3617,7 @@ dofor(void)
setlabel(skiplab); /*jump to this point after 1st expression */ setlabel(skiplab); /*jump to this point after 1st expression */
if (matchtoken(';') == 0) if (matchtoken(';') == 0)
{ {
test(wq[wqEXIT], FALSE, FALSE); /* expression 2 test(lwq[wqEXIT], FALSE, FALSE); /* expression 2
*(jump to wq[wqEXIT] if false) */ *(jump to wq[wqEXIT] if false) */
needtoken(';'); needtoken(';');
} /* if */ } /* if */
@ -3632,8 +3632,8 @@ dofor(void)
stgout(idx); stgout(idx);
stgset(FALSE); /* stop staging */ stgset(FALSE); /* stop staging */
statement(NULL, FALSE); statement(NULL, FALSE);
jumplabel(wq[wqLOOP]); jumplabel(lwq[wqLOOP]);
setlabel(wq[wqEXIT]); setlabel(lwq[wqEXIT]);
delwhile(); delwhile();
assert(nestlevel >= save_nestlevel); assert(nestlevel >= save_nestlevel);

View File

@ -1114,6 +1114,7 @@ void dns_p_dictadd(struct dns_packet *P, unsigned short dn) {
int dns_p_push(struct dns_packet *P, enum dns_section section, const void *dn, size_t dnlen, enum dns_type type, enum dns_class class, unsigned ttl, const void *any) { int dns_p_push(struct dns_packet *P, enum dns_section section, const void *dn, size_t dnlen, enum dns_type type, enum dns_class class, unsigned ttl, const void *any) {
size_t end = P->end; size_t end = P->end;
int error; int error;
uint16_t v;
if ((error = dns_d_push(P, dn, dnlen))) if ((error = dns_d_push(P, dn, dnlen)))
goto error; goto error;
@ -1150,7 +1151,8 @@ update:
if (!P->qd.base && (error = dns_p_study(P))) if (!P->qd.base && (error = dns_p_study(P)))
goto error; goto error;
dns_header(P)->qdcount = htons(ntohs(dns_header(P)->qdcount) + 1); v = ntohs(dns_header(P)->qdcount);
dns_header(P)->qdcount = htons(v + 1);
P->qd.end = P->end; P->qd.end = P->end;
P->an.base = P->end; P->an.base = P->end;
@ -1168,7 +1170,8 @@ update:
if (!P->an.base && (error = dns_p_study(P))) if (!P->an.base && (error = dns_p_study(P)))
goto error; goto error;
dns_header(P)->ancount = htons(ntohs(dns_header(P)->ancount) + 1); v = ntohs(dns_header(P)->ancount);
dns_header(P)->ancount = htons(v + 1);
P->an.end = P->end; P->an.end = P->end;
P->ns.base = P->end; P->ns.base = P->end;
@ -1184,7 +1187,8 @@ update:
if (!P->ns.base && (error = dns_p_study(P))) if (!P->ns.base && (error = dns_p_study(P)))
goto error; goto error;
dns_header(P)->nscount = htons(ntohs(dns_header(P)->nscount) + 1); v = ntohs(dns_header(P)->nscount);
dns_header(P)->nscount = htons(v + 1);
P->ns.end = P->end; P->ns.end = P->end;
P->ar.base = P->end; P->ar.base = P->end;
@ -1195,7 +1199,8 @@ update:
if (!P->ar.base && (error = dns_p_study(P))) if (!P->ar.base && (error = dns_p_study(P)))
goto error; goto error;
dns_header(P)->arcount = htons(ntohs(dns_header(P)->arcount) + 1); v = ntohs(dns_header(P)->arcount);
dns_header(P)->arcount = htons(v + 1);
P->ar.end = P->end; P->ar.end = P->end;
@ -4399,7 +4404,7 @@ int dns_nssconf_loadfile(struct dns_resolv_conf *resconf, FILE *fp) {
dns_anyconf_skip("] \t", fp); dns_anyconf_skip("] \t", fp);
} }
if (endof(lookup) - lp < cf.count + 1) /* +1 for '\0' */ if ((unsigned)(endof(lookup) - lp) < cf.count + 1) /* +1 for '\0' */
goto nextsrc; goto nextsrc;
source = dns_nssconf_keyword(cf.token[0]); source = dns_nssconf_keyword(cf.token[0]);

View File

@ -2170,6 +2170,8 @@ ecore_x_randr_crtc_gamma_size_get(Ecore_X_Randr_Crtc crtc)
#ifdef ECORE_XRANDR #ifdef ECORE_XRANDR
if (_randr_version < RANDR_VERSION_1_2) return 0; if (_randr_version < RANDR_VERSION_1_2) return 0;
return XRRGetCrtcGammaSize(_ecore_x_disp, crtc); return XRRGetCrtcGammaSize(_ecore_x_disp, crtc);
#else
(void)crtc;
#endif #endif
return 0; return 0;
} }
@ -2198,6 +2200,8 @@ ecore_x_randr_crtc_gamma_get(Ecore_X_Randr_Crtc crtc)
XRRFreeGamma(xgamma); XRRFreeGamma(xgamma);
return info; return info;
#else
(void)crtc;
#endif #endif
return NULL; return NULL;
} }
@ -2217,6 +2221,9 @@ ecore_x_randr_crtc_gamma_set(Ecore_X_Randr_Crtc crtc, const Ecore_X_Randr_Crtc_G
*/ */
XRRSetCrtcGamma(_ecore_x_disp, crtc, (XRRCrtcGamma *)gamma); XRRSetCrtcGamma(_ecore_x_disp, crtc, (XRRCrtcGamma *)gamma);
return EINA_TRUE; return EINA_TRUE;
#else
(void)crtc;
(void)gamma;
#endif #endif
return EINA_FALSE; return EINA_FALSE;
} }

View File

@ -23,7 +23,11 @@
#include <X11/keysym.h> #include <X11/keysym.h>
#include <X11/Xutil.h> #include <X11/Xutil.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
#include <scim.h> #include <scim.h>
#pragma GCC diagnostic pop
#include "scim_imcontext.h" #include "scim_imcontext.h"
using namespace scim; using namespace scim;

View File

@ -341,7 +341,7 @@ typedef struct _drm_slp_bo *drm_slp_bo;
static drm_slp_bo (*sym_drm_slp_bo_import) (drm_slp_bufmgr bufmgr, unsigned int key) = NULL; static drm_slp_bo (*sym_drm_slp_bo_import) (drm_slp_bufmgr bufmgr, unsigned int key) = NULL;
// XXXX: sym_drm_slp_bo_map() is incorrectly defined - it SHOULD return a // XXXX: sym_drm_slp_bo_map() is incorrectly defined - it SHOULD return a
// void * at least // void * at least
static unsigned int (*sym_drm_slp_bo_map) (drm_slp_bo bo, int device, int opt) = NULL; static void *(*sym_drm_slp_bo_map) (drm_slp_bo bo, int device, int opt) = NULL;
static int (*sym_drm_slp_bo_unmap) (drm_slp_bo bo, int device) = NULL; static int (*sym_drm_slp_bo_unmap) (drm_slp_bo bo, int device) = NULL;
static void (*sym_drm_slp_bo_unref) (drm_slp_bo bo) = NULL; static void (*sym_drm_slp_bo_unref) (drm_slp_bo bo) = NULL;
static drm_slp_bufmgr (*sym_drm_slp_bufmgr_init) (int fd, void *arg) = NULL; static drm_slp_bufmgr (*sym_drm_slp_bufmgr_init) (int fd, void *arg) = NULL;
@ -755,7 +755,7 @@ evas_xlib_swapper_buffer_map(X_Swapper *swp, int *bpl, int *w, int *h)
} }
// XXXX: sym_drm_slp_bo_map() is incorrectly defined - it SHOULD return a // XXXX: sym_drm_slp_bo_map() is incorrectly defined - it SHOULD return a
// void * at least // void * at least
swp->buf_data = (void *)sym_drm_slp_bo_map(swp->buf_bo, DRM_SLP_DEVICE_CPU, swp->buf_data = sym_drm_slp_bo_map(swp->buf_bo, DRM_SLP_DEVICE_CPU,
DRM_SLP_OPTION_READ | DRM_SLP_OPTION_READ |
DRM_SLP_OPTION_WRITE); DRM_SLP_OPTION_WRITE);
if (!swp->buf_data) if (!swp->buf_data)