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

lib/libspl/zone.c error: ISO C90 forbids mixed declarations and code #3588

Closed
kernelOfTruth opened this issue Jul 11, 2015 · 7 comments
Closed
Assignees

Comments

@kernelOfTruth
Copy link
Contributor

Just got this upon attempting to compile ZFS

seems like the aggressive error flags work after all 👍

../../lib/libspl/zone.c: In function ‘getzonenamebyid’:
../../lib/libspl/zone.c:54:2: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
  ssize_t ret = strlen(GLOBAL_ZONEID_NAME) + 1;
  ^
cc1: all warnings being treated as errors
@kernelOfTruth
Copy link
Contributor Author

There are several more in different files - not sure if it can be even viewed as "error" ...

@kernelOfTruth
Copy link
Contributor Author

kernelOfTruth@7c9bfaf

addressing
error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]

(incomplete)

@behlendorf
Copy link
Contributor

@kernelOfTruth this is a little odd because we do build all of the user space utilities as libraries as C99 so this shouldn't be a warning. Also why did you end up closing this issue?

@kernelOfTruth
Copy link
Contributor Author

@behlendorf sorry, I had thought of it as a false positive due to having messed things up with the toolchain (e.g. KDE and QT on my system turned out to do things in a very weird way in combination with GCC 5.1)

So I quickly closed it (it was pretty late back then - several hours after midnight if I remember correctly) and put the blame on the above mentioned issue and wanted to avoid confusion.

In the end it still could be something to look into

thus re-opening

@kernelOfTruth kernelOfTruth reopened this Jul 13, 2015
@rlaager
Copy link
Member

rlaager commented Oct 1, 2016

If we're building as C99, why is this a problem that needs fixing?

If this is not a problem, then I'd like to close this issue. If it is agreed that this is a problem, I can take a look at this. @kernelOfTruth has a start, and it really should be trivial to fix these.

@rlaager rlaager self-assigned this Oct 1, 2016
@kernelOfTruth
Copy link
Contributor Author

kernelOfTruth commented Oct 1, 2016

@rlaager feel free taking a look at it I'm currently occupied otherwise

I usually enable the following flags when porting patches or doing experiments on the code:

-Wformat-extra-args -Wall -Werror -Werror=format= -Werror=maybe-uninitialized -Wpedantic -Werror=pedantic -Werror=declaration-after-statement

I'm mostly using gcc 4.9.4 hardened right now since a few things do not build with gcc 5.3 or 6.2 yet (also I didn't have time to test out e.g. a full system rebuild with gcc 6.2).

GCC >5 is much more talkative and even pedantic (as stated above), a few of the warnings being false positives ...

Thanks

@behlendorf
Copy link
Contributor

We should just close this. But for the record in user space we can build C99 without issue. However, any code which needs to run in kernel space must be C90. We've explored relaxing this but overriding the kernel build system is problematic and brittle so it's best that we update the code as needed.

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

No branches or pull requests

3 participants