build fails on arm on case label range #3

Closed
opened 4 years ago by Ghost · 2 comments
Ghost commented 4 years ago

I've tested compiling on a x86_64 machine and it works properly, but when I attempt to do it on a armv7h it fails; perhaps it's a difference in default variable size for the two archs?

$ make
gcc -Wall -Werror -pedantic --std=c99 -O2 -D_FORTIFY_SOURCE=2 -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now  hkd.c   -o hkd
hkd.c: In function 'parse_config_file':
hkd.c:745:5: error: case label value is less than minimum value for type [-Werror=switch-outside-range]
745 |     case EOF:
|     ^~~~
cc1: all warnings being treated as errors
make: *** [<builtin>: hkd] Error 1
$ gcc --version
gcc (GCC) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I've tested compiling on a x86_64 machine and it works properly, but when I attempt to do it on a armv7h it fails; perhaps it's a difference in default variable size for the two archs? ``` $ make gcc -Wall -Werror -pedantic --std=c99 -O2 -D_FORTIFY_SOURCE=2 -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now hkd.c -o hkd hkd.c: In function 'parse_config_file': hkd.c:745:5: error: case label value is less than minimum value for type [-Werror=switch-outside-range] 745 | case EOF: | ^~~~ cc1: all warnings being treated as errors make: *** [<builtin>: hkd] Error 1 $ gcc --version gcc (GCC) 10.2.0 Copyright (C) 2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ```
Owner

Hi, sorry for the inactivity, this error is due to EOF being defined as a negative signed int of a value exceeding the minimum value permitted by char on arm (which seems to be unsigned).

I should have fixed the problem with a preprocessor check to enable that case only on x86 architectures, check if it compiles and I will (hopefully) be abled to close this issue.

Again sorry for the long wait

Hi, sorry for the inactivity, this error is due to EOF being defined as a negative signed int of a value exceeding the minimum value permitted by char on arm (which seems to be unsigned). I should have fixed the problem with a preprocessor check to enable that case only on x86 architectures, check if it compiles and I will (hopefully) be abled to close this issue. Again sorry for the long wait
Poster

Hello,
sorry for my own delay in responding.
The preprocessor directive works and it builds ok, moreover, it parses the file ok according to the -d option

Hello, sorry for my own delay in responding. The preprocessor directive works and it builds ok, moreover, it parses the file ok according to the -d option
Ghost closed this issue 4 years ago
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: alema/hkd#3
Loading…
There is no content yet.