--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
Anybody know why the #ifdef for Mac is OS_MACOSX instead of. OS_MAC? OS_MACOSX seems error prone and redundant. People seem to accidentally type:#if defined(OS_MAC)#if defined(OS_MACOS)which requires cleanup CLs to fix this, here are some examples:https://src.chromium.org/viewvc/chrome?view=rev&revision=183477
https://src.chromium.org/viewvc/chrome?view=rev&revision=173253
http://src.chromium.org/viewvc/chrome?view=rev&revision=127389
http://src.chromium.org/viewvc/chrome?view=rev&revision=60904
http://src.chromium.org/viewvc/chrome?view=rev&revision=43370
http://src.chromium.org/viewvc/chrome?view=rev&revision=36000
http://src.chromium.org/viewvc/chrome?view=rev&revision=19405
http://src.chromium.org/viewvc/chrome?view=rev&revision=10438
http://src.chromium.org/viewvc/chrome?view=rev&revision=432
(this is not a new problem)
--
There was a collision with something in third_party. And OS_WIN is OS_WIN because there was a collision with OS_WINDOWS.Why is OS_MAC better than OS_MACOSX?
We don’t need more than one macro for this, and it seems like people are going to type the wrong one no matter which one we choose.
On Tue, Mar 19, 2013 at 12:23 PM, Mark Mentovai <ma...@chromium.org> wrote:
There was a collision with something in third_party. And OS_WIN is OS_WIN because there was a collision with OS_WINDOWS.Why is OS_MAC better than OS_MACOSX?It's less redundant (there's no second "OS") and shorter to type (less to screw up, less wrapping, less bits).
We don’t need more than one macro for this, and it seems like people are going to type the wrong one no matter which one we choose.I don't want another macro, I want to change the existing one :). This idea came from my fiddling around in src/PRESUBMIT.py to catch OS_MAC/OS_MACOS. I figured I'd double check why it's named this way first. Also, just anecdotally, I haven't seen as many OS_LINUX or OS_WIN mispelling CLs fly past me.
Also, just anecdotally, I haven't seen as many OS_LINUX or OS_WIN mispelling CLs fly past me.
On Tue, Mar 19, 2013 at 12:49 PM, Dan Beam <db...@chromium.org> wrote:
On Tue, Mar 19, 2013 at 12:23 PM, Mark Mentovai <ma...@chromium.org> wrote:
There was a collision with something in third_party. And OS_WIN is OS_WIN because there was a collision with OS_WINDOWS.Why is OS_MAC better than OS_MACOSX?It's less redundant (there's no second "OS") and shorter to type (less to screw up, less wrapping, less bits).
We don’t need more than one macro for this, and it seems like people are going to type the wrong one no matter which one we choose.I don't want another macro, I want to change the existing one :). This idea came from my fiddling around in src/PRESUBMIT.py to catch OS_MAC/OS_MACOS. I figured I'd double check why it's named this way first. Also, just anecdotally, I haven't seen as many OS_LINUX or OS_WIN mispelling CLs fly past me.There are a few:$ git log --grep OS_WINDOWS | wc -l124
git gs OS_WINDOWS | egrep -v third_partymedia/filters/gpu_video_decoder.cc:140:#if defined(OS_WINDOWS)
I assume that shess@ is saying renaming is just as error prone.
FYI: These are the current Mac problems as well :(,$ git gs 'OS_MAC\b' | grep -v third_party | grep -v 'testing/' | grep -v '#endif'
base/path_service_unittest.cc:65:#if defined(OS_MAC)chrome/browser/autofill/autofill_browsertest.cc:749:#if defined(OS_MAC)chrome/browser/download/download_path_reservation_tracker_unittest.cc:458:#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_CHROMEOS)$ git gs 'OS_MACOS\b' | grep -v third_partychrome/browser/ui/browser_command_controller_unittest.cc:258:#if defined(OS_MACOS)chrome/browser/ui/browser_command_controller_unittest.cc:298:#endif // defined(OS_MACOS)It seems obvious to me that this is a problem. If renaming isn't bulletproof, does adding a check for the usual suspects (OS_MAC, OS_MACOS, OS_WINDOWS) in src/PRESUBMIT.py and/or changing base/build_defs.h (the way scottmg@/groby@ have proposed) sound like a better answer to everyone?
Already landed https://codereview.chromium.org/12829005/ (presumably what started this discussion :)- dale
On Tue, Mar 19, 2013 at 3:09 PM, Mark Mentovai <ma...@chromium.org> wrote:
Dan Beam wrote:I assume that shess@ is saying renaming is just as error prone.
FYI: These are the current Mac problems as well :(,$ git gs 'OS_MAC\b' | grep -v third_party | grep -v 'testing/' | grep -v '#endif'
base/path_service_unittest.cc:65:#if defined(OS_MAC)chrome/browser/autofill/autofill_browsertest.cc:749:#if defined(OS_MAC)chrome/browser/download/download_path_reservation_tracker_unittest.cc:458:#if defined(OS_WIN) || defined(OS_MAC) || defined(OS_CHROMEOS)$ git gs 'OS_MACOS\b' | grep -v third_partychrome/browser/ui/browser_command_controller_unittest.cc:258:#if defined(OS_MACOS)chrome/browser/ui/browser_command_controller_unittest.cc:298:#endif // defined(OS_MACOS)It seems obvious to me that this is a problem. If renaming isn't bulletproof, does adding a check for the usual suspects (OS_MAC, OS_MACOS, OS_WINDOWS) in src/PRESUBMIT.py and/or changing base/build_defs.h (the way scottmg@/groby@ have proposed) sound like a better answer to everyone?Either of these are fine.I responded privately with a weak reason to stick with the OS_* names instead of an OS(…) funcro, but it’s admittedly a weak reason at this point.WebKit uses OS(...) funcros which expand out to longer macros that don't have the same collision risk. Could you share your reason to not use that pattern in chromium? I'm not sure it's better or worse but I'd like to know more about the tradeoffs.
The three extra versions of the Mac macros might as well be random line noise, because they don't currently have meaning!I didn't mean "We shouldn't fix an identified problem". I meant that changing 10 to 12 thousand lines of code from one preprocessor style to another seems like a bigger job than fixing a few dozen currently-broken sites and adding a presubmit so that errors have to try harder to get landed.
-scott