pt icon indicating copy to clipboard operation
pt copied to clipboard

are these warnings expected? can they be fixed?

Open kenyapcomau opened this issue 5 years ago • 0 comments

Modified Makefile to remove -Werror so that warnings would not abort compilation. In particular I don't understand the warning note: here.

gcc version 7.4.1 20190905 [gcc-7-branch revision 275407] on Linux x86_64 platform

$ make -k test
cc -std=gnu99 -Wall -Wextra -std=c99 -pedantic pt_test.c -o pt_test_switch
pt_test.c: In function ‘pt_loop_without_braces’:
pt_test.c:157:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
   if (1)
      ^
In file included from pt_test.c:3:0:
pt_test.c: In function ‘pt_reentrant’:
pt.h:90:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     (pt)->status = (stat);                                                     \
     ~~~~~~~~~~~~~^~~~~~~~
pt_test.c:11:3: note: in expansion of macro ‘pt_label’
   pt_label(pt, 1);
   ^~~~~~~~
pt.h:91:3: note: here
   case __LINE__:;                                                              \
   ^
pt_test.c:11:3: note: in expansion of macro ‘pt_label’
   pt_label(pt, 1);
   ^~~~~~~~
pt.h:90:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     (pt)->status = (stat);                                                     \
     ~~~~~~~~~~~~~^~~~~~~~
pt_test.c:16:3: note: in expansion of macro ‘pt_label’
   pt_label(pt, 2);
   ^~~~~~~~
pt.h:91:3: note: here
   case __LINE__:;                                                              \
   ^
pt_test.c:16:3: note: in expansion of macro ‘pt_label’
   pt_label(pt, 2);
   ^~~~~~~~
pt_test.c: In function ‘pt_wait_ready’:
pt.h:90:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     (pt)->status = (stat);                                                     \
     ~~~~~~~~~~~~~^~~~~~~~
pt.h:105:5: note: in expansion of macro ‘pt_label’
     pt_label(pt, PT_STATUS_BLOCKED);                                           \
     ^~~~~~~~
pt_test.c:67:3: note: in expansion of macro ‘pt_wait’
   pt_wait(pt, ready);
   ^~~~~~~
pt.h:91:3: note: here
   case __LINE__:;                                                              \
   ^
pt.h:105:5: note: in expansion of macro ‘pt_label’
     pt_label(pt, PT_STATUS_BLOCKED);                                           \
     ^~~~~~~~
pt_test.c:67:3: note: in expansion of macro ‘pt_wait’
   pt_wait(pt, ready);
   ^~~~~~~
pt_test.c: In function ‘pt_yielding’:
pt.h:90:18: warning: this statement may fall through [-Wimplicit-fallthrough=]
     (pt)->status = (stat);                                                     \
     ~~~~~~~~~~~~~^~~~~~~~
pt.h:113:5: note: in expansion of macro ‘pt_label’
     pt_label(pt, PT_STATUS_YIELDED);                                           \
     ^~~~~~~~
pt_test.c:93:3: note: in expansion of macro ‘pt_yield’
   pt_yield(pt);
   ^~~~~~~~
pt.h:91:3: note: here
   case __LINE__:;                                                              \
   ^
pt.h:113:5: note: in expansion of macro ‘pt_label’
     pt_label(pt, PT_STATUS_YIELDED);                                           \
     ^~~~~~~~
pt_test.c:93:3: note: in expansion of macro ‘pt_yield’
   pt_yield(pt);
   ^~~~~~~~
cc -std=gnu99 -Wall -Wextra -DPT_USE_GOTO=1 pt_test.c -o pt_test_goto
pt_test.c: In function ‘pt_loop_without_braces’:
pt_test.c:157:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
   if (1)
      ^
cc -std=gnu99 -Wall -Wextra -std=c99 -pedantic -DPT_USE_SETJMP=1 pt_test.c -o pt_test_setjmp
pt_test.c: In function ‘pt_loop_without_braces’:
pt_test.c:157:6: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
   if (1)
      ^
./pt_test_switch
./pt_test_goto
./pt_test_setjmp

kenyapcomau avatar Nov 16 '19 22:11 kenyapcomau