diff mbox series

[1/1] tst_minmax.h: Include <sys/param.h>

Message ID 20230126175302.12558-1-pvorel@suse.cz
State Accepted
Headers show
Series [1/1] tst_minmax.h: Include <sys/param.h> | expand

Commit Message

Petr Vorel Jan. 26, 2023, 5:53 p.m. UTC
It's always good to first include header which defines macros/structures
before define fallback. In this case it's needed to avoid redefinition:

$ make check-hugemmap15
CHECK testcases/kernel/mem/hugetlb/hugemmap/hugemmap15.c
hugemmap15.c: note: in included file:
/usr/include/sys/param.h:102:9: warning: preprocessor token MIN redefined
hugemmap15.c: note: in included file (through ../../../../../include/tst_test.h, testcases/kernel/mem/hugetlb/hugemmap/../lib/hugetlb.h):
../../../../../include/tst_minmax.h:9:10: this was the original definition
hugemmap15.c: note: in included file:
/usr/include/sys/param.h:103:9: warning: preprocessor token MAX redefined
hugemmap15.c: note: in included file (through ../../../../../include/tst_test.h, testcases/kernel/mem/hugetlb/hugemmap/../lib/hugetlb.h):
../../../../../include/tst_minmax.h:18:10: this was the original definition

Redefinitions is done because hugemmap15.c needs tst_test.h for
TST_TEST_TCONF(), but <sys/param.h> which defines MIN/MAX() is later
included.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,

another trivial fix, which can wait till the release.

Kind regards,
Petr

 include/tst_minmax.h | 3 +++
 1 file changed, 3 insertions(+)

Comments

Petr Vorel Feb. 8, 2023, 9:29 a.m. UTC | #1
Hi,

FYI merged.

Kind regards,
Petr
diff mbox series

Patch

diff --git a/include/tst_minmax.h b/include/tst_minmax.h
index 9d7d596fce..1597fbc978 100644
--- a/include/tst_minmax.h
+++ b/include/tst_minmax.h
@@ -1,10 +1,13 @@ 
 /* SPDX-License-Identifier: GPL-2.0-or-later
  * Copyright (c) 2017 Cyril Hrubis <chrubis@suse.cz>
+ * Copyright (c) Linux Test Project, 2020-2023
  */
 
 #ifndef TST_MINMAX_H__
 #define TST_MINMAX_H__
 
+#include <sys/param.h>
+
 #ifndef MIN
 # define MIN(a, b) ({ \
 	typeof(a) _a = (a); \