Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'expected identifier or ( before numeric constant' error for true/false in GCC 11.2.0 #250

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

patrickmn
Copy link

Fixes

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../../include/urweb -I./../../include/urweb -I/usr/include -Wall -Wunused-parameter -Werror -Wno-format-security -Wno-deprecated-declarations -U_FORTIFY_SOURCE -g -O2 -MT urweb.lo -MD -MP -MF .deps/urweb.Tpo -c urweb.c  -fPIC -DPIC -o .libs/urweb.o
In file included from /usr/include/unicode/utf8.h:37,
                 from urweb.c:23:
urweb.c: In function ‘uw_Basis_ensqlBool’:
urweb.c:3122:23: error: expected identifier or ‘(’ before numeric constant
 3122 |   static uw_Basis_int true = 1;
      |                       ^~~~
urweb.c:3123:23: error: expected identifier or ‘(’ before numeric constant
 3123 |   static uw_Basis_int false = 0;
      |                       ^~~~~
urweb.c:3126:20: error: lvalue required as unary ‘&’ operand
 3126 |     return (char *)&false;
      |                    ^
urweb.c:3128:20: error: lvalue required as unary ‘&’ operand
 3128 |     return (char *)&true;
      |                    ^
In file included from /usr/include/unicode/utf8.h:37,
                 from urweb.c:23:
urweb.c: In function ‘uw_Basis_stringToBool’:
urweb.c:3226:24: error: expected identifier or ‘(’ before numeric constant
 3226 |   static uw_Basis_bool true = uw_Basis_True;
      |                        ^~~~
urweb.c:3227:24: error: expected identifier or ‘(’ before numeric constant
 3227 |   static uw_Basis_bool false = uw_Basis_False;
      |                        ^~~~~
urweb.c:3230:12: error: lvalue required as unary ‘&’ operand
 3230 |     return &true;
      |            ^
urweb.c:3232:12: error: lvalue required as unary ‘&’ operand
 3232 |     return &false;
      |            ^
urweb.c: In function ‘uw_Basis_ensqlBool’:
urweb.c:3129:1: error: control reaches end of non-void function [-Werror=return-type]
 3129 | }
      | ^
urweb.c: In function ‘uw_Basis_stringToBool’:
urweb.c:3235:1: error: control reaches end of non-void function [-Werror=return-type]
 3235 | }
      | ^
cc1: all warnings being treated as errors
make[1]: *** [Makefile:535: urweb.lo] Error 1
make[1]: Leaving directory 'urweb/src/c'
make: *** [Makefile:432: all-recursive] Error 1

GCC 11.2.0 on Ubuntu 22.04 LTS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant