• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2019 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef SOURCE_FUZZ_SPIRVFUZZ_PROTOBUFS_H_
16 #define SOURCE_FUZZ_SPIRVFUZZ_PROTOBUFS_H_
17 
18 // This header file serves to act as a barrier between the protobuf header
19 // files and files that include them.  It uses compiler pragmas to disable
20 // diagnostics, in order to ignore warnings generated during the processing
21 // of these header files without having to compromise on freedom from warnings
22 // in the rest of the project.
23 
24 #if defined(__clang__)
25 #pragma clang diagnostic push
26 #pragma clang diagnostic ignored "-Wunknown-warning-option"  // Must come first
27 #pragma clang diagnostic ignored "-Wreserved-identifier"
28 #pragma clang diagnostic ignored "-Wshadow"
29 #pragma clang diagnostic ignored "-Wsuggest-destructor-override"
30 #pragma clang diagnostic ignored "-Wunused-parameter"
31 #elif defined(__GNUC__)
32 #pragma GCC diagnostic push
33 #pragma GCC diagnostic ignored "-Wconversion"
34 #pragma GCC diagnostic ignored "-Wshadow"
35 #pragma GCC diagnostic ignored "-Wunused-parameter"
36 #elif defined(_MSC_VER)
37 #pragma warning(push)
38 #pragma warning(disable : 4244)
39 #endif
40 
41 // The following should be the only place in the project where protobuf files
42 // are directly included.  This is so that they can be compiled in a manner
43 // where warnings are ignored.
44 
45 #include "google/protobuf/util/json_util.h"
46 #include "google/protobuf/util/message_differencer.h"
47 #include "source/fuzz/protobufs/spvtoolsfuzz.pb.h"
48 
49 #if defined(__clang__)
50 #pragma clang diagnostic pop
51 #elif defined(__GNUC__)
52 #pragma GCC diagnostic pop
53 #elif defined(_MSC_VER)
54 #pragma warning(pop)
55 #endif
56 
57 #endif  // SOURCE_FUZZ_SPIRVFUZZ_PROTOBUFS_H_
58