Skip to content

Conversation

guijan
Copy link
Contributor

@guijan guijan commented May 30, 2023

Commit d149e2e migrated us to GNU99 by using #pragma once, GCC and Clang aren't strict C99 compilers even in -std=c99 mode and let this slip. Return to C99.

@N-R-K
Copy link
Collaborator

N-R-K commented May 30, 2023

The webkit style recommends pragma once over header guards. And while in theory header guards are more portable, I don't think I'm aware of a single non-toy compiler that doesn't support it.

@guijan
Copy link
Contributor Author

guijan commented May 30, 2023

cparser and pcc don't support it. Neither does MSVC, but it'll be a while before we build there.

Copy link
Collaborator

@N-R-K N-R-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither does MSVC, but it'll be a while before we build there.

From what I've seen, msvc's C support is laughably lackluster. So I wouldn't want to make any changes based on that.

Wikipedia shows cparser to have full C99 support. So that's a more convincing case. (pcc seems to be dead, last release was 2014).

@guijan
Copy link
Contributor Author

guijan commented May 30, 2023

cproc is on Alpine Edge, we can add it: https://repology.org/project/cproc/versions

PCC is well packaged and gets patched by maintainers (a lot like scrot in the past), I guess Unix enthusiasts will keep it alive: https://repology.org/project/pcc/versions

cparser is not well packaged, but it's on Void Linux: https://repology.org/project/cparser/versions
But then the Void docker image is 2 years old: https://hub.docker.com/u/voidlinux. Might be abandoned? Although the repository with the dockerfiles is maintained? https://github.com/void-linux/void-docker. I don't really understand.

Commit d149e2e migrated us to GNU99 by using `#pragma once`, GCC and Clang aren't strict C99 compilers even in `-std=c99` mode and let this slip. Return to C99.
@guijan
Copy link
Contributor Author

guijan commented May 31, 2023

I found a bug in PCC. It fails to compile this program:

#include <stdio.h> static void printhello(char *[static 1]); int main(void) { char *p = "Hello, world!"; char *hello[] = {p}; printhello(hello); } static void printhello(char *hello[static 1]) { puts(*hello); }

PCC can't handle static inside the [ and ] of a declaration of a function parameter with an array type, but only if the function declaration is not the definition of a function.

Probably won't get fixed, but I reported it to their mailing list anyway. I guess this compiler won't make it to our CI for now.

Edit: PCC actually seems to be active: https://marc.info/?l=pcc-commit-list&r=1&w=2
They haven't put out a release in nearly 10 years...

@N-R-K N-R-K merged commit e413944 into resurrecting-open-source-projects:master May 31, 2023
@guijan
Copy link
Contributor Author

guijan commented Jun 2, 2023

PCC fixed the bug: https://marc.info/?l=pcc-list&m=168560048728554&w=2
Also, it turns out PCC publishes tarballs regularly: http://pcc.ludd.ltu.se/ftp/pub/pcc/
So maybe an OS will update to a recent one with the bugfix in the coming months.

@guijan guijan mentioned this pull request Jun 11, 2023
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants