assert.h: Undefine ASSERT macro in case vendorcode headers set it

Some edk2 vendorcode headers define an ASSERT macro. They're guarded
with an #ifndef ASSERT, but if coreboot's assert.h gets included after
that header, we still have a problem. Add code to assert.h to undefine
any rogue definitions that may have already been set by vendorcode
headers.

This is ugly and should only be a stopgap... it would be nice if someone
maintaining those vendorcode parts could eventually replace it with a
better solution. One option would be to use a "guard header" for every
vendorcode header we want to pull into normal coreboot code which would
chain-include the vendorcode header and then undefine anything that
clashes with coreboot again.

Change-Id: Ibf8dc8b2365821e401ce69705df20aa7540aefb2
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/32715
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@google.com>
This commit is contained in:
Julius Werner 2019-05-09 14:12:17 -07:00
parent ef7d89cabe
commit a73e5a75b1
1 changed files with 6 additions and 0 deletions

View File

@ -19,6 +19,12 @@
#include <arch/hlt.h>
#include <console/console.h>
/* TODO: Fix vendorcode headers to not define macros coreboot uses or to be more
properly isolated. */
#ifdef ASSERT
#undef ASSERT
#endif
/* GCC and CAR versions */
#define ASSERT(x) { \
if (!(x)) { \