Closed Bug 804872 Opened 12 years ago Closed 12 years ago

xpcom/tests/TestObserverArray.cpp uses a C99 extension, causing a clang warning, triggering a -Werror build failure

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: Waldo, Assigned: Waldo)

References

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
Empty macro arguments, like so:

#define FOO(x, y) bar
FOO(1, )

are only valid in C99 and C++11.

http://stackoverflow.com/questions/7666344/are-empty-macro-arguments-legal-in-c11

TestObserverArray.cpp compiles with no special options, so it compiles as C++98.  clang r163985 warns about using a C99/C++11 extension here, and since the directory's FAIL_ON_WARNINGS = 1, this breaks the build.
Attachment #674483 - Flags: review?(dholbert)
Comment on attachment 674483 [details] [diff] [review]
Patch

The ";" in the middle of a line is a little bizarre there, readability-wise.  (I actually didn't even see it at first -- couldn't tell what the patch was changing -- and even after seeing it, it's a little bizarre.)

Perhaps "{}" would be better, as an "execute no code" marker?

Either way, r=me.
Attachment #674483 - Flags: review?(dholbert) → review+
{} was a better call than ;.  I added a /* nothing */ to make it even more visible, and not something that potentially might look like a literal or something.

https://hg.mozilla.org/integration/mozilla-inbound/rev/fae81f4e7a9b
Target Milestone: --- → mozilla19
https://hg.mozilla.org/mozilla-central/rev/fae81f4e7a9b
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Flags: in-testsuite-
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: