This is an archive of the discontinued LLVM Phabricator instance.

[test-suite] Support GCC compilation of Microbenchmark MemFunctions.
ClosedPublic

Authored by naromero77 on Dec 14 2020, 10:21 PM.

Details

Summary

GCC and Clang diverged in how attribute is supported. GCC gives a compile-time error if there is an attribute in the function-definition and needs to be in the forward declaration. Clang does not like attribute in the forward declaration and requires it in the function-definition. This is the only benchmark in the test suite not compiling with GCC.

Event Timeline

naromero77 requested review of this revision.Dec 14 2020, 10:21 PM
naromero77 created this revision.
naromero77 retitled this revision from Support GCC compilation of Microbenchmark MemFunctions. to [test-suite] Support GCC compilation of Microbenchmark MemFunctions..
naromero77 edited the summary of this revision. (Show Details)

Thanks for the patch. Apparently both gcc and clang are fine if the attribute is placed before the definition: https://godbolt.org/z/5aTrcb, so we could do without the ifdefs.
(Though gcc does not know about the attribute, but that's also the case with the current version)

OK, let's do that instead. Best to avoid ifdefs. Will update patch soon.

  • Place attribute before the definition and avoid ifdef.
courbet accepted this revision.Dec 15 2020, 11:00 PM
This revision is now accepted and ready to land.Dec 15 2020, 11:00 PM
naromero77 closed this revision.Dec 16 2020, 9:21 PM