C/C++ API Reference
Loading...
Searching...
No Matches
bloat_this_binary.h
1// 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#pragma once
15
16#include <cstdint>
17
19namespace pw::bloat {
20
21// Function providing fundamental C/C++ functions to prevent them from appearing
22// in size reports. Must be called in binaries which are compared to the bloat
23// base in order to get accurate reports.
24void BloatThisBinary();
25
27
32[[maybe_unused]] constexpr uint32_t kDefaultMask = ~0u;
33
51#define PW_BLOAT_COND(cond, mask) \
52 do { \
53 if ((mask & 1) != 0 && (cond)) { \
54 mask = (mask >> 1) | 0x8000000; \
55 } else { \
56 mask >>= 1; \
57 } \
58 } while (0)
59
78#define PW_BLOAT_EXPR(expr, mask) \
79 do { \
80 if ((mask & 1) != 0) { \
81 (expr); \
82 mask = (mask >> 1) | 0x8000000; \
83 } else { \
84 mask >>= 1; \
85 } \
86 } while (0)
87
88} // namespace pw::bloat
constexpr uint32_t kDefaultMask
Definition: bloat_this_binary.h:32
Binary size reports library.
Definition: bloat_this_binary.h:19