From ca8fc827a380c3525793dbaae7cdc7f8901bf0b6 Mon Sep 17 00:00:00 2001 From: Henrique Dante de Almeida Date: Thu, 24 Jan 2013 16:57:42 -0200 Subject: [PATCH] efl: Fixes to support compiling with CFLAGS=-Werror This allows compiling with gcc 4.7.2 without errors (using the default configuration). --- Makefile.am | 3 +- configure.ac | 6 +++- m4/gcc_check_builtin.m4 | 20 +++++++++++ src/bin/embryo/embryo_cc_sc1.c | 34 +++++++++---------- src/lib/ecore_con/dns.c | 15 +++++--- src/lib/ecore_x/xlib/ecore_x_randr.c | 7 ++++ src/modules/ecore_imf/scim/scim_imcontext.cpp | 4 +++ .../engines/software_x11/evas_xlib_swapper.c | 4 +-- 8 files changed, 67 insertions(+), 26 deletions(-) create mode 100644 m4/gcc_check_builtin.m4 diff --git a/Makefile.am b/Makefile.am index 4a6d8eb075..aadfb3283b 100644 --- a/Makefile.am +++ b/Makefile.am @@ -51,7 +51,8 @@ m4/eio_check_options.m4 \ m4/evas_check_engine.m4 \ m4/evas_check_loader.m4 \ m4/evil_windows.m4 \ -m4/libgcrypt.m4 +m4/libgcrypt.m4 \ +m4/gcc_check_builtin.m4 EXTRA_DIST += \ autogen.sh \ diff --git a/configure.ac b/configure.ac index 29301b88c9..e1c90cda9e 100644 --- a/configure.ac +++ b/configure.ac @@ -1534,7 +1534,11 @@ AC_CHECK_TYPES([struct sigaction], [], [], 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 EFL_ADD_LIBS([EVAS], [${requirements_libs_shm}]) diff --git a/m4/gcc_check_builtin.m4 b/m4/gcc_check_builtin.m4 new file mode 100644 index 0000000000..1434c5f80a --- /dev/null +++ b/m4/gcc_check_builtin.m4 @@ -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]) + diff --git a/src/bin/embryo/embryo_cc_sc1.c b/src/bin/embryo/embryo_cc_sc1.c index 58b4b3cc3f..9fd75092a4 100644 --- a/src/bin/embryo/embryo_cc_sc1.c +++ b/src/bin/embryo/embryo_cc_sc1.c @@ -3521,18 +3521,18 @@ doif(void) static void dowhile(void) { - int wq[wqSIZE]; /* allocate local queue */ + int lwq[wqSIZE]; /* allocate local queue */ - addwhile(wq); /* add entry to queue for "break" */ - setlabel(wq[wqLOOP]); /* loop label */ + addwhile(lwq); /* add entry to queue for "break" */ + setlabel(lwq[wqLOOP]); /* loop label */ /* 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 * tiniest loop, set it below the top of the loop */ 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 */ - jumplabel(wq[wqLOOP]); /* and loop to "while" start */ - setlabel(wq[wqEXIT]); /* exit label */ + jumplabel(lwq[wqLOOP]); /* and loop to "while" start */ + setlabel(lwq[wqEXIT]); /* exit label */ delwhile(); /* delete queue entry */ } @@ -3543,18 +3543,18 @@ dowhile(void) static 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 */ setlabel(top); /* loop label */ statement(NULL, FALSE); needtoken(tWHILE); - setlabel(wq[wqLOOP]); /* "continue" always jumps to WQLOOP. */ + setlabel(lwq[wqLOOP]); /* "continue" always jumps to WQLOOP. */ setline(fline, fcurrent); - test(wq[wqEXIT], TRUE, FALSE); + test(lwq[wqEXIT], TRUE, FALSE); jumplabel(top); - setlabel(wq[wqEXIT]); + setlabel(lwq[wqEXIT]); delwhile(); needtoken(tTERM); } @@ -3562,7 +3562,7 @@ dodo(void) static void dofor(void) { - int wq[wqSIZE], skiplab; + int lwq[wqSIZE], skiplab; cell save_decl; int save_nestlevel, idx; int *ptr; @@ -3570,7 +3570,7 @@ dofor(void) save_decl = declared; save_nestlevel = nestlevel; - addwhile(wq); + addwhile(lwq); skiplab = getlabel(); needtoken('('); if (matchtoken(';') == 0) @@ -3600,7 +3600,7 @@ dofor(void) ptr[wqBRK] = (int)declared; ptr[wqCONT] = (int)declared; 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); /* Expressions 2 and 3 are reversed in the generated code: * expression 3 precedes expression 2. @@ -3617,7 +3617,7 @@ dofor(void) setlabel(skiplab); /*jump to this point after 1st expression */ if (matchtoken(';') == 0) { - test(wq[wqEXIT], FALSE, FALSE); /* expression 2 + test(lwq[wqEXIT], FALSE, FALSE); /* expression 2 *(jump to wq[wqEXIT] if false) */ needtoken(';'); } /* if */ @@ -3632,8 +3632,8 @@ dofor(void) stgout(idx); stgset(FALSE); /* stop staging */ statement(NULL, FALSE); - jumplabel(wq[wqLOOP]); - setlabel(wq[wqEXIT]); + jumplabel(lwq[wqLOOP]); + setlabel(lwq[wqEXIT]); delwhile(); assert(nestlevel >= save_nestlevel); diff --git a/src/lib/ecore_con/dns.c b/src/lib/ecore_con/dns.c index 15d9bb0baf..87ecbffc7b 100644 --- a/src/lib/ecore_con/dns.c +++ b/src/lib/ecore_con/dns.c @@ -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) { size_t end = P->end; int error; + uint16_t v; if ((error = dns_d_push(P, dn, dnlen))) goto error; @@ -1150,7 +1151,8 @@ update: if (!P->qd.base && (error = dns_p_study(P))) 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->an.base = P->end; @@ -1168,7 +1170,8 @@ update: if (!P->an.base && (error = dns_p_study(P))) 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->ns.base = P->end; @@ -1184,7 +1187,8 @@ update: if (!P->ns.base && (error = dns_p_study(P))) 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->ar.base = P->end; @@ -1195,7 +1199,8 @@ update: if (!P->ar.base && (error = dns_p_study(P))) 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; @@ -4399,7 +4404,7 @@ int dns_nssconf_loadfile(struct dns_resolv_conf *resconf, FILE *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; source = dns_nssconf_keyword(cf.token[0]); diff --git a/src/lib/ecore_x/xlib/ecore_x_randr.c b/src/lib/ecore_x/xlib/ecore_x_randr.c index bda1c9e428..22b7e1cbd1 100644 --- a/src/lib/ecore_x/xlib/ecore_x_randr.c +++ b/src/lib/ecore_x/xlib/ecore_x_randr.c @@ -2170,6 +2170,8 @@ ecore_x_randr_crtc_gamma_size_get(Ecore_X_Randr_Crtc crtc) #ifdef ECORE_XRANDR if (_randr_version < RANDR_VERSION_1_2) return 0; return XRRGetCrtcGammaSize(_ecore_x_disp, crtc); +#else + (void)crtc; #endif return 0; } @@ -2198,6 +2200,8 @@ ecore_x_randr_crtc_gamma_get(Ecore_X_Randr_Crtc crtc) XRRFreeGamma(xgamma); return info; +#else + (void)crtc; #endif 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); return EINA_TRUE; +#else + (void)crtc; + (void)gamma; #endif return EINA_FALSE; } diff --git a/src/modules/ecore_imf/scim/scim_imcontext.cpp b/src/modules/ecore_imf/scim/scim_imcontext.cpp index 5cd96e52d0..43392bb5b6 100644 --- a/src/modules/ecore_imf/scim/scim_imcontext.cpp +++ b/src/modules/ecore_imf/scim/scim_imcontext.cpp @@ -23,7 +23,11 @@ #include #include +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" #include +#pragma GCC diagnostic pop + #include "scim_imcontext.h" using namespace scim; diff --git a/src/modules/evas/engines/software_x11/evas_xlib_swapper.c b/src/modules/evas/engines/software_x11/evas_xlib_swapper.c index 47468c9485..b3f19e9008 100644 --- a/src/modules/evas/engines/software_x11/evas_xlib_swapper.c +++ b/src/modules/evas/engines/software_x11/evas_xlib_swapper.c @@ -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; // XXXX: sym_drm_slp_bo_map() is incorrectly defined - it SHOULD return a // 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 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; @@ -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 // 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_WRITE); if (!swp->buf_data)