Commit 0d6b9704 authored by Kenton Varda's avatar Kenton Varda

Force headers to be treated as system headers when included by application code.

This prevents the compiler from reporting warnings in these headers while compiling application code. Hopefully this will stem the never-ending stream of complaints from people who enable pedantic warnings.
parent e7828642
......@@ -33,7 +33,7 @@ clean-local:
cd gtest && $(MAKE) $(AM_MAKEFLAGS) clean; \
fi
AM_CXXFLAGS = -I$(srcdir)/src -I$(builddir)/src -DCAPNP_INCLUDE_DIR='"$(includedir)"' $(PTHREAD_CFLAGS)
AM_CXXFLAGS = -I$(srcdir)/src -I$(builddir)/src -DKJ_HEADER_WARNINGS -DCAPNP_HEADER_WARNINGS -DCAPNP_INCLUDE_DIR='"$(includedir)"' $(PTHREAD_CFLAGS)
AM_LDFLAGS = $(PTHREAD_CFLAGS)
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_ANY_H_
#define CAPNP_ANY_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "layout.h"
#include "pointer-helpers.h"
#include "orphan.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_ARENA_H_
#define CAPNP_ARENA_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#ifndef CAPNP_PRIVATE
#error "This header is only meant to be included by Cap'n Proto's own source code."
#endif
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_BENCHMARK_CAPNP_COMMON_H_
#define CAPNP_BENCHMARK_CAPNP_COMMON_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
#include <capnp/serialize.h>
#include <capnp/serialize-packed.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_BENCHMARK_COMMON_H_
#define CAPNP_BENCHMARK_COMMON_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <unistd.h>
#include <limits>
#include <errno.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_BLOB_H_
#define CAPNP_BLOB_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <kj/common.h>
#include <kj/string.h>
#include "common.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_CAPABILITY_H_
#define CAPNP_CAPABILITY_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#if CAPNP_LITE
#error "RPC APIs, including this header, are not available in lite mode."
#endif
......
......@@ -26,6 +26,10 @@
#ifndef CAPNP_COMMON_H_
#define CAPNP_COMMON_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <kj/units.h>
#include <inttypes.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_COMPILER_COMPILER_H_
#define CAPNP_COMPILER_COMPILER_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <capnp/compiler/grammar.capnp.h>
#include <capnp/schema.capnp.h>
#include <capnp/schema-loader.h>
......
......@@ -22,6 +22,10 @@
#ifndef ERROR_REPORTER_H_
#define ERROR_REPORTER_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "../common.h"
#include <kj/string.h>
#include <kj/exception.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_COMPILER_LEXER_H_
#define CAPNP_COMPILER_LEXER_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <capnp/compiler/lexer.capnp.h>
#include <kj/parse/common.h>
#include <kj/arena.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_COMPILER_MODULE_LOADER_H_
#define CAPNP_COMPILER_MODULE_LOADER_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "compiler.h"
#include "error-reporter.h"
#include <kj/memory.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_COMPILER_NODE_TRANSLATOR_H_
#define CAPNP_COMPILER_NODE_TRANSLATOR_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <capnp/orphan.h>
#include <capnp/compiler/grammar.capnp.h>
#include <capnp/schema.capnp.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_COMPILER_PARSER_H_
#define CAPNP_COMPILER_PARSER_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <capnp/compiler/grammar.capnp.h>
#include <capnp/compiler/lexer.capnp.h>
#include <kj/parse/common.h>
......
......@@ -33,6 +33,10 @@
#ifndef CAPNP_DYNAMIC_H_
#define CAPNP_DYNAMIC_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "schema.h"
#include "layout.h"
#include "message.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_ENDIAN_H_
#define CAPNP_ENDIAN_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
#include <inttypes.h>
#include <string.h> // memcpy
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_EZ_RPC_H_
#define CAPNP_EZ_RPC_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "rpc.h"
#include "message.h"
......
......@@ -24,6 +24,10 @@
#ifndef CAPNP_GENERATED_HEADER_SUPPORT_H_
#define CAPNP_GENERATED_HEADER_SUPPORT_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "layout.h"
#include "list.h"
#include "orphan.h"
......
......@@ -29,6 +29,10 @@
#ifndef CAPNP_LAYOUT_H_
#define CAPNP_LAYOUT_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <kj/common.h>
#include <kj/memory.h>
#include "common.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_LIST_H_
#define CAPNP_LIST_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "layout.h"
#include "orphan.h"
#include <initializer_list>
......
......@@ -29,6 +29,10 @@
#ifndef CAPNP_MESSAGE_H_
#define CAPNP_MESSAGE_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
namespace capnp {
namespace _ { // private
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_ORPHAN_H_
#define CAPNP_ORPHAN_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "layout.h"
namespace capnp {
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_POINTER_HELPERS_H_
#define CAPNP_POINTER_HELPERS_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "layout.h"
#include "list.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_PRETTY_PRINT_H_
#define CAPNP_PRETTY_PRINT_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "dynamic.h"
#include <kj/string-tree.h>
......
......@@ -25,6 +25,10 @@
#ifndef CAPNP_RPC_PRELUDE_H_
#define CAPNP_RPC_PRELUDE_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "capability.h"
#include "persistent.capnp.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_RPC_TWOPARTY_H_
#define CAPNP_RPC_TWOPARTY_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "rpc.h"
#include "message.h"
#include <kj/async-io.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_RPC_H_
#define CAPNP_RPC_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "capability.h"
#include "rpc-prelude.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_SCHEMA_LITE_H_
#define CAPNP_SCHEMA_LITE_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <capnp/schema.capnp.h>
#include "message.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_SCHEMA_LOADER_H_
#define CAPNP_SCHEMA_LOADER_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "schema.h"
#include <kj/memory.h>
#include <kj/mutex.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_SCHEMA_PARSER_H_
#define CAPNP_SCHEMA_PARSER_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "schema-loader.h"
#include <kj/string.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_SCHEMA_H_
#define CAPNP_SCHEMA_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#if CAPNP_LITE
#error "Reflection APIs, including this header, are not available in lite mode."
#endif
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_SERIALIZE_ASYNC_H_
#define CAPNP_SERIALIZE_ASYNC_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <kj/async-io.h>
#include "message.h"
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_SERIALIZE_PACKED_H_
#define CAPNP_SERIALIZE_PACKED_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "serialize.h"
namespace capnp {
......
......@@ -41,6 +41,10 @@
#ifndef CAPNP_SERIALIZE_H_
#define CAPNP_SERIALIZE_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "message.h"
#include <kj/io.h>
......
......@@ -22,6 +22,10 @@
#ifndef CAPNP_TEST_UTIL_H_
#define CAPNP_TEST_UTIL_H_
#if defined(__GNUC__) && !CAPNP_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <capnp/test.capnp.h>
#include <iostream>
#include "blob.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_ARENA_H_
#define KJ_ARENA_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "memory.h"
#include "array.h"
#include "string.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_ARRAY_H_
#define KJ_ARRAY_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
#include <string.h>
#include <initializer_list>
......
......@@ -31,6 +31,10 @@
#ifndef KJ_ASYNC_INL_H_
#define KJ_ASYNC_INL_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
namespace kj {
namespace _ { // private
......
......@@ -22,6 +22,10 @@
#ifndef KJ_ASYNC_IO_H_
#define KJ_ASYNC_IO_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "async.h"
#include "function.h"
#include "thread.h"
......
......@@ -25,6 +25,10 @@
#ifndef KJ_ASYNC_PRELUDE_H_
#define KJ_ASYNC_PRELUDE_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "exception.h"
namespace kj {
......
......@@ -22,6 +22,10 @@
#ifndef KJ_ASYNC_UNIX_H_
#define KJ_ASYNC_UNIX_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "async.h"
#include "time.h"
#include "vector.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_ASYNC_H_
#define KJ_ASYNC_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "async-prelude.h"
#include "exception.h"
#include "refcount.h"
......
......@@ -26,6 +26,10 @@
#ifndef KJ_COMMON_H_
#define KJ_COMMON_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#ifndef KJ_NO_COMPILER_CHECK
#if __cplusplus < 201103L && !__CDT_PARSER__
#error "This code requires C++11. Either your compiler does not support it or it is not enabled."
......
......@@ -107,6 +107,10 @@
#ifndef KJ_DEBUG_H_
#define KJ_DEBUG_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "string.h"
#include "exception.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_EXCEPTION_H_
#define KJ_EXCEPTION_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "memory.h"
#include "array.h"
#include "string.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_FUNCTION_H_
#define KJ_FUNCTION_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "memory.h"
namespace kj {
......
......@@ -22,6 +22,10 @@
#ifndef KJ_IO_H_
#define KJ_IO_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <stddef.h>
#include "common.h"
#include "array.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_MAIN_H_
#define KJ_MAIN_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "array.h"
#include "string.h"
#include "vector.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_MEMORY_H_
#define KJ_MEMORY_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
namespace kj {
......
......@@ -22,6 +22,10 @@
#ifndef KJ_MUTEX_H_
#define KJ_MUTEX_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "memory.h"
#include <inttypes.h>
......
......@@ -22,6 +22,10 @@
#ifndef KJ_ONE_OF_H_
#define KJ_ONE_OF_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
namespace kj {
......
......@@ -25,6 +25,10 @@
#ifndef KJ_PARSE_CHAR_H_
#define KJ_PARSE_CHAR_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
#include "../string.h"
#include <inttypes.h>
......
......@@ -36,6 +36,10 @@
#ifndef KJ_PARSE_COMMON_H_
#define KJ_PARSE_COMMON_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "../common.h"
#include "../memory.h"
#include "../array.h"
......
......@@ -24,6 +24,10 @@
#ifndef KJ_REFCOUNT_H_
#define KJ_REFCOUNT_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
namespace kj {
class Refcounted: private Disposer {
......
......@@ -26,6 +26,10 @@
#ifndef KJ_STD_IOSTREAM_H_
#define KJ_STD_IOSTREAM_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <iostream>
#include "../io.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_STRING_TREE_H_
#define KJ_STRING_TREE_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "string.h"
namespace kj {
......
......@@ -22,6 +22,10 @@
#ifndef KJ_STRING_H_
#define KJ_STRING_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include <initializer_list>
#include "array.h"
#include <string.h>
......
......@@ -22,6 +22,10 @@
#ifndef KJ_THREAD_H_
#define KJ_THREAD_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
#include "function.h"
#include "exception.h"
......
......@@ -22,6 +22,10 @@
#ifndef KJ_THREADLOCAL_H_
#define KJ_THREADLOCAL_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
// This file declares a macro `KJ_THREADLOCAL_PTR` for declaring thread-local pointer-typed
// variables. Use like:
// KJ_THREADLOCAL_PTR(MyType) foo = nullptr;
......
......@@ -23,6 +23,10 @@
#ifndef KJ_TIME_H_
#define KJ_TIME_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "async.h"
#include "units.h"
#include <inttypes.h>
......
......@@ -38,6 +38,10 @@
#ifndef KJ_TUPLE_H_
#define KJ_TUPLE_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
namespace kj {
......
......@@ -26,6 +26,10 @@
#ifndef KJ_UNITS_H_
#define KJ_UNITS_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "common.h"
namespace kj {
......
......@@ -22,6 +22,10 @@
#ifndef KJ_VECTOR_H_
#define KJ_VECTOR_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#include "array.h"
namespace kj {
......
......@@ -22,6 +22,10 @@
#ifndef KJ_WINDOWS_SANITY_H_
#define KJ_WINDOWS_SANITY_H_
#if defined(__GNUC__) && !KJ_HEADER_WARNINGS
#pragma GCC system_header
#endif
#ifndef _INC_WINDOWS
#error "windows.h needs to be included before kj/windows-sanity.h (or perhaps you don't need either?)"
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment