It seems to be supported by all reasonably modern compilers now.
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
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
// 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"
#ifndef MIN
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#endif
-
-#endif // ifndef CCACHE_H
// 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"
char **errmsg);
void common_header_dump(const struct common_header *header, FILE *f);
-
-#endif
-// 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.
//
// 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"
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
// 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"
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
// 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"
void (*printer)(const char *descr, const char *origin,
void *context),
void *context);
-
-#endif
// 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"
const struct conf_item *confitems_get(const char *str, size_t len);
size_t confitems_count(void);
-
-#endif
-// 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.
//
// 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>
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
// 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"
const struct env_to_conf_item *envtoconfitems_get(const char *str, size_t len);
size_t envtoconfitems_count(void);
-
-#endif
// 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"
//
// Returns true on success, otherwise false.
bool hash_file(struct hash *hash, const char *fname);
-
-#endif
// 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"
const char *compiler);
bool hash_multicommand_output(struct hash *hash, const char *command,
const char *compiler);
-
-#endif
-// 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.
//
// 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>
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
-// 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.
//
// 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>
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
// 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"
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
// 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"
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
// 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
#endif
} // extern "C"
-
-#endif // CCACHE_SYSTEM_H
-// 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
// 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"
void cct_chdir(const char *path);
void cct_wipe(const char *path);
void cct_create_fresh_dir(const char *path);
-
-#endif
-// 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