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

portability.h: add an build flag to suppress warnings #481

Merged
merged 1 commit into from
May 23, 2023

Conversation

ttaylorr
Copy link
Contributor

When building CRoaring without support for atomics (for instance, in a pre-C11 environment where <stdatomic.h> is not part of the language specification), we get a compile-time message that copy-on-write bitmaps are unavailable.

Having a warning message is useful as a default behavior, since it can prevent surprises for CRoaring users who expect their bitmaps to be thread-safe, but aren't for whatever reason.

But in environments where we know that <stdatomic.h> is unavailable, or we are single-threaded, the message is noise, since we know ahead of time that CRoaring's bitmaps won't be threadsafe (and are OK with that).

Provide an opt-out build knob (CROARING_SILENT_BUILD) to suppress this warning for applications that wish to do so.

When building CRoaring without support for atomics (for instance, in a
pre-C11 environment where <stdatomic.h> is not part of the language
specification), we get a compile-time message that copy-on-write bitmaps
are unavailable.

Having a warning message is useful as a default behavior, since it can
prevent surprises for CRoaring users who expect their bitmaps to be
thread-safe, but aren't for whatever reason.

But in environments where we know that <stdatomic.h> is unavailable, or
we are single-threaded, the message is noise, since we know ahead of
time that CRoaring's bitmaps won't be threadsafe (and are OK with that).

Provide an opt-out build knob (CROARING_SILENT_BUILD) to suppress this
warning for applications that wish to do so.

Signed-off-by: Taylor Blau <[email protected]>
@lemire
Copy link
Member

lemire commented May 23, 2023

Totally reasonable. Running tests to be sure.

@lemire
Copy link
Member

lemire commented May 23, 2023

Will merge after all tests pass (and they will pass).

@lemire
Copy link
Member

lemire commented May 23, 2023

Merging.

@lemire lemire merged commit c6ebe14 into RoaringBitmap:master May 23, 2023
@ttaylorr ttaylorr deleted the ttaylorr/silent-build-output branch May 23, 2023 02:43
@Dr-Emann
Copy link
Member

As a note, this was already possible by explicitly defining CROARING_ATOMIC_IMPL=CROARING_ATOMIC_IMPL_NONE (with CFLAGS env variable or the CMAKE_C_FLAGS cmake variable)

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