Eliminate silly warnings
authorNelson Ferreira <nelson.ferreira@ieee.org>
Sat, 12 Dec 2015 20:56:06 +0000 (15:56 -0500)
committerNelson Ferreira <nelson.ferreira@ieee.org>
Sat, 12 Dec 2015 21:16:00 +0000 (16:16 -0500)
* src/ui/TTY/terminfo.c (emacs_tparam): We don't control tparm
prototype where some have const qualifiers others don't. Turning
the warning off is the sensible choice.

* src/ui/glyphs-eimage.c (gif_instantiate): Small cosmetic change.

* src/ui/X11/event-Xt.c (init_event_Xt_late): We don't control the
prototype for XtAppSetTypeConverter where some have const others don't
so turning the warning off is the sensible option...

* src/ui/X11/device-x.c (Fx_get_font_path): Const all around keeps
compilers happy.

* src/events/event-stream.c (asyneq_handle_non_command_event): Use
a void* temporary to sidestep warning.

* src/regex.c (POP_FAILURE_POINT): Don't cast unnecessarily.
(re_match_2_internal): Turn off const cast warning since the code
will always need it one macro expansion or another. Can't win here
without cheating :)

* src/buffer.c (directory_is_current_directory): Cast
to target type, when conversion fails.

Signed-off-by: Nelson Ferreira <nelson.ferreira@ieee.org>
src/buffer.c
src/events/event-stream.c
src/regex.c
src/ui/TTY/terminfo.c
src/ui/X11/device-x.c
src/ui/X11/event-Xt.c
src/ui/glyphs-eimage.c

index 922fa9c..429bb24 100644 (file)
@@ -3046,7 +3046,7 @@ static int directory_is_current_directory(Extbyte * pwd)
                /* Failure for failure, lets try using the external
                   format anyway..
                */
-               pwd_internal=pwd;
+               pwd_internal=(Bufbyte*)pwd;
 
        }
        if( pwd_internal == NULL ) {
index 126d4f3..dc0a68b 100644 (file)
@@ -4878,7 +4878,8 @@ asyneq_handle_non_command_event(event_queue_t eq)
        WITH_DLLIST_TRAVERSE(
                eq_queue(eq),
                if (!command_event_p((Lisp_Object)dllist_item)) {
-                       eqev = (Lisp_Object)dllist_pop_inner(eq_queue(eq), _el);
+                       void *eqev_p=dllist_pop_inner(eq_queue(eq), _el);
+                       eqev = (Lisp_Object)eqev_p;
                        break;
                });
 
index 2f7f8be..61d324c 100644 (file)
@@ -1495,7 +1495,7 @@ typedef struct {
                                          string2, size2);              \
                DEBUG_PRINT1("'\n");                                    \
                                                                        \
-               pat = (unsigned char *) POP_FAILURE_POINTER();          \
+               pat = (const unsigned char*)POP_FAILURE_POINTER();      \
                DEBUG_PRINT2 ("  Popping pattern %p: ", pat);           \
                DEBUG_PRINT_COMPILED_PATTERN(bufp, pat, pend);          \
                                                                        \
@@ -3811,8 +3811,11 @@ int re_compile_fastmap(struct re_pattern_buffer *bufp)
                                /* fuck, p isnt const thanks to that
                                 * unified range table function below */
 #ifdef MULE
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
                                p = (unsigned char*)fail_stack.
                                    stack[--fail_stack.avail].pointer;
+#pragma GCC diagnostic pop
 #else
                                p = fail_stack.stack[--fail_stack.avail]
                                        .pointer;
@@ -6267,9 +6270,16 @@ re_match_2_internal(struct re_pattern_buffer *bufp, re_char * string1,
                if (!FAIL_STACK_EMPTY()) {
                        /* A restart point is known.  Restore to that state.  */
                        DEBUG_PRINT1("\nFAIL:\n");
-                       POP_FAILURE_POINT(d, p, lowest_active_reg,
+                       
+                       const unsigned char* cpat = p;
+                       
+                       POP_FAILURE_POINT(d, cpat, lowest_active_reg,
                                          highest_active_reg, regstart, regend,
                                          reg_info);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
+                       p = (unsigned char*)cpat;
+#pragma GCC diagnostic pop
 
                        /* If this failure point is a dummy, try the next one.  */
                        if (!p)
index ae5a8b8..642bc11 100644 (file)
@@ -86,11 +86,17 @@ char *emacs_tparam(const char *string, char *outstring, int len, int arg1,
                   int arg2, int arg3, int arg4, int arg5, int arg6, int arg7,
                   int arg8, int arg9)
 {
-       char *temp;
        size_t slen = len;
 
-       temp = (char *)tparm((char *)string, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
-                            arg8, arg9);
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
+       char *paramstring = (char *)string;
+       char *temp = (char *)
+               tparm(paramstring, arg1, arg2, arg3, arg4, arg5, arg6, arg7,
+                     arg8, arg9);
+#pragma GCC diagnostic pop
+
+
        if (outstring == 0) {
                slen = strlen(temp)+1;
                outstring = (char *)xmalloc_atomic( slen );
index 47c4211..07a07de 100644 (file)
@@ -1952,8 +1952,8 @@ See also `x-set-font-path'.
 {
        Display *dpy = get_x_display(device);
        int ndirs_return;
-       const char **directories =
-           (const char **)XGetFontPath(dpy, &ndirs_return);
+       const char * const *directories =
+           (const char * const *)XGetFontPath(dpy, &ndirs_return);
        Lisp_Object font_path = Qnil;
 
        if (!directories)
index 486046e..8b41d94 100644 (file)
@@ -3777,10 +3777,13 @@ void init_event_Xt_late(void)
                      (XtPointer) (XtInputReadMask /* | XtInputExceptMask */ ),
                      Xt_what_callback, 0);
 
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wcast-qual"
        XtAppSetTypeConverter(Xt_app_con, XtRString, XtRPixel,
                              EmacsXtCvtStringToPixel,
                              (XtConvertArgList)colorConvertArgs,
                              2, XtCacheByDisplay, EmacsFreePixel);
+#pragma GCC diagnostic pop
 
 #ifdef XIM_XLIB
        XtAppSetTypeConverter(Xt_app_con, XtRString, XtRXimStyles,
index e60c589..ff671fa 100644 (file)
@@ -739,7 +739,7 @@ gif_instantiate(Lisp_Object image_instance, Lisp_Object instantiator,
                                                while (row >= height)
                                                        row =
                                                            InterlacedOffset
-                                                           [++pass];
+                                                                     [++pass];
                                        }
                                eip =
                                    unwind.eimage +