From e2e549a22f55465074e9f73c4012473a9a7f56e3 Mon Sep 17 00:00:00 2001 From: Fabian Zahn Date: Sun, 14 Oct 2018 14:08:09 +0200 Subject: [PATCH] Added include of 'stddef.h' to 'unity_internals.h' if 'UNITY_EXCLUDE_STDDEF_H' is not defined. This adds compiler independent support for the 'NULL' macro. --- docs/UnityConfigurationGuide.md | 12 ++++++++++++ src/unity_internals.h | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/docs/UnityConfigurationGuide.md b/docs/UnityConfigurationGuide.md index dace20c..b88eeee 100644 --- a/docs/UnityConfigurationGuide.md +++ b/docs/UnityConfigurationGuide.md @@ -215,6 +215,18 @@ Guide. _Example:_ #define UNITY_FLOAT_PRECISION 0.001f +### Miscellaneous + +##### `UNITY_EXCLUDE_STDDEF_H` + +Unity uses the `NULL` macro, which defines the value of a null pointer constant, +defined in `stddef.h` by default. If you want to provide +your own macro for this, you should exclude the `stddef.h` header file by adding this +define to your configuration. + +_Example:_ + #define UNITY_EXCLUDE_STDDEF_H + ### Toolset Customization diff --git a/src/unity_internals.h b/src/unity_internals.h index 351d9fe..4c55ef8 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -19,6 +19,10 @@ #include #endif +#ifndef UNITY_EXCLUDE_STDDEF_H +#include +#endif + /* Unity Attempts to Auto-Detect Integer Types * Attempt 1: UINT_MAX, ULONG_MAX in , or default to 32 bits * Attempt 2: UINTPTR_MAX in , or default to same size as long