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 "-Wunused-parameter"
27 #pragma clang diagnostic ignored "-Wshadow"
28 #elif defined(__GNUC__)
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wconversion"
31 #pragma GCC diagnostic ignored "-Wshadow"
32 #pragma GCC diagnostic ignored "-Wunused-parameter"
33 #elif defined(_MSC_VER)
34 #pragma warning(push)
35 #pragma warning(disable : 4244)
36 #endif
37 
38 // The following should be the only place in the project where protobuf files
39 // are directly included.  This is so that they can be compiled in a manner
40 // where warnings are ignored.
41 
42 #include "google/protobuf/util/json_util.h"
43 #include "google/protobuf/util/message_differencer.h"
44 #include "source/fuzz/protobufs/spvtoolsfuzz.pb.h"
45 
46 #if defined(__clang__)
47 #pragma clang diagnostic pop
48 #elif defined(__GNUC__)
49 #pragma GCC diagnostic pop
50 #elif defined(_MSC_VER)
51 #pragma warning(pop)
52 #endif
53 
54 #endif  // SOURCE_FUZZ_SPIRVFUZZ_PROTOBUFS_H_
55