Skip to contentSkip to conversation

tst_minmax.h: Include <sys/param.h>

PATCH In review Petr Vorel 1 participant 2 messages Jan 26, 2023 – Feb 8, 2023

lore
Share & tools
lore

Petr Vorel

author
#0 lore raw

PATCH 1/1 tst_minmax.h: Include <sys/param.h>

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.

---
Hi,

another trivial fix, which can wait till the release.

Kind regards,
Petr

 include/tst_minmax.h | 3 +++
 1 file changed, 3 insertions(+)
include/tst_minmax.h +3 -0
index 9d7d596fce..1597fbc978 100644
@@ -1,10 +1,13 @@
 /* SPDX-License-Identifier: GPL-2.0-or-later
  * Copyright (c) 2017 Cyril Hrubis <[email protected]>
+ * 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); \
Signature · 5 lines
2.39.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#1 lore raw

Hi,

FYI merged.

Kind regards,
Petr

Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp