[rtems commit] Add include guard checks to kernel space headers

Sebastian Huber sebh at rtems.org
Wed May 18 07:59:27 UTC 2022


Module:    rtems
Branch:    master
Commit:    81962136cc2d336e014f9c53ae21540fe390bde5
Changeset: http://git.rtems.org/rtems/commit/?id=81962136cc2d336e014f9c53ae21540fe390bde5

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Wed May 18 09:49:38 2022 +0200

Add include guard checks to kernel space headers

---

 cpukit/include/machine/_kernel_cpuset.h | 4 ++++
 cpukit/include/machine/_kernel_param.h  | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/cpukit/include/machine/_kernel_cpuset.h b/cpukit/include/machine/_kernel_cpuset.h
index 22a245e037..bad1d378d4 100644
--- a/cpukit/include/machine/_kernel_cpuset.h
+++ b/cpukit/include/machine/_kernel_cpuset.h
@@ -30,3 +30,7 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  * POSSIBILITY OF SUCH DAMAGE.
  */
+
+#if !defined(_SYS_CPUSET_H_) || !defined(_KERNEL)
+#error "must be included via <sys/cpuset.h> in kernel space"
+#endif
diff --git a/cpukit/include/machine/_kernel_param.h b/cpukit/include/machine/_kernel_param.h
index dcdd49d467..af17cbc095 100644
--- a/cpukit/include/machine/_kernel_param.h
+++ b/cpukit/include/machine/_kernel_param.h
@@ -36,6 +36,10 @@
 #include <sys/time.h>
 #include <sys/priority.h>
 
+#if !defined(_SYS_PARAM_H_) || !defined(_KERNEL)
+#error "must be included via <sys/param.h> in kernel space"
+#endif
+
 #ifndef FALSE
 #define	FALSE	0
 #endif



More information about the vc mailing list