bugGNU nano - Bugs: bug #53377, in current git, nano violates ISO...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #53377: in current git, nano violates ISO C when comparing functions

Submitted by:  David Lawrence Ramsey <dolorous>
Submitted on:  Sun 18 Mar 2018 06:30:23 PM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  David Lawrence Ramsey <dolorous> Open/Closed:  Closed

Sun 18 Mar 2018 07:05:04 PM UTC, comment #2: 

Thanks for correcting some of those types.  I knew that the type of wanted_to_move() wasn't right, but my compiler didn't complain and it worked...

Applied, and pushed in commit 7b1f3f4f.

Benno Schulenberg <bens>
Project Administrator
Sun 18 Mar 2018 06:31:18 PM UTC, comment #1: 

Patch attached.

(file #43590)

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.
Sun 18 Mar 2018 06:30:23 PM UTC, original submission:  

When building git 9517972 with -pedantic, I get these warnings:

gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT browser.o -MD -MP -MF .deps/browser.Tpo -c -o browser.o browser.c
browser.c: In function ‘do_browser’:
browser.c:307:22: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
   } else if (func == (void *)implant) {
                      ^
browser.c:307:19: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
   } else if (func == (void *)implant) {
                   ^
mv -f .deps/browser.Tpo .deps/browser.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT chars.o -MD -MP -MF .deps/chars.Tpo -c -o chars.o chars.c
mv -f .deps/chars.Tpo .deps/chars.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT color.o -MD -MP -MF .deps/color.Tpo -c -o color.o color.c
mv -f .deps/color.Tpo .deps/color.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT cut.o -MD -MP -MF .deps/cut.Tpo -c -o cut.o cut.c
mv -f .deps/cut.Tpo .deps/cut.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT files.o -MD -MP -MF .deps/files.Tpo -c -o files.o files.c
mv -f .deps/files.Tpo .deps/files.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT global.o -MD -MP -MF .deps/global.Tpo -c -o global.o global.c
mv -f .deps/global.Tpo .deps/global.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT help.o -MD -MP -MF .deps/help.Tpo -c -o help.o help.c
help.c: In function ‘do_help’:
help.c:220:22: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
   } else if (func == (void *)implant) {
                      ^
help.c:220:19: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
   } else if (func == (void *)implant) {
                   ^
mv -f .deps/help.Tpo .deps/help.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT history.o -MD -MP -MF .deps/history.Tpo -c -o history.o history.c
mv -f .deps/history.Tpo .deps/history.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT move.o -MD -MP -MF .deps/move.Tpo -c -o move.o move.c
mv -f .deps/move.Tpo .deps/move.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT nano.o -MD -MP -MF .deps/nano.Tpo -c -o nano.o nano.c
nano.c: In function ‘wanted_to_move’:
nano.c:1627:14: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
  return func == do_left || func == do_right ||
              ^
nano.c:1627:33: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
  return func == do_left || func == do_right ||
                                 ^
nano.c:1628:9: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_up || func == do_down ||
         ^
nano.c:1628:26: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_up || func == do_down ||
                          ^
nano.c:1629:9: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_home || func == do_end ||
         ^
nano.c:1629:28: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_home || func == do_end ||
                            ^
nano.c:1630:9: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_prev_word_void || func == do_next_word_void ||
         ^
nano.c:1630:38: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_prev_word_void || func == do_next_word_void ||
                                      ^
nano.c:1632:9: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_para_begin_void || func == do_para_end_void ||
         ^
nano.c:1632:39: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_para_begin_void || func == do_para_end_void ||
                                       ^
nano.c:1634:9: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_prev_block || func == do_next_block ||
         ^
nano.c:1634:34: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_prev_block || func == do_next_block ||
                                  ^
nano.c:1635:9: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_page_up || func == do_page_down ||
         ^
nano.c:1635:31: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == do_page_up || func == do_page_down ||
                               ^
nano.c:1636:9: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == to_first_line || func == to_last_line;
         ^
nano.c:1636:34: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
    func == to_first_line || func == to_last_line;
                                  ^
nano.c: In function ‘do_input’:
nano.c:1750:25: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
   if (shortcut->func == (void *)implant) {
                         ^
nano.c:1750:22: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
   if (shortcut->func == (void *)implant) {
                      ^
nano.c:1788:25: warning: ISO C forbids passing argument 1 of ‘wanted_to_move’ between function pointer and ‘void *’ [-Wpedantic]
          wanted_to_move(shortcut->func))) {
                         ^
nano.c:1625:6: note: expected ‘void ’ but argument is of type ‘void ( const)(void)’
 bool wanted_to_move(void *func)
      ^
mv -f .deps/nano.Tpo .deps/nano.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT prompt.o -MD -MP -MF .deps/prompt.Tpo -c -o prompt.o prompt.c
prompt.c: In function ‘do_statusbar_input’:
prompt.c:156:30: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
   else if (shortcut->func == (void *)implant)
                              ^
prompt.c:156:27: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
   else if (shortcut->func == (void *)implant)
                           ^
mv -f .deps/prompt.Tpo .deps/prompt.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT rcfile.o -MD -MP -MF .deps/rcfile.Tpo -c -o rcfile.o rcfile.c
rcfile.c: In function ‘parse_binding’:
rcfile.c:416:18: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
    newsc->func = (void *)implant;
                  ^
rcfile.c:416:16: warning: ISO C forbids assignment between function pointer and ‘void *’ [-Wpedantic]
    newsc->func = (void *)implant;
                ^
rcfile.c:452:22: warning: ISO C forbids conversion of function pointer to object pointer type [-Wpedantic]
   if (newsc->func == (void *)implant)
                      ^
rcfile.c:452:19: warning: ISO C forbids comparison of ‘void *’ with function pointer [-Wpedantic]
   if (newsc->func == (void *)implant)
                   ^
mv -f .deps/rcfile.Tpo .deps/rcfile.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT search.o -MD -MP -MF .deps/search.Tpo -c -o search.o search.c
mv -f .deps/search.Tpo .deps/search.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT text.o -MD -MP -MF .deps/text.Tpo -c -o text.o text.c
mv -f .deps/text.Tpo .deps/text.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT utils.o -MD -MP -MF .deps/utils.Tpo -c -o utils.o utils.c
mv -f .deps/utils.Tpo .deps/utils.Po
gcc -DHAVE_CONFIG_H -I. -I..  -DLOCALEDIR=\"/usr/local/share/locale\" -DSYSCONFDIR=\"/usr/local/etc\" -I../lib -I../lib -D_GNU_SOURCE -D_DEFAULT_SOURCE   -g3 -Wall -pedantic -Wall -MT winio.o -MD -MP -MF .deps/winio.Tpo -c -o winio.o winio.c
mv -f .deps/winio.Tpo .deps/winio.Po
gcc  -g3 -Wall -pedantic -Wall   -o nano browser.o chars.o color.o cut.o files.o global.o help.o history.o move.o nano.o prompt.o rcfile.o search.o text.o utils.o winio.o ../lib/libgnu.a   -lz -lmagic  -lncursesw -ltinfo

Functions returning void are not (void )func, but void (func)(void) (which is another manifestation of the same problem fixed in commit 6295cca), and functions in general are not (void *)func, but functionptrtype.  Patch forthcoming.

David Lawrence Ramsey <dolorous>
Project MemberIn charge of this item.

 

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by dolorous (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-30 bens Open/ClosedOpen => Closed
    2018-03-18 bens Severity3 - Normal => 2 - Minor
        StatusNone => Fixed
        Assigned toNone => dolorous
    2018-03-18 dolorous Attached File- => Added 0001-tweaks-correct-parameter-types.patch, #43590

    Back to the top


    Powered by Savane 3.5