Subject: Re: bug#21953: Eliminate warnings in the emacs-25 release branch

From: Juanma Barranquero <[email-masked]>
Date: Thu, 19 Nov 2015 19:34:07 +0100

On Thu, Nov 19, 2015 at 6:54 PM, Eli Zaretskii <[email-masked]> wrote:

> We can stop worrying about warnings in C: there are none, and a few
> people regularly compile with pedantic compiler switches and fix
> whatever they flag.

At least on Windows, that's not entirely true. I compile with very pedantic
switches.

I had to add "-Wno-missing-prototypes -Wno-missing-declarations
-Wno-redundant-decls -Wno-pointer-sign" to my CFLAGS because of the sheer
number of warnings.

Even so, I get 322 cases of *"initialization discards 'const' qualifier
from pointer target type*", and leaving these aside, also this (# of warns,
warning message)

 14 assignment discards 'const' qualifier from pointer target type [enabled
by default]
 14 passing argument 1 of 'w32_getenv' discards 'const' qualifier from
pointer target type [enabled by default]
  5 return discards 'const' qualifier from pointer target type [enabled by
default]
  5 function might be possible candidate for 'ms_printf' format attribute
[-Wsuggest-attribute=format]
  4 pointer of type 'void *' used in arithmetic [-Wpointer-arith]
  3 format '%d' expects argument of type 'int', but argument 3 has type
'printmax_t' [-Wformat=]
  3 passing argument 1 of 'set_user_model' discards 'const' qualifier from
pointer target type [enabled by default]
  2 nested extern declaration of '_execvp' [-Wnested-externs]
  2 passing argument 2 of 'CreateProcessA' discards 'const' qualifier from
pointer target type [enabled by default]
  2 format '%d' expects argument of type 'int', but argument 2 has type
'DWORD' [-Wformat=]
  2 unused variable 'status' [-Wunused-variable]
  2 passing argument 2 of 'otf_features' discards 'const' qualifier from
pointer target type [enabled by default]
  2 ordered comparison of pointer with integer zero [-Wextra]
  2 implicit conversion from 'float' to 'double' when passing argument to
function [-Wdouble-promotion]
  1 unused variable 'terminal' [-Wunused-variable]
  1 'dummy' defined but not used [-Wunused-variable]
  1 macro "g_type_init" is not used [-Wunused-macros]
  1 unused variable 'st' [-Wunused-variable]
  1 macro "NOMINMAX" is not used [-Wunused-macros]
  1 nested extern declaration of 'is_slow_fs' [-Wnested-externs]
  1 function might be candidate for attribute 'noreturn'
[-Wsuggest-attribute=noreturn]
  1 variable 'face' set but not used [-Wunused-but-set-variable]
  1 'timeout' may be used uninitialized in this function
[-Wmaybe-uninitialized]
  1 implicit conversion from 'float' to 'double' to match other operand of
binary expression [-Wdouble-promotion]
  1 macro "x_display_info" is not used [-Wunused-macros]
  1 macro "OFFSET_TO_RVA" is not used [-Wunused-macros]
  1 unused variable 'oldset' [-Wunused-variable]
  1 macro "DATAGRAM_CHAN_P" is not used [-Wunused-macros]
  1 unused variable 'size' [-Wunused-variable]
  1 control reaches end of non-void function [-Wreturn-type]
  1 macro "_ANONYMOUS_UNION" is not used [-Wunused-macros]
  1 unused variable 'address' [-Wunused-variable]
  1 unknown conversion type character 'e' in format [-Wformat=]
  1 unused variable 'dpyinfo' [-Wunused-variable]
  1 nested extern declaration of 'g_b_init_compare_string_w'
[-Wnested-externs]
  1 nested extern declaration of '_resetstkoflw' [-Wnested-externs]
  1 passing argument 1 of 'find_section' discards 'const' qualifier from
pointer target type [enabled by default]
  1 passing argument 1 of 'w32_get_rdb_resource' discards 'const' qualifier
from pointer target type [enabled by default]
  1 unused variable 'n_to_read' [-Wunused-variable]
  1 macro "WTMP_FILE" is not used [-Wunused-macros]
  1 nested extern declaration of 'mainCRTStartup' [-Wnested-externs]
  1 variable 'f' set but not used [-Wunused-but-set-variable]
  1 macro "DefaultDepthOfScreen" is not used [-Wunused-macros]
  1 macro "RVA_TO_PTR" is not used [-Wunused-macros]
  1 macro "gnutls_x509_crt_get_signature" is not used [-Wunused-macros]
  1 variable 'ctty' set but not used [-Wunused-but-set-variable]
  1 nested extern declaration of 'menubar_selection_callback'
[-Wnested-externs]
  1 macro "MAX_ENCODED_BYTES" is not used [-Wunused-macros]