blob: 3316607d4fe28a557494dc74586973dc58362dea [file] [log] [blame]
Alexei Frolov1a82c142019-10-31 17:37:12 -07001# Copyright 2019 The Pigweed Authors
2#
3# Licensed under the Apache License, Version 2.0 (the "License"); you may not
4# use this file except in compliance with the License. You may obtain a copy of
5# the License at
6#
7# https://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, WITHOUT
11# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12# License for the specific language governing permissions and limitations under
13# the License.
14
15# Standard compiler flags to reduce output binary size.
16config("reduced_size") {
17 cflags = [
18 "-fno-common",
19 "-fno-exceptions",
20 "-ffunction-sections",
21 "-fdata-sections",
22 ]
23 cflags_cc = [ "-fno-rtti" ]
24}
25
26config("strict_warnings") {
27 cflags = [
28 "-Wall",
29 "-Wextra",
Keir Mierle243e32a2019-11-05 10:29:26 -080030
Wyatt Hepler979890d2019-11-06 17:17:45 -080031 # Make all warnings errors, except for the exemptions below.
32 "-Werror",
33 "-Wno-error=cpp", # preprocessor #warning statement
34 "-Wno-error=deprecated-declarations", # [[deprecated]] attribute
Alexei Frolov1a82c142019-10-31 17:37:12 -070035 ]
Wyatt Hepler1919c642019-12-06 10:06:13 -080036 cflags_cc = [ "-Wnon-virtual-dtor" ]
Alexei Frolov1a82c142019-10-31 17:37:12 -070037}
38
39config("cpp17") {
Wyatt Hepler979890d2019-11-06 17:17:45 -080040 cflags_cc = [
41 "-std=c++17",
42
43 # Allow uses of the register keyword, which may appear in C headers.
44 "-Wno-register",
45 ]
Alexei Frolov1a82c142019-10-31 17:37:12 -070046}
47
48# Default C++ version for Pigweed modules.
49config("pw_default_cpp") {
50 configs = [ ":cpp17" ]
51}