Repository navigation
portability: MinGW, musl Linux, older glibc, and GCC warnings (#62) - #66
Merged
Merged
Conversation
Take the low-risk portability and compiler fixes reported in #62: - Makefile + src/par/par.c: guard MSVC's #pragma comment(lib, "synchronization.lib") under _MSC_VER, link -lsynchronization for MinGW targets via PAR_LIBS, and name the shared library libtoks.dll on Windows. - src/par/par.c: guard pthread_attr_setaffinity_np with __GLIBC__ so musl Linux compiles cleanly. - src/platform/mem.c: define _GNU_SOURCE on Linux for glibc < 2.19 where _DEFAULT_SOURCE was not yet defined. - src/core/spm_c.c: split k7_spm_c_in (static inline always_inline) from the external toks_k7_spm_c wrapper, silencing GCC's -Wattributes warning while keeping strong external linkage on Windows MSVC. - src/core/spm_build.c: size form[16] instead of form[15] so GCC 13 builds the library cleanly under -Werror=array-bounds. Reported-by: Alex Arslan <ararslan@comcast.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the portable, zero-risk fixes from #62 (reported by @ararslan; FreeBSD is intentionally left out since there is no FreeBSD host or CI coverage):
Makefile,src/par/par.c: guard#pragma comment(lib, "synchronization.lib")under_MSC_VER, pass-lsynchronizationon link lines for MinGW targets viaPAR_LIBS, and emitlibtoks.dllwhenOS=windows.src/par/par.c: guardpthread_attr_setaffinity_npwithdefined(__GLIBC__)so musl Linux compiles cleanly.src/platform/mem.c: define_GNU_SOURCEon Linux soMAP_ANONYMOUSandmadviseare exposed on glibc < 2.19 (e.g. manylinux2014).src/core/spm_c.c: factorstatic inline __attribute__((always_inline)) k7_spm_c_inwith an externaltoks_k7_spm_cwrapper so GCC emits no-Wattributeswarning and Windows MSVC still linkstoks_k7_spm_ccleanly (bareinline __attribute__((always_inline))caused LNK2019 intest_k7.exe).src/core/spm_build.c: sizeform[16]so GCC 13 builds the entire library cleanly under-Werror=array-bounds.Receipts:
make -j16 testandTOKS_TIER=scalar make -j16 testboth 0 failures;make -j16 CC=gcc lib+test_k7(4,464,586 checks, 0 fail) +test_par(42,536 checks, 0 fail) with GCC 13.3.0 under-Werror.tools\win\build.cmdFAIL=0,tools\win\test.cmdFAIL=0.make -n TARGET=x86_64-w64-mingw32 libemitslibtoks.dlland passes-lsynchronizationonly at link time.