emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 2b84c16: Fix compilation warnings in MinGW64 build


From: Eli Zaretskii
Subject: [Emacs-diffs] master 2b84c16: Fix compilation warnings in MinGW64 build using GCC 7
Date: Sat, 9 Sep 2017 11:52:15 -0400 (EDT)

branch: master
commit 2b84c1666274edcb6b810649fa0d6fc09e9e7a66
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Fix compilation warnings in MinGW64 build using GCC 7
    
    Reported by Richard Copley <address@hidden>.
    * src/w32heap.c (init_heap): Declare enable_lfh only for
    mingw.org's MinGW build.
    
    * src/w32console.c (w32con_write_glyphs):
    * src/unexw32.c (get_section_info, COPY_CHUNK, unexec): Fix some
    mismatches of data type vs format spec.
    
    * src/w32fns.c (compute_tip_xy):
    * src/w32proc.c (stop_timer_thread):
    * src/w32notify.c (remove_watch):
    * src/eval.c (internal_lisp_condition_case):
    * src/editfns.c (Ftranslate_region_internal):
    * src/data.c (Fmake_variable_buffer_local, cons_to_unsigned)
    (cons_to_signed):
    * src/buffer.c (fix_overlays_before): Initialize variables to
    avoid compiler warnings.
    
    * lib-src/etags.c (TeX_commands, process_file_name): Initialize
    variables to avoid compilation warnings.
---
 lib-src/etags.c  | 4 ++--
 src/buffer.c     | 2 +-
 src/data.c       | 6 +++---
 src/editfns.c    | 2 +-
 src/eval.c       | 2 +-
 src/unexw32.c    | 8 ++++----
 src/w32console.c | 4 ++--
 src/w32fns.c     | 3 +--
 src/w32heap.c    | 2 ++
 src/w32notify.c  | 2 +-
 src/w32proc.c    | 2 +-
 11 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 5e05c19..724cce6 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1528,7 +1528,7 @@ process_file_name (char *file, language *lang)
   fdesc *fdp;
   compressor *compr;
   char *compressed_name, *uncompressed_name;
-  char *ext, *real_name, *tmp_name;
+  char *ext, *real_name = NULL, *tmp_name;
   int retval;
 
   canonicalize_filename (file);
@@ -5594,7 +5594,7 @@ TeX_commands (FILE *inf)
   linebuffer *key;
 
   char TEX_esc = '\0';
-  char TEX_opgrp, TEX_clgrp;
+  char TEX_opgrp = 0, TEX_clgrp = 0;
 
   /* Initialize token table once from environment. */
   if (TEX_toktab == NULL)
diff --git a/src/buffer.c b/src/buffer.c
index 2d508f3..0827e9b 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3764,7 +3764,7 @@ fix_overlays_before (struct buffer *bp, ptrdiff_t prev, 
ptrdiff_t pos)
   /* If parent is nil, replace overlays_before; otherwise, parent->next.  */
   struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair;
   Lisp_Object tem;
-  ptrdiff_t end;
+  ptrdiff_t end = prev;
 
   /* After the insertion, the several overlays may be in incorrect
      order.  The possibility is that, in the list `overlays_before',
diff --git a/src/data.c b/src/data.c
index 559844b..87010e3 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1823,7 +1823,7 @@ The function `default-value' gets the default value and 
`set-default' sets it.
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
   union Lisp_Val_Fwd valcontents;
-  bool forwarded;
+  bool forwarded = false;
 
   CHECK_SYMBOL (variable);
   sym = XSYMBOL (variable);
@@ -2607,7 +2607,7 @@ uintmax_t
 cons_to_unsigned (Lisp_Object c, uintmax_t max)
 {
   bool valid = false;
-  uintmax_t val;
+  uintmax_t val = max;
   if (INTEGERP (c))
     {
       valid = XINT (c) >= 0;
@@ -2661,7 +2661,7 @@ intmax_t
 cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
 {
   bool valid = false;
-  intmax_t val;
+  intmax_t val = max;
   if (INTEGERP (c))
     {
       val = XINT (c);
diff --git a/src/editfns.c b/src/editfns.c
index d599fcf..95f3554 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3613,7 +3613,7 @@ It returns the number of characters changed.  */)
   for (; pos < end_pos; )
     {
       register unsigned char *p = BYTE_POS_ADDR (pos_byte);
-      unsigned char *str, buf[MAX_MULTIBYTE_LENGTH];
+      unsigned char *str = tt, buf[MAX_MULTIBYTE_LENGTH];
       int len, str_len;
       int oc;
       Lisp_Object val;
diff --git a/src/eval.c b/src/eval.c
index e3e7d8e..c2cd6c6 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1226,7 +1226,7 @@ internal_lisp_condition_case (Lisp_Object var, 
Lisp_Object bodyform,
                              Lisp_Object handlers)
 {
   struct handler *oldhandlerlist = handlerlist;
-  ptrdiff_t clausenb = 0;
+  volatile ptrdiff_t clausenb = 0;
 
   CHECK_SYMBOL (var);
 
diff --git a/src/unexw32.c b/src/unexw32.c
index 904447c..5259b2a 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -357,7 +357,7 @@ get_section_info (file_data *p_infile)
   /* Check the NT header signature ...  */
   if (nt_header->Signature != IMAGE_NT_SIGNATURE)
     {
-      printf ("Invalid IMAGE_NT_SIGNATURE 0x%x in %s...bailing.\n",
+      printf ("Invalid IMAGE_NT_SIGNATURE 0x%lx in %s...bailing.\n",
              nt_header->Signature, p_infile->name);
       exit (1);
     }
@@ -496,7 +496,7 @@ copy_executable_and_dump_data (file_data *p_infile,
        printf ("%s\n", (message));                                             
\
        printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base);   
\
        printf ("\t0x%08x Offset in output file.\n", dst - 
p_outfile->file_base); \
-       printf ("\t0x%08x Size in bytes.\n", count);                            
\
+       printf ("\t0x%08lx Size in bytes.\n", count);                           
\
       }                                                                        
        \
     memcpy (dst, s, count);                                                    
\
     dst += count;                                                              
\
@@ -739,7 +739,7 @@ unexec (const char *new_name, const char *old_name)
   /* Open the undumped executable file.  */
   if (!open_input_file (&in_file, in_filename))
     {
-      printf ("Failed to open %s (%d)...bailing.\n",
+      printf ("Failed to open %s (%lu)...bailing.\n",
              in_filename, GetLastError ());
       exit (1);
     }
@@ -754,7 +754,7 @@ unexec (const char *new_name, const char *old_name)
     extra_bss_size_static;
   if (!open_output_file (&out_file, out_filename, size))
     {
-      printf ("Failed to open %s (%d)...bailing.\n",
+      printf ("Failed to open %s (%lu)...bailing.\n",
              out_filename, GetLastError ());
       exit (1);
     }
diff --git a/src/w32console.c b/src/w32console.c
index 8df6379..a4c089f 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -333,7 +333,7 @@ w32con_write_glyphs (struct frame *f, register struct glyph 
*string,
                                           coding->produced, cursor_coords,
                                           &r))
            {
-             printf ("Failed writing console attributes: %d\n",
+             printf ("Failed writing console attributes: %lu\n",
                      GetLastError ());
              fflush (stdout);
            }
@@ -343,7 +343,7 @@ w32con_write_glyphs (struct frame *f, register struct glyph 
*string,
                                            coding->produced, cursor_coords,
                                            &r))
            {
-             printf ("Failed writing console characters: %d\n",
+             printf ("Failed writing console characters: %lu\n",
                      GetLastError ());
              fflush (stdout);
            }
diff --git a/src/w32fns.c b/src/w32fns.c
index bf3c1d5..60682ae 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -4413,7 +4413,6 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM 
lParam)
          TranslateMessage (&windows_msg);
          goto dflt;
        }
-
       /* Fall through */
 
     case WM_SYSCHAR:
@@ -7171,7 +7170,7 @@ compute_tip_xy (struct frame *f,
                int width, int height, int *root_x, int *root_y)
 {
   Lisp_Object left, top, right, bottom;
-  int min_x = 0, min_y, max_x = 0, max_y;
+  int min_x = 0, min_y = 0, max_x = 0, max_y = 0;
 
   /* User-specified position?  */
   left = Fcdr (Fassq (Qleft, parms));
diff --git a/src/w32heap.c b/src/w32heap.c
index 54de961..cd1324c 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -228,7 +228,9 @@ init_heap (void)
 {
   if (using_dynamic_heap)
     {
+#ifndef MINGW_W64
       unsigned long enable_lfh = 2;
+#endif
 
       /* After dumping, use a new private heap.  We explicitly enable
          the low fragmentation heap (LFH) here, for the sake of pre
diff --git a/src/w32notify.c b/src/w32notify.c
index e8bdef8..7987d9f 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -423,7 +423,7 @@ remove_watch (struct notification *dirwatch)
     {
       int i;
       BOOL status;
-      DWORD exit_code = 0, err;
+      DWORD exit_code = 0, err = 0;
 
       /* Only the thread that issued the outstanding I/O call can call
         CancelIo on it.  (CancelIoEx is available only since Vista.)
diff --git a/src/w32proc.c b/src/w32proc.c
index 085995d..4459ebe 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -485,7 +485,7 @@ stop_timer_thread (int which)
   struct itimer_data *itimer =
     (which == ITIMER_REAL) ? &real_itimer : &prof_itimer;
   int i;
-  DWORD err, exit_code = 255;
+  DWORD err = 0, exit_code = 255;
   BOOL status;
 
   /* Signal the thread that it should terminate.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]