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

Macro conflict in fuzztest/regexp.cc on NO_THREAD_SAFETY_ANALYSIS #41

Closed
markww opened this issue Sep 30, 2022 · 2 comments
Closed

Macro conflict in fuzztest/regexp.cc on NO_THREAD_SAFETY_ANALYSIS #41

markww opened this issue Sep 30, 2022 · 2 comments
Assignees

Comments

@markww
Copy link

markww commented Sep 30, 2022

While attempting to build fuzztest, I encountered the following (warning, upgraded to) error:

'NO_THREAD_SAFETY_ANALYSIS' macro redefined [-Werror,-Wmacro-redefined]
#define NO_THREAD_SAFETY_ANALYSIS \
         ^
external/com_googlesource_code_re2/util/util.h:39:9: note: previous definition is here
#define NO_THREAD_SAFETY_ANALYSIS
         ^
 1 error generated.

It looks like re2 and absl both enable a macro called NO_THREAD_SAFETY_ANALYSIS with different definitions. re2 is doing it with a #ifndef guard, while absl is unconditionally dropping it in.

It looks like this could possibly be solved by just making the re2 headers be included before the absl headers, though that would be a non-standard include order. The real fix may be to ask one or both of the upstream repos to change the name of their macro or at least #undef it when they're done with it. Alternatively, (though this would be ugly) they could be explicitly #undefed between the inclusions in this file.

markww pushed a commit to google-research/raksha that referenced this issue Sep 30, 2022
Currently, the fuzztest library has an issue where two macros with
colliding names are leaked from the headers of `absl` and `re2` into one
of fuzztest's `.cc` files
( google/fuzztest#41 ). Once this issue is
fixed, we should re-enable this warning.
markww pushed a commit to google-research/raksha that referenced this issue Sep 30, 2022
Currently, the fuzztest library has an issue where two macros with
colliding names are leaked from the headers of `absl` and `re2` into one
of fuzztest's `.cc` files
( google/fuzztest#41 ). Once this issue is
fixed, we should re-enable this warning.
markww pushed a commit to google-research/raksha that referenced this issue Sep 30, 2022
Currently, the fuzztest library has an issue where two macros with
colliding names are leaked from the headers of `absl` and `re2` into one
of fuzztest's `.cc` files
( google/fuzztest#41 ). Once this issue is
fixed, we should re-enable this warning.
@lszekeres lszekeres self-assigned this Oct 2, 2022
copybara-service bot pushed a commit to abseil/abseil-cpp that referenced this issue Oct 3, 2022
by default.

The compatibility macro `ABSL_LEGACY_THREAD_ANNOTATIONS` can be
defined on the compile command-line to temporarily restore these
spellings. All of the thread annotation macros are available under
ABSL_ prefixed spellings in `absl/base/thread_annotations.h`. The
compatibility macro and the legacy spellings will be removed in the
future.

See google/fuzztest#41

PiperOrigin-RevId: 478498273
Change-Id: I120ad6480d031642bf95a11bf72ab883d9161810
@fniksic
Copy link
Collaborator

fniksic commented Oct 3, 2022

Hi Mark. Did the Abseil commit 6acb60c fix the issue for you?

copybara-service bot pushed a commit that referenced this issue Oct 3, 2022
PiperOrigin-RevId: 478523114
copybara-service bot pushed a commit that referenced this issue Oct 3, 2022
PiperOrigin-RevId: 478523114
copybara-service bot pushed a commit that referenced this issue Oct 3, 2022
PiperOrigin-RevId: 478523114
copybara-service bot pushed a commit that referenced this issue Oct 3, 2022
PiperOrigin-RevId: 478523114
copybara-service bot pushed a commit that referenced this issue Oct 3, 2022
PiperOrigin-RevId: 478523114
@lszekeres
Copy link
Member

Bumping up your ABSL version like in 3ae1783 fixes the issue.

markww pushed a commit to google-research/raksha that referenced this issue Oct 3, 2022
Currently, the fuzztest library has an issue where two macros with
colliding names are leaked from the headers of `absl` and `re2` into one
of fuzztest's `.cc` files
( google/fuzztest#41 ). Once this issue is
fixed, we should re-enable this warning.
netkex pushed a commit to netkex/abseil-cpp that referenced this issue Apr 3, 2024
by default.

The compatibility macro `ABSL_LEGACY_THREAD_ANNOTATIONS` can be
defined on the compile command-line to temporarily restore these
spellings. All of the thread annotation macros are available under
ABSL_ prefixed spellings in `absl/base/thread_annotations.h`. The
compatibility macro and the legacy spellings will be removed in the
future.

See google/fuzztest#41

PiperOrigin-RevId: 478498273
Change-Id: I120ad6480d031642bf95a11bf72ab883d9161810
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants