C99 technically requires the rest arguments to be used in C variadic macros. This presents a
problem with the macro SCOPED_TSAN_INTERCEPTOR when func takes no arguments.
This happens with the function pause. Like other void argument functions, we pass in a fake argument to avoid this warning.
Details
Diff Detail
- Build Status
Buildable 11457 Build 11457: arc lint + arc unit
Event Timeline
lib/tsan/rtl/tsan_interceptors.h | ||
---|---|---|
59 ↗ | (On Diff #119732) | Yes, that is one way to solve this. Unfortunately, that is a GNU extension, and is not considered portable. My solution should work on any platform correctly. |
lib/tsan/rtl/tsan_interceptors.h | ||
---|---|---|
59 ↗ | (On Diff #119732) | Looks like clang supports it, and I believe that we don't support tsan on windows (so don't need to worry about MSVC). But I'll defer to other reviewers on the best way. |
lib/tsan/rtl/tsan_interceptors.h | ||
---|---|---|
59 ↗ | (On Diff #119732) | Sure, I think it's totally fine to use the GNU extension. However, if supporting tsan on windows is something people want, this solution will probably be better. |
Does the same requirement present in C++11?
This fix for a warning looks too complex to me.
I have hard time understanding how it works. I afraid if I even need to modify this code. It seems to be very subtly different from what we have now because ARGS_ZERO still expands to nothing.
I would prefer if we just do what we do for all other void interceptors -- append 'int fake' argument.
I'm not sure if the same requirement is present in C++11.
I tried what you suggested based off of the other void argument functions that use a fake argument, which seems to work well here too. Much better than the complex macros! :)