This mixes some manual work (IWYU pragmas, a better solution to the Arduino preprocessor macros problem) with automated running of the tools. At this point, it would be too much work to separate these into distinct commits, and there isn't that much value to doing so. There are still some things we could do to make things more robust, as some of the headers need to be in a certain order, which happens to be in the same sort order used by IWYU (`testing/*` files need to come after certain headers than include `Arduino.h`), but it's probably not worth the clutter of adding an `#if 1` just to stop IWYU from re-ordering them. I tried to get `#pragma push_macro("max")/pop_macro("max")` to work, but ended up getting completely nonsensical compilation errors, so I gave up on it. Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>pull/1162/head
parent
ee33b228f9
commit
9b04d6663c
@ -0,0 +1,36 @@
|
|||||||
|
/* -*- mode: c++ -*-
|
||||||
|
* Copyright (C) 2022 Keyboardio, Inc.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify it under
|
||||||
|
* the terms of the GNU General Public License as published by the Free Software
|
||||||
|
* Foundation, version 3.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
|
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
|
||||||
|
* details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with
|
||||||
|
* this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#undef TEST
|
||||||
|
|
||||||
|
// In order to include gtest files, we need to undefine some macros that
|
||||||
|
// Arduino.h unwisely exports. Rahter than including "gtest/gtest.h" (et al)
|
||||||
|
// directly, any simulator code should instead include "testing/gtest.h".
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
|
||||||
|
// The headers listed here other than "gtest/gtest.h" and "gmock/gmock.h" are
|
||||||
|
// only included to prevent IWYU from inserting them directly into simulator
|
||||||
|
// source files. This seems mildly preferable to modifying the gtest files
|
||||||
|
// themselves.
|
||||||
|
#include "gmock/gmock-matchers.h" // IWYU pragma: export
|
||||||
|
#include "gmock/gmock.h" // IWYU pragma: export
|
||||||
|
#include "gtest/gtest-message.h" // IWYU pragma: export
|
||||||
|
#include "gtest/gtest-test-part.h" // IWYU pragma: export
|
||||||
|
#include "gtest/gtest.h" // IWYU pragma: export
|
||||||
|
#include "gtest/gtest_pred_impl.h" // IWYU pragma: export
|
Loading…
Reference in new issue