Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(153)

Issue 12944002: Attempt at improved OS macros (Closed)

Created:
7 years, 9 months ago by scottmg
Modified:
7 years, 9 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Attempt at improved OS macros No actual changes to use this macro yet. Obviously an ARCH() could be similar. No presubmit changes yet. The presubmit could just look for OS_<word> which becomes always wrong now. The last 4 are difficult to defend against, as you can always do #if[def] MACAROON which will be false. Is PRESUBMIT sufficient for those cases? And are there other error cases the macro should attempt to defend against? #if OS(MAC) // Compile time error. #endif #if OS(WINDOWS) // Compile time error. #endif #if OS(WEE) // Compile time error. #endif #if OS(MACOSX) // True iff __APPLE__ #endif #if OS(WIN) // True iff _WIN32 #endif #ifdef OS(WEE) // Compile time error, should be #if. #endif #ifdef OS(WIN) // Compile time error, should be #if. #endif #if defined OS(WEE) // Compile time error, should be #if. #endif #if defined OS(WIN) // Compile time error, should be #if. #endif #if defined(OS_WIN) // Always false, checked via PRESUBMIT. #endif #ifdef OS_WIN // Always false, checked via PRESUBMIT. #endif #if OS_WIN // Always false, checked via PRESUBMIT. #endif #if defined(OS_WINDOWS) // Always false, checked via PRESUBMIT #endif BUG=

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+11 lines, -0 lines) Patch
M build/build_config.h View 2 chunks +11 lines, -0 lines 1 comment Download

Messages

Total messages: 3 (0 generated)
Ryan Sleevi
https://codereview.chromium.org/12944002/diff/1/build/build_config.h File build/build_config.h (right): https://codereview.chromium.org/12944002/diff/1/build/build_config.h#newcode24 build/build_config.h:24: #define OS_IS_ENABLED__WIN + BUG: s/__WIN/__MAC
7 years, 9 months ago (2013-03-19 21:55:13 UTC) #1
Mark Mentovai
You’d also need to provide definitions for all of the known OS_IS_ENABLED__* macros when they ...
7 years, 9 months ago (2013-03-19 22:26:54 UTC) #2
scottmg
7 years, 9 months ago (2013-03-19 23:04:03 UTC) #3
On 2013/03/19 22:26:54, Mark Mentovai wrote:
> You’d also need to provide definitions for all of the known OS_IS_ENABLED__*
> macros when they aren’t +.

Hmm, yeah there'd have to be

#define OS_IS_ENABLED__WIN -
etc.

to handle #if !OS(WIN). With the plethora of OSs we have that's going to be a
bit ugly.

It seemed nice to have a compile time check for faster turnaround than
presubmit, but a presubmit seems more practical especially given the churn this
would require.

Powered by Google App Engine
This is Rietveld 408576698