aboutsummaryrefslogtreecommitdiff
path: root/tools/build/cross-build/include/common
diff options
context:
space:
mode:
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>2020-12-14 10:52:15 +0000
committerAlex Richardson <arichardson@FreeBSD.org>2021-01-07 09:30:50 +0000
commit4e64fb9f4901e99ce02f13d45f370e75d53075a6 (patch)
treecebb9f9fb81b897d8d4617247aa099ae708e75eb /tools/build/cross-build/include/common
parented8455806e88deeb7151b9bb23ad5026a36d252d (diff)
downloadsrc-4e64fb9f4901e99ce02f13d45f370e75d53075a6.tar.gz
src-4e64fb9f4901e99ce02f13d45f370e75d53075a6.zip
Fix warnings during bootstrap on Linux systems
Most warnings are currently off for the boostrap phase, but once D27598 lands they will be enabled again.
Diffstat (limited to 'tools/build/cross-build/include/common')
-rw-r--r--tools/build/cross-build/include/common/grp.h2
-rw-r--r--tools/build/cross-build/include/common/pwd.h2
-rw-r--r--tools/build/cross-build/include/common/sys/cdefs.h24
-rw-r--r--tools/build/cross-build/include/common/sys/param.h26
-rw-r--r--tools/build/cross-build/include/common/unistd.h2
5 files changed, 29 insertions, 27 deletions
diff --git a/tools/build/cross-build/include/common/grp.h b/tools/build/cross-build/include/common/grp.h
index add44b9f8695..08a8bc540569 100644
--- a/tools/build/cross-build/include/common/grp.h
+++ b/tools/build/cross-build/include/common/grp.h
@@ -53,7 +53,7 @@ const char *group_from_gid(gid_t gid, int noname);
#ifdef __linux__
static inline int
-setgroupent(int stayopen)
+setgroupent(int stayopen __unused)
{
setgrent();
return (1);
diff --git a/tools/build/cross-build/include/common/pwd.h b/tools/build/cross-build/include/common/pwd.h
index 243da3a1332f..e167fe47701f 100644
--- a/tools/build/cross-build/include/common/pwd.h
+++ b/tools/build/cross-build/include/common/pwd.h
@@ -52,7 +52,7 @@ const char *user_from_uid(uid_t uid, int noname);
#ifdef __linux__
static inline int
-setpassent(int stayopen)
+setpassent(int stayopen __unused)
{
setpwent();
return (1);
diff --git a/tools/build/cross-build/include/common/sys/cdefs.h b/tools/build/cross-build/include/common/sys/cdefs.h
index c86369ab778a..c129542b6180 100644
--- a/tools/build/cross-build/include/common/sys/cdefs.h
+++ b/tools/build/cross-build/include/common/sys/cdefs.h
@@ -59,15 +59,6 @@
#define __IDSTRING(name, string)
#endif
-#ifndef rounddown
-#define rounddown(x, y) (((x) / (y)) * (y))
-#define rounddown2(x, y) ((x) & (~((y)-1))) /* if y is power of two */
-#define roundup(x, y) ((((x) + ((y)-1)) / (y)) * (y)) /* to any y */
-#define roundup2(x, y) \
- (((x) + ((y)-1)) & (~((y)-1))) /* if y is powers of two */
-#define powerof2(x) ((((x)-1) & (x)) == 0)
-#endif
-
#ifndef __pure
#define __pure __attribute__((__pure__))
#endif
@@ -145,12 +136,6 @@
#define __malloc_like __attribute__((__malloc__))
#endif
-#ifndef nitems
-// https://stackoverflow.com/questions/1598773/is-there-a-standard-function-in-c-that-would-return-the-length-of-an-array/1598827#1598827
-#define nitems(x) \
- ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
-#endif
-
#ifndef __min_size
#if !defined(__cplusplus)
#define __min_size(x) static(x)
@@ -181,15 +166,6 @@
#define __printf0__ __printf__
#endif
-/*
- * These should probably be in sys/types.h but mtree expects them to exist
- * without including <sys/types.h>
- */
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
-typedef unsigned long u_long;
-
/* On MacOS __CONCAT is defined as x ## y, which won't expand macros */
#undef __CONCAT
#define __CONCAT1(x, y) x##y
diff --git a/tools/build/cross-build/include/common/sys/param.h b/tools/build/cross-build/include/common/sys/param.h
index a197fe3ea9ff..f672b1067d46 100644
--- a/tools/build/cross-build/include/common/sys/param.h
+++ b/tools/build/cross-build/include/common/sys/param.h
@@ -12,6 +12,9 @@
* Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
* ("CTSRD"), as part of the DARPA CRASH research programme.
*
+ * This work was supported by Innovate UK project 105694, "Digital Security by
+ * Design (DSbD) Technology Platform Prototype".
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -63,3 +66,26 @@
#ifndef __PAST_END
#define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset])
#endif
+
+#ifndef nitems
+// https://stackoverflow.com/questions/1598773/is-there-a-standard-function-in-c-that-would-return-the-length-of-an-array/1598827#1598827
+#define nitems(x) \
+ ((sizeof(x) / sizeof(0 [x])) / ((size_t)(!(sizeof(x) % sizeof(0 [x])))))
+#endif
+
+#ifndef rounddown
+#define rounddown(x, y) (((x) / (y)) * (y))
+#endif
+#ifndef rounddown2
+#define rounddown2(x, y) ((x) & (~((y)-1))) /* if y is power of two */
+#endif
+#ifndef roundup
+#define roundup(x, y) ((((x) + ((y)-1)) / (y)) * (y)) /* to any y */
+#endif
+#ifndef roundup2
+#define roundup2(x, y) \
+ (((x) + ((y)-1)) & (~((y)-1))) /* if y is powers of two */
+#endif
+#ifndef powerof2
+#define powerof2(x) ((((x)-1) & (x)) == 0)
+#endif
diff --git a/tools/build/cross-build/include/common/unistd.h b/tools/build/cross-build/include/common/unistd.h
index f438b8936105..593dd700f140 100644
--- a/tools/build/cross-build/include/common/unistd.h
+++ b/tools/build/cross-build/include/common/unistd.h
@@ -40,7 +40,7 @@
#include <getopt.h>
static inline int
-check_utility_compat(const char *utility)
+check_utility_compat(const char *utility __unused)
{
/*
* The check_utility_compat() function returns zero if utility should