Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

GravisZro
Copy link
Contributor

This PR ensures and enforces C90 conformance for all files C, including tests.

  • Modify CMakeLists.txt to mandate C90 conformance (for better compiler compatibility)
  • Update deps/ntlmclient/utf8.h to the latest version
  • Modify two tests and one header to use C comments instead of C++ comments

This PR ensures and enforces C90 conformance for all files C, including tests.

* Modify CMakeLists.txt to mandate C90 conformance (for better compiler compatibility)
* Update deps/ntlmclient/utf8.h to latest version
* Modify two tests and one header to use C comments instead of C++ comments
@ethomson
Copy link
Member

It's strange that only the MemorySanitizer build has trouble with the // comments in the mbedTLS includes.

@ethomson
Copy link
Member

It's strange that only the MemorySanitizer build has trouble with the // comments in the mbedTLS includes.

It looks like it’s only a problem on one platform, not sure why, but I’m happy to merge this once it’s working across platforms.

@GravisZro
Copy link
Contributor Author

It looks like it’s only a problem on one platform, not sure why, but I’m happy to merge this once it’s working across platforms.

I can't figure out how to replicate the memory sanitizer build locally. Is there a script to replicate the automated CI builds?

@ethomson
Copy link
Member

ethomson commented Apr 3, 2024

Yes — for reproducibility, most of our builds run in containers. For the memory sanitizer build, we use Ubuntu noble, and you can use our pre-built container.

Then you should be able to replicate the build step by setting the appropriate environment variables for the msan build, and running the CI build script.

Something along the lines of:

export CC="clang"
export CFLAGS="-fsanitize=memory -fsanitize-memory-track-origins=2 -fsanitize-blacklist=/home/libgit2/source/script/sanitizers.supp -fno-optimize-sibling-calls -fno-omit-frame-pointer"
export CMAKE_OPTIONS="-DCMAKE_PREFIX_PATH=/usr/local/msan -DUSE_HTTPS=mbedTLS -DUSE_SHA1=HTTPS -DREGEX_BACKEND=pcre -DDEPRECATE_HARD=ON -DUSE_BUNDLED_ZLIB=ON -DUSE_SSH=ON"
export CMAKE_GENERATOR="Ninja"
export SKIP_SSH_TESTS="true"
export SKIP_NEGOTIATE_TESTS="true"
export ASAN_SYMBOLIZER_PATH="/usr/bin/llvm-symbolizer-10"
export UBSAN_OPTIONS="print_stacktrace=1"
/path/to/libgit2/ci/setup-sanitizer-build.sh
/path/to/libgit2/ci/build.sh
/path/to/libgit2/ci/test.sh

@anatol
Copy link
Contributor

anatol commented Jul 3, 2024

Just out of curiosity, what is the reason to enforce the old language standard?

@ethomson
Copy link
Member

ethomson commented Jul 3, 2024

MSVC was woefully inadequate in its C language support. They made some improvements a few years ago, and it might be the case that there's been sufficient traction in new language features and adoption of the new version that we can kick this forward a bit. It would be useful to give a rethink about what we would want in new language features and what the support matrix looks like in 2024.

@ethomson
Copy link
Member

I took this into #6911 and extended it a bit. You can now specify -DC_STANDARD=c90 and -DC_EXTENSIONS=ON to cmake. Thanks!

@ethomson ethomson closed this Oct 18, 2024
@GravisZro
Copy link
Contributor Author

@ethomson Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants