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 building on ancient compilers #32

Merged
merged 2 commits into from
Oct 29, 2021

Conversation

carenas
Copy link
Contributor

@carenas carenas commented Oct 27, 2021

Mainly motivated by the building failures reported in #30.

The default target SDK for Visual Studio 2012 (AKA 11) seems to be Windows 7, which has been EOL already, but the compiler is still supported until beginning of next year, so probably worth fixing.

That version and the previous one (Visual Studio 10 2010) provide a working stdint.h that could be used as a fallback for the inttypes.h that the code requires.

The oldest compiler available in AppVeyor is Visual Studio 2008 (AKA 9) which probably target something even older than doesn't even provide a usable stdint.h, but will build fine with the suggested fallback.

The second patch is obviously not affecting Windows, but would probably trigger warnings in really old and still supported Linux as well that still have a compiler that default to the Gnu89 standard (ex: CentOS 7)

Visual Studio older than 2013, fails to build with JIT enabled,
because it is unable to parse non C89 compatible syntax, with
mixed declarations and code.

While most recent compilers wouldn't even report this as a warning
since it is valid C99, it could be also made visible by adding to
gcc/clang the -Wdeclaration-after-statement flag at build time.

Move the code below the affected definitions.
Since d5a61ee (Patch to detect (and ignore) symlink loops in
pcre2grep., 2021-08-28), code will fail to build in a strict C89
compiler.

Reformat slightly to make it C89 compatible again.
@zherczeg
Copy link
Collaborator

I am ok with the jit changes. @PhilipHazel I would recommend to landing patches with "squash and merge", maybe we could disable the other options in the project settings. Merge commits make things difficult.

@PhilipHazel PhilipHazel merged commit 128c503 into PCRE2Project:master Oct 29, 2021
PhilipHazel added a commit that referenced this pull request Oct 29, 2021
@carenas carenas deleted the declaration-after-statement branch October 29, 2021 15:19
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.

3 participants