1 |
On 12/4/17 6:34 AM, Marcus Folkesson wrote: |
2 |
> Some headerfiles are missing "#pragma once" or corresponding |
3 |
> "#ifndef..." which may result in build error if multiple source files |
4 |
> include the same file. |
5 |
> |
6 |
> Add "#pragma once" for concerned files. |
7 |
> |
8 |
> Signed-off-by: Marcus Folkesson <marcus.folkesson@×××××.com> |
9 |
> --- |
10 |
> src/mtd_probe/mtd_probe.h | 2 ++ |
11 |
> src/scsi_id/scsi.h | 2 ++ |
12 |
> src/scsi_id/scsi_id.h | 2 ++ |
13 |
> src/shared/device-nodes.h | 2 ++ |
14 |
> src/shared/fileio.h | 2 ++ |
15 |
> src/shared/path-util.h | 2 ++ |
16 |
> src/shared/siphash24.h | 3 +++ |
17 |
> src/shared/socket-util.h | 2 ++ |
18 |
> src/udev/udevadm-util.h | 2 ++ |
19 |
> 9 files changed, 19 insertions(+) |
20 |
> |
21 |
> diff --git a/src/mtd_probe/mtd_probe.h b/src/mtd_probe/mtd_probe.h |
22 |
> index e048a0122..caea5c269 100644 |
23 |
> --- a/src/mtd_probe/mtd_probe.h |
24 |
> +++ b/src/mtd_probe/mtd_probe.h |
25 |
> @@ -17,6 +17,8 @@ |
26 |
> * Boston, MA 02110-1301 USA |
27 |
> */ |
28 |
> |
29 |
> +#pragma once |
30 |
> + |
31 |
> #include <mtd/mtd-user.h> |
32 |
> |
33 |
> #include "macro.h" |
34 |
> diff --git a/src/scsi_id/scsi.h b/src/scsi_id/scsi.h |
35 |
> index c423cac57..3f99ae772 100644 |
36 |
> --- a/src/scsi_id/scsi.h |
37 |
> +++ b/src/scsi_id/scsi.h |
38 |
> @@ -10,6 +10,8 @@ |
39 |
> * Free Software Foundation version 2 of the License. |
40 |
> */ |
41 |
> |
42 |
> +#pragma once |
43 |
> + |
44 |
> #include <scsi/scsi.h> |
45 |
> |
46 |
> struct scsi_ioctl_command { |
47 |
> diff --git a/src/scsi_id/scsi_id.h b/src/scsi_id/scsi_id.h |
48 |
> index 648b5ce42..141b116a8 100644 |
49 |
> --- a/src/scsi_id/scsi_id.h |
50 |
> +++ b/src/scsi_id/scsi_id.h |
51 |
> @@ -15,6 +15,8 @@ |
52 |
> * along with this program. If not, see <http://www.gnu.org/licenses/>. |
53 |
> */ |
54 |
> |
55 |
> +#pragma once |
56 |
> + |
57 |
> #define MAX_PATH_LEN 512 |
58 |
> |
59 |
> /* |
60 |
> diff --git a/src/shared/device-nodes.h b/src/shared/device-nodes.h |
61 |
> index d27ac0906..5df53e8c0 100644 |
62 |
> --- a/src/shared/device-nodes.h |
63 |
> +++ b/src/shared/device-nodes.h |
64 |
> @@ -17,5 +17,7 @@ |
65 |
> along with systemd; If not, see <http://www.gnu.org/licenses/>. |
66 |
> ***/ |
67 |
> |
68 |
> +#pragma once |
69 |
> + |
70 |
> int encode_devnode_name(const char *str, char *str_enc, size_t len); |
71 |
> int whitelisted_char_for_devnode(char c, const char *additional); |
72 |
> diff --git a/src/shared/fileio.h b/src/shared/fileio.h |
73 |
> index 641bf0230..7beed2eb8 100644 |
74 |
> --- a/src/shared/fileio.h |
75 |
> +++ b/src/shared/fileio.h |
76 |
> @@ -17,6 +17,8 @@ |
77 |
> along with systemd; If not, see <http://www.gnu.org/licenses/>. |
78 |
> ***/ |
79 |
> |
80 |
> +#pragma once |
81 |
> + |
82 |
> #include <stddef.h> |
83 |
> #include <stdio.h> |
84 |
> |
85 |
> diff --git a/src/shared/path-util.h b/src/shared/path-util.h |
86 |
> index 0123c2609..1d15d4c0f 100644 |
87 |
> --- a/src/shared/path-util.h |
88 |
> +++ b/src/shared/path-util.h |
89 |
> @@ -17,6 +17,8 @@ |
90 |
> along with systemd; If not, see <http://www.gnu.org/licenses/>. |
91 |
> ***/ |
92 |
> |
93 |
> +#pragma once |
94 |
> + |
95 |
> #include <stdbool.h> |
96 |
> |
97 |
> #include "macro.h" |
98 |
> diff --git a/src/shared/siphash24.h b/src/shared/siphash24.h |
99 |
> index 3253c179b..c2c19b437 100644 |
100 |
> --- a/src/shared/siphash24.h |
101 |
> +++ b/src/shared/siphash24.h |
102 |
> @@ -1,3 +1,6 @@ |
103 |
> + |
104 |
> +#pragma once |
105 |
> + |
106 |
> #include <inttypes.h> |
107 |
> #include <sys/types.h> |
108 |
> |
109 |
> diff --git a/src/shared/socket-util.h b/src/shared/socket-util.h |
110 |
> index 2daa3279f..52b8dff66 100644 |
111 |
> --- a/src/shared/socket-util.h |
112 |
> +++ b/src/shared/socket-util.h |
113 |
> @@ -17,6 +17,8 @@ |
114 |
> along with systemd; If not, see <http://www.gnu.org/licenses/>. |
115 |
> ***/ |
116 |
> |
117 |
> +#pragma once |
118 |
> + |
119 |
> #include <sys/socket.h> |
120 |
> #include <netinet/in.h> |
121 |
> #include <sys/un.h> |
122 |
> diff --git a/src/udev/udevadm-util.h b/src/udev/udevadm-util.h |
123 |
> index dba651fdd..37e4fe836 100644 |
124 |
> --- a/src/udev/udevadm-util.h |
125 |
> +++ b/src/udev/udevadm-util.h |
126 |
> @@ -15,6 +15,8 @@ |
127 |
> * along with this program. If not, see <http://www.gnu.org/licenses/>. |
128 |
> */ |
129 |
> |
130 |
> +#pragma once |
131 |
> + |
132 |
> #include "udev.h" |
133 |
> |
134 |
> struct udev_device *find_device(struct udev *udev, |
135 |
> |
136 |
|
137 |
|
138 |
I know we have some clang users. Does #pragma work for clang? |
139 |
|
140 |
-- |
141 |
Anthony G. Basile, Ph.D. |
142 |
Gentoo Linux Developer [Hardened] |
143 |
E-Mail : blueness@g.o |
144 |
GnuPG FP : 1FED FAD9 D82C 52A5 3BAB DC79 9384 FA6E F52D 4BBA |
145 |
GnuPG ID : F52D4BBA |