Summary: | Use mark pragmas only if it is supported | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Csaba Osztrogonác <ossy> | ||||
Component: | JavaScriptCore | Assignee: | Csaba Osztrogonác <ossy> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | ap, benjamin, commit-queue, fpizlo, ggaren, keith_miller, mark.lam, msaboff, ossy, saam | ||||
Priority: | P2 | ||||||
Version: | Other | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 152248 | ||||||
Attachments: |
|
Description
Csaba Osztrogonác
2015-11-26 05:45:11 PST
Created attachment 266182 [details]
Patch
Comment on attachment 266182 [details]
Patch
r=me
What does Cocoa have to do with pragmas? Is this how we usually conditionalize these? (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. (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? (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 ... Comment on attachment 266182 [details] Patch Clearing flags on attachment: 266182 Committed r192778: <http://trac.webkit.org/changeset/192778> All reviewed patches have been landed. Closing bug. 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. |