Good idea Florian.
I sort-of did that for a few functions, e.g.,
profiler_capture_backtrace() returns null.
Ideally we would keep all
MOZ_GECKO_PROFILER declarations from Base/GeckoProfiler.h (but without the
MOZ_GECKO_PROFILER anymore), and we could have a special platform-noop.cpp that gets compiled instead of platform.cpp, where we would define these no-op functions. We could make them inline if we wanted to.
What to do with the macros though? E.g.,
AUTO_PROFILER_LABEL is empty in non-
MOZ_GECKO_PROFILER builds, which is most efficient. Should it still be empty on some platforms (but that could re-create build issues), or should it be defined the same way everywhere, but the implementation of
class AutoProfilerLabel could be different by platform?
In the end I'm afraid that whatever we do, there will still be issues if we don't have CI tasks that can ring the alarm as soon as we land something that breaks unsupported platforms, instead of waiting for a 3rd party to tell us. If we had the no-op profiler fully defined inline in headers (as you suggested), I think we could create a cppunit test that includes just that and can simulate an unsupported-platform build. 🤔
(It took me some time to write all this, with different ideas popping up and being discarded as I wrote more, showing that it's not clear to me yet which is the best way to proceed. Happy to chat further...)