RESOLVED FIXED 151621
Use mark pragmas only if it is supported
https://bugs.webkit.org/show_bug.cgi?id=151621
Summary Use mark pragmas only if it is supported
Csaba Osztrogonác
Reported 2015-11-26 05:45:11 PST
build log: ----------- ../../Source/JavaScriptCore/b3/air/AirIteratedRegisterCoalescing.cpp:687:0: error: ignoring #pragma mark [-Werror=unknown-pragmas] ../../Source/JavaScriptCore/b3/air/AirIteratedRegisterCoalescing.cpp:721:0: error: ignoring #pragma mark [-Werror=unknown-pragmas] mark pragma is an OS X only feature, we shouldn't use them unconditionally.
Attachments
Patch (1.51 KB, patch)
2015-11-26 06:01 PST, Csaba Osztrogonác
no flags
Csaba Osztrogonác
Comment 1 2015-11-26 06:01:26 PST
Mark Lam
Comment 2 2015-11-26 06:45:39 PST
Comment on attachment 266182 [details] Patch r=me
Alexey Proskuryakov
Comment 3 2015-11-26 07:30:42 PST
What does Cocoa have to do with pragmas? Is this how we usually conditionalize these?
Csaba Osztrogonác
Comment 4 2015-11-26 08:14:37 PST
(In reply to comment #3) > What does Cocoa have to do with pragmas? This pragma is for Xcode, that's why GCC on Linux doesn't know what to with it. http://iosdevelopertips.com/xcode/xcode-and-pragma-mark.html > Is this how we usually conditionalize these? It is the first and only occurence of this pragma in platform independent code.
Mark Lam
Comment 5 2015-11-26 08:16:53 PST
(In reply to comment #3) > What does Cocoa have to do with pragmas? Is this how we usually > conditionalize these? "#if PLATFORM(COCOA)" here is more like a pseudonym for "#if PLATFORM(MAC) || PLATFORM(IOS)". The pragma appears to only be supported by Xcode, and hence maybe by Clang in general? I would have suggested "#if COMPILER(CLANG)" except I'm not sure if Clang on linux also supports this pragma. Ossy, can you try "#if COMPILER(CLANG)" and then building on linux with Clang?
Csaba Osztrogonác
Comment 6 2015-11-26 08:59:04 PST
(In reply to comment #5) > (In reply to comment #3) > > What does Cocoa have to do with pragmas? Is this how we usually > > conditionalize these? > > "#if PLATFORM(COCOA)" here is more like a pseudonym for "#if PLATFORM(MAC) > || PLATFORM(IOS)". The pragma appears to only be supported by Xcode, and > hence maybe by Clang in general? I would have suggested "#if > COMPILER(CLANG)" except I'm not sure if Clang on linux also supports this > pragma. > > Ossy, can you try "#if COMPILER(CLANG)" and then building on linux with > Clang? Using COMPILER(CLANG) instead of PLATFORM(COCOA) would be very confusing. As far as I know "#pragma mark" is useful for only Xcode users which is same as PLATFORM(COCOA) ( == #if PLATFORM(MAC) || PLATFORM(IOS) ). I checked, Clang simply ignores this pragma on Linux too since an Apple employee hacked it into Clang - https://github.com/llvm-mirror/clang/commit/2243449253475574fc6f14986ff8f7fce5d46799 . Not to mention that pragmas are compiler directives originally, but Apple uses it for other purposes ...
WebKit Commit Bot
Comment 7 2015-11-27 05:02:04 PST
Comment on attachment 266182 [details] Patch Clearing flags on attachment: 266182 Committed r192778: <http://trac.webkit.org/changeset/192778>
WebKit Commit Bot
Comment 8 2015-11-27 05:02:09 PST
All reviewed patches have been landed. Closing bug.
Alexey Proskuryakov
Comment 9 2015-11-27 14:03:29 PST
A less misleading way to deal with this is to use #if 0 and #endif around the pragma. Alternatively, this style of comment is also recognized by Xcode: "// MARK: ..." The downside is that "MARK: " is also displayed in Xcode's function name menu then.
Note You need to log in before you can comment on or make changes to this bug.