]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Use #pragma once for guarding headers
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 1 Aug 2019 18:49:00 +0000 (20:49 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 14 Aug 2019 19:41:30 +0000 (21:41 +0200)
It seems to be supported by all reasonably modern compilers now.

19 files changed:
configure.ac
src/ccache.hpp
src/common_header.hpp
src/compopt.hpp
src/compression.hpp
src/conf.hpp
src/confitems.hpp
src/counters.hpp
src/envtoconfitems.hpp
src/hash.hpp
src/hashutil.hpp
src/language.hpp
src/macroskip.hpp
src/manifest.hpp
src/result.hpp
src/system.hpp
src/unify.hpp
unittest/framework.hpp
unittest/util.hpp

index f947813090b1c77c62d9cb918659dbcda8c72614..5321d2590c23fb7ed84fdfda33392bbf6c8682c5 100644 (file)
@@ -290,13 +290,12 @@ AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 
 cat <<EOF >config.h.tmp
-#ifndef CCACHE_CONFIG_H
-#define CCACHE_CONFIG_H
+#pragma once
 #ifdef __clang__
-#pragma clang diagnostic push
-#if __has_warning("-Wreserved-id-macro")
-#pragma clang diagnostic ignored "-Wreserved-id-macro"
-#endif
+#  pragma clang diagnostic push
+#  if __has_warning("-Wreserved-id-macro")
+#    pragma clang diagnostic ignored "-Wreserved-id-macro"
+#  endif
 #endif
 
 EOF
@@ -304,9 +303,8 @@ cat config.h >>config.h.tmp
 cat <<EOF >>config.h.tmp
 
 #ifdef __clang__
-#pragma clang diagnostic pop
+#  pragma clang diagnostic pop
 #endif
-#endif // ifndef CCACHE_CONFIG_H
 EOF
 mv config.h.tmp config.h
 
index 8e3f10f334b167db575d09f6758a93553173fc5a..089f6b754331e01004def2319f28432ceae5354a 100644 (file)
@@ -17,8 +17,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef CCACHE_H
-#define CCACHE_H
+#pragma once
 
 #include "system.hpp"
 #include "conf.hpp"
@@ -325,5 +324,3 @@ void add_exe_ext_if_no_to_fullpath(char *full_path_win_ext, size_t max_size,
 #ifndef MIN
 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
 #endif
-
-#endif // ifndef CCACHE_H
index c131ee48d1cd3130a18d5fe81a99c2acf7a858f6..05bcda40e70fe4f94e6aa7e6334832b9a7375a16 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef COMMON_HEADER_H
-#define COMMON_HEADER_H
+#pragma once
 
 #include "compression.hpp"
 #include "third_party/xxhash.h"
@@ -80,5 +79,3 @@ bool common_header_initialize_for_reading(
        char **errmsg);
 
 void common_header_dump(const struct common_header *header, FILE *f);
-
-#endif
index 84a6c2f483e6ae929d066dc79f6f7e6fc1eafcd4..97157c976003b70fd8ee67ecfe8604151b768ed7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2016 Joel Rosdahl and other contributors
+// Copyright (C) 2010-2019 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef CCACHE_COMPOPT_H
-#define CCACHE_COMPOPT_H
+#pragma once
 
 #include "system.hpp"
 
@@ -31,5 +30,3 @@ bool compopt_takes_arg(const char *option);
 bool compopt_takes_concat_arg(const char *option);
 bool compopt_prefix_affects_cpp(const char *option);
 bool compopt_prefix_affects_comp(const char *option);
-
-#endif // CCACHE_COMPOPT_H
index 3cddb3de55320fc7bea0a9f081e3d5eb6bb5635f..b48be164367781b8e18eef4ca5bde78818f7f5aa 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef COMPRESSION_H
-#define COMPRESSION_H
+#pragma once
 
 #include "system.hpp"
 #include "third_party/xxhash.h"
@@ -93,5 +92,3 @@ enum compression_type compression_type_from_config(void);
 const char *compression_type_to_string(uint8_t type);
 struct compressor *compressor_from_type(uint8_t type);
 struct decompressor *decompressor_from_type(uint8_t type);
-
-#endif
index 5fc408150ce09bdcd142363e42ddcdc458b522af..792d48a9b0b90834eaf4f6991e24f7f005a4dccf 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef CONF_H
-#define CONF_H
+#pragma once
 
 #include "system.hpp"
 
@@ -73,5 +72,3 @@ bool conf_print_items(struct conf *conf,
                       void (*printer)(const char *descr, const char *origin,
                                       void *context),
                       void *context);
-
-#endif
index 8505d0997e60c77211884ecf3743a1f3f3cbc037..ae2f25344320d109e5a3022848b92d1dd318598e 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef CONFITEMS_H
-#define CONFITEMS_H
+#pragma once
 
 #include "system.hpp"
 
@@ -67,5 +66,3 @@ bool confitem_verify_dir_levels(const void *value, char **errmsg);
 
 const struct conf_item *confitems_get(const char *str, size_t len);
 size_t confitems_count(void);
-
-#endif
index 746cc97880175e6336cee36dd5d146799d930f04..43d334b607da565b5856535e5cd9af5a47739a37 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2016 Joel Rosdahl and other contributors
+// Copyright (C) 2010-2019 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef COUNTERS_H
-#define COUNTERS_H
+#pragma once
 
 #include <stddef.h>
 
@@ -30,5 +29,3 @@ struct counters {
 struct counters *counters_init(size_t initial_size);
 void counters_resize(struct counters *c, size_t new_size);
 void counters_free(struct counters *c);
-
-#endif
index 8e5553c37c698b0c588a4a5a02dd42d9b0328d02..425e38f808d4a8b3a1009824cdee8fa06e1c1788 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef ENVTOCONFITEMS_H
-#define ENVTOCONFITEMS_H
+#pragma once
 
 #include "system.hpp"
 
@@ -29,5 +28,3 @@ struct env_to_conf_item {
 const struct env_to_conf_item *envtoconfitems_get(const char *str, size_t len);
 
 size_t envtoconfitems_count(void);
-
-#endif
index 3f7f1eef999095558d61511605deda8759ce92a1..eb341b2f6c11065758c318befaa605218eb82478 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef HASH_H
-#define HASH_H
+#pragma once
 
 #include "system.hpp"
 
@@ -111,5 +110,3 @@ bool hash_fd(struct hash *hash, int fd);
 //
 // Returns true on success, otherwise false.
 bool hash_file(struct hash *hash, const char *fname);
-
-#endif
index 083f9892f3482a4824a3bc01fbcdb77324b06140..3a270ac4be0e8177cf5cc4b67e45694ce6ed093a 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef HASHUTIL_H
-#define HASHUTIL_H
+#pragma once
 
 #include "conf.hpp"
 #include "hash.hpp"
@@ -42,5 +41,3 @@ bool hash_command_output(struct hash *hash, const char *command,
                          const char *compiler);
 bool hash_multicommand_output(struct hash *hash, const char *command,
                               const char *compiler);
-
-#endif
index fb75c0aed75854e92739675dac6ce840492391ea..f119ece867414e4424f1caf821fec021cd8ef806 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2016 Joel Rosdahl and other contributors
+// Copyright (C) 2010-2019 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef CCACHE_LANGUAGE_H
-#define CCACHE_LANGUAGE_H
+#pragma once
 
 #include <stdbool.h>
 
@@ -26,5 +25,3 @@ const char *p_language_for_language(const char *language);
 const char *extension_for_language(const char *language);
 bool language_is_supported(const char *language);
 bool language_is_preprocessed(const char *language);
-
-#endif // CCACHE_LANGUAGE_H
index b580afb38a5eb9a5cce0fca5eb5bbf026c43e1c0..52a06b143033457a5aa877525c2c61ac1d05bf10 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2016 Joel Rosdahl and other contributors
+// Copyright (C) 2010-2019 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef CCACHE_MACROSKIP_H
-#define CCACHE_MACROSKIP_H
+#pragma once
 
 #include <stdint.h>
 
@@ -75,5 +74,3 @@ static const uint32_t macro_skip[] = {
        8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
        8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
 };
-
-#endif
index 7bbc7c127da75f04b314298661a55e1fcc4866a3..4fe9e0c7fd6b772e6ac59359420fd8c55950dc1f 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef MANIFEST_H
-#define MANIFEST_H
+#pragma once
 
 #include "conf.hpp"
 #include "hashutil.hpp"
@@ -30,5 +29,3 @@ struct digest *manifest_get(struct conf *conf, const char *manifest_path);
 bool manifest_put(const char *manifest_path, struct digest *result_digest,
                   struct hashtable *included_files);
 bool manifest_dump(const char *manifest_path, FILE *stream);
-
-#endif
index 8e059ef48a7f7aa4a4819dd1150fe2f7bd46486a..20212b60cf638611bf6652bba67f5480d688534b 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef RESULT_H
-#define RESULT_H
+#pragma once
 
 #include "conf.hpp"
 
@@ -35,5 +34,3 @@ void result_files_free(struct result_files *c);
 bool result_get(const char *path, struct result_files *list);
 bool result_put(const char *path, struct result_files *list);
 bool result_dump(const char *path, FILE *stream);
-
-#endif
index 2c1d6a0cb088d1532251e504ffa793ab4c078722..72a98dbf99baf5c0291f71aaf6114a339faf2cee 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef CCACHE_SYSTEM_H
-#define CCACHE_SYSTEM_H
+#pragma once
 
 #ifdef __MINGW32__
 #  define __USE_MINGW_ANSI_STDIO 1
@@ -91,5 +90,3 @@ extern "C" {
 #endif
 
 } // extern "C"
-
-#endif // CCACHE_SYSTEM_H
index 4d0e53f48ac25535a2122805b134b236b0dbf402..eb6e6c4b79cbf6cdf439726e76900b547d958ad5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2018 Joel Rosdahl and other contributors
+// Copyright (C) 2018-2019 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef UNIFY_H
-#define UNIFY_H
+#pragma once
 
 #include "hash.hpp"
 
 int unify_hash(struct hash *hash, const char *fname, bool print);
-
-#endif
index b812b5b5e926302b325f455976138a23a453a733..77034410125e6f4f1fdf0cca9fdb7af948129ecd 100644 (file)
@@ -16,8 +16,7 @@
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef TEST_FRAMEWORK_H
-#define TEST_FRAMEWORK_H
+#pragma once
 
 #include "../src/ccache.hpp"
 
@@ -164,5 +163,3 @@ bool cct_check_args_eq(const char *file, int line, const char *expression,
 void cct_chdir(const char *path);
 void cct_wipe(const char *path);
 void cct_create_fresh_dir(const char *path);
-
-#endif
index 7a62bae42b27028398b069152c526e73d3c41c3e..275b7c425304fb70be3779fe223552fcbdbcd1e7 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2010-2018 Joel Rosdahl and other contributors
+// Copyright (C) 2010-2019 Joel Rosdahl and other contributors
 //
 // See doc/AUTHORS.adoc for a complete list of contributors.
 //
 // this program; if not, write to the Free Software Foundation, Inc., 51
 // Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
-#ifndef TEST_UTIL_H
-#define TEST_UTIL_H
+#pragma once
 
 #include <stdbool.h>
 
 bool path_exists(const char *path);
 bool is_symlink(const char *path);
 void create_file(const char *path, const char *content);
-
-#endif