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

Build fails on NetBSD 7.1 due to -Werror=char-subscripts #31

Closed
sjmulder opened this issue Jun 5, 2019 · 2 comments
Closed

Build fails on NetBSD 7.1 due to -Werror=char-subscripts #31

sjmulder opened this issue Jun 5, 2019 · 2 comments

Comments

@sjmulder
Copy link
Contributor

sjmulder commented Jun 5, 2019

From a bulk build on NetBSD 7.1, an older but still maintained release of NetBSD, a bunch of errors like these:

src/bcal.c:1165:2: error: array subscript has type 'char' [-Werror=char-subscripts]
  while (*s1 && (tolower(*s1) == tolower(*s2))) {
  ^

Full build output here: http://nyftp.netbsd.org/pub/pkgsrc/packages/reports/2019Q1/NetBSD-7.1-x86_64/20190602.1935/bcal-2.1/build.log

My first impression is that we should

  • remove -Werror from CFLAGS, it makes sense in development but not in the wild where you really can't anticipate what warnings could occur
  • add -Wno-char-subscripts

but I'll look into it more deeply later.

@jarun
Copy link
Owner

jarun commented Jun 5, 2019

where you really can't anticipate what warnings could occur

We don't want to either. We want to catch the issues and fix them. Channels are the standard way to distribute software and so we want to ensure 0-warning code in every channel.

add -Wno-char-subscripts

Does while (*s1 && (tolower((uchar)*s1) == tolower((uchar)*s2))) help?

@sjmulder
Copy link
Contributor Author

sjmulder commented Jun 5, 2019

We don't want to either. We want to catch the issues and fix them. Channels are the standard way to distribute software and so we want to ensure 0-warning code in every channel.

I don't know what channels are in this context, but I just wanted to underline how the combination of -Wall -Wextra and -Werror is a recipe for failure if we can't test on every platform imaginable (including future ones!). But, of course, it's your call.

As for fixing these specific warnings, I'll test when I get 7.1 set up. This was a bulk build by someone else.

sjmulder added a commit to sjmulder/bcal that referenced this issue Jun 13, 2019
For jarun#31. Use (int) because that's the type actually taken by the
character functions (isdigit etc).
@jarun jarun closed this as completed Jun 13, 2019
@github-actions github-actions bot locked and limited conversation to collaborators Jun 15, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants