Last Comment Bug 711683 - Use Clang's feature-detection macros for feature testing, not its "marketing" version numbers
: Use Clang's feature-detection macros for feature testing, not its "marketing"...
Product: Core
Classification: Components
Component: MFBT (show other bugs)
: unspecified
: All All
-- minor (vote)
: mozilla11
Assigned To: Jeff Walden [:Waldo] (remove +bmo to email)
Depends on:
  Show dependency treegraph
Reported: 2011-12-16 20:05 PST by Jeff Walden [:Waldo] (remove +bmo to email)
Modified: 2011-12-19 05:47 PST (History)
3 users (show)
See Also:
Crash Signature:
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---

Patch (1.20 KB, patch)
2011-12-16 20:05 PST, Jeff Walden [:Waldo] (remove +bmo to email)
cjones.bugs: review+
Details | Diff | Splinter Review

Description User image Jeff Walden [:Waldo] (remove +bmo to email) 2011-12-16 20:05:04 PST
Created attachment 582471 [details] [diff] [review]

Skimming Clang mailing list traffic tonight, I discovered that vendors are seemingly intent on muddying the waters by disconnecting Clang version numbers from feature sets -- good times.  So relying on version checks for features is a bit dodgy.  Conveniently Clang provides feature detection macros which will do the same work, arguably more clearly.  Whee, kinda-make-work.

The warning about version checking is here, for the major/minor macros:

The patch uses the __has_extension macro because we want to use the relevant language features even if we're not compiling plain old C++98 -- no reason to hold back use of these features for a full transition over.  __has_extension is documented here:

The arguments passed to __has_extension are documented here:

I checked some .i files with this patch, and things translate as expected in a Clang compile.
Comment 1 User image Jeff Walden [:Waldo] (remove +bmo to email) 2011-12-18 20:39:45 PST
Comment 2 User image Marco Bonardo [::mak] 2011-12-19 05:47:02 PST

Note You need to log in before you can comment on or make changes to this bug.