Add #include <config.h> to the beginning of all cc files

Added
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
to the beginning of all source files that didn't have it.

This ensures that configuration options are respected in all source
files. In particular, it ensures that the defines needed to fix Large
File System issues are set before including system headers.

More generally, it ensures consistency between the source files, and
avoids the possibility of ODR violations between source files that were
including config.h and source files that were not.

Process:
Ran
find . \( -name third_party -prune \) -o \( -name '.git*' -prune \) -o \( \( -name '*.cc' -o -name '*.c' \) -exec sed -i '0,/^#include/ s/^#include/#ifdef HAVE_CONFIG_H\n#include <config.h>  \/\/ Must come first\n#endif\n\n#include/' {} + \)
and then manually fixed up src/common/linux/guid_creator.cc,
src/tools/solaris/dump_syms/testdata/dump_syms_regtest.cc,
src/tools/windows/dump_syms/testdata/dump_syms_regtest.cc,
src/common/stabs_reader.h, and src/common/linux/breakpad_getcontext.h.

BUG=google-breakpad:877
Fixed: google-breakpad:877
TEST=./configure && make && make check
TEST=Did the find/sed in ChromeOS's copy, ensured emerge-hana google-breakpad
worked and had fewer LFS violations.
TEST=Did the find/sed in Chrome's copy, ensured compiling hana, windows, linux, and
eve still worked (since Chrome doesn't used config.h)

Change-Id: I16cededbba0ea0c28e919b13243e35300999e799
Reviewed-on: https://chromium-review.googlesource.com/c/breakpad/breakpad/+/4289676
Reviewed-by: Mike Frysinger <vapier@chromium.org>
This commit is contained in:
Ian Barkley-Yeung 2023-02-24 11:14:53 -08:00
parent abb105db21
commit f5123d7196
264 changed files with 1046 additions and 9 deletions

View file

@ -30,6 +30,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <limits.h>
#include <stdio.h>

View file

@ -33,6 +33,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/basic_code_modules.h"
#include <assert.h>

View file

@ -31,6 +31,10 @@
// See basic_source_line_resolver.h and basic_source_line_resolver_types.h
// for documentation.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include <stdio.h>
#include <string.h>

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include <stdio.h>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/stack_frame.h"

View file

@ -31,6 +31,10 @@
// cfi_frame_info.cc: Implementation of CFIFrameInfo class.
// See cfi_frame_info.h for details.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/cfi_frame_info.h"
#include <string.h>

View file

@ -31,6 +31,10 @@
// cfi_frame_info_unittest.cc: Unit tests for CFIFrameInfo,
// CFIRuleParser, CFIFrameInfoParseHandler, and SimpleCFIWalker.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include "breakpad_googletest_includes.h"

View file

@ -30,6 +30,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include "processor/contained_range_map-inl.h"

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/convert_old_arm64_context.h"
#include <string.h>

View file

@ -30,6 +30,10 @@
//
// Author: Mark Brand
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/disassembler_objdump.h"
#include <unistd.h>

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <unistd.h>
#include <vector>

View file

@ -33,6 +33,10 @@
//
// Author: Cris Neckar
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/disassembler_x86.h"
#include <string.h>

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <unistd.h>
#include "breakpad_googletest_includes.h"

View file

@ -30,6 +30,10 @@
//
// See dump_context.h for documentation.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/dump_context.h"
#include <assert.h>

View file

@ -28,6 +28,10 @@
// dump_object.cc: A base class for all mini/micro dump object.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/dump_object.h"
namespace google_breakpad {

View file

@ -33,6 +33,10 @@
// Author: Cris Neckar
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <cassert>
#include "common/scoped_ptr.h"

View file

@ -33,6 +33,10 @@
//
// Author: Matthew Riley
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/exploitability_linux.h"
#include <string.h>

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdlib.h>
#include <unistd.h>

View file

@ -33,6 +33,10 @@
//
// Author: Cris Neckar
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <vector>
#include "processor/exploitability_win.h"

View file

@ -36,6 +36,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/fast_source_line_resolver.h"
#include "processor/fast_source_line_resolver_types.h"

View file

@ -36,6 +36,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include <stdio.h>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include <errno.h>
#include <string.h>

View file

@ -31,6 +31,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <climits>
#include <map>
#include <string>

View file

@ -30,6 +30,10 @@
//
// See microdump.h for documentation.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/microdump.h"
#include <stdio.h>

View file

@ -30,6 +30,10 @@
//
// See microdump_processor.h for documentation.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/microdump_processor.h"
#include <assert.h>

View file

@ -28,6 +28,10 @@
// Unit test for MicrodumpProcessor.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <fstream>
#include <iostream>
#include <string>

View file

@ -29,6 +29,10 @@
// microdump_stackwalk.cc: Process a microdump with MicrodumpProcessor, printing
// the results, including stack traces.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include <string.h>
#include <unistd.h>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/minidump.h"
#include <assert.h>

View file

@ -31,6 +31,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include <string.h>
#include <unistd.h>

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/minidump_processor.h"
#include <assert.h>

View file

@ -29,6 +29,10 @@
// Unit test for MinidumpProcessor. Uses a pre-generated minidump and
// corresponding symbol file, and checks the stack frames for correctness.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdlib.h>
#include <string>

View file

@ -31,6 +31,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include <string.h>
#include <unistd.h>

View file

@ -29,6 +29,10 @@
// Unit test for Minidump. Uses a pre-generated minidump and
// verifies that certain streams are correct.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <iostream>
#include <fstream>
#include <sstream>

View file

@ -31,6 +31,10 @@
//
// Author: lambxsy@google.com (Siyang Xie)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/module_comparer.h"
#include <map>

View file

@ -32,6 +32,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/module_serializer.h"
#include <map>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/pathname_stripper.h"
namespace google_breakpad {

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include "processor/pathname_stripper.h"

View file

@ -30,6 +30,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include <stdio.h>

View file

@ -6,6 +6,10 @@
#define __STDC_FORMAT_MACROS
#endif
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/proc_maps_linux.h"
#include <fcntl.h>

View file

@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "breakpad_googletest_includes.h"
#include "common/using_std_string.h"
#include "google_breakpad/processor/proc_maps_linux.h"

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/process_state.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <limits.h>
#include <stdio.h>

View file

@ -31,6 +31,10 @@
//
// Author: Ivan Penkov
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <limits.h>
#include <stdio.h>

View file

@ -31,6 +31,10 @@
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <limits.h>
#include <stdio.h>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/simple_symbol_supplier.h"
#include <assert.h>

View file

@ -33,6 +33,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>

View file

@ -32,6 +32,10 @@
//
// Author: Colin Blundell
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/stack_frame_cpu.h"
namespace google_breakpad {

View file

@ -31,6 +31,10 @@
// line information in a stack frame, and also looks up WindowsFrameInfo or
// CFIFrameInfo for a stack frame.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/stack_frame_symbolizer.h"
#include <assert.h>

View file

@ -31,6 +31,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/stackwalk_common.h"
#include <assert.h>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/stackwalker.h"
#include <assert.h>

View file

@ -32,6 +32,10 @@
//
// Author: Chris Hamilton <chrisha@chromium.org>
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include <vector>

View file

@ -31,6 +31,10 @@
//
// Author: Chris Hamilton <chrisha@chromium.org>
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string>
#include <vector>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai, Ted Mielczarek
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include "common/scoped_ptr.h"

View file

@ -30,6 +30,10 @@
// stackwalker_amd64_unittest.cc: Unit tests for StackwalkerAMD64 class.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>
#include <vector>

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai, Ted Mielczarek, Jim Blandy
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <vector>
#include "common/scoped_ptr.h"

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai, Ted Mielczarek, Jim Blandy, Colin Blundell
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <vector>
#include "common/scoped_ptr.h"

View file

@ -30,6 +30,10 @@
// stackwalker_arm64_unittest.cc: Unit tests for StackwalkerARM64 class.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>
#include <vector>

View file

@ -30,6 +30,10 @@
// stackwalker_arm_unittest.cc: Unit tests for StackwalkerARM class.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>
#include <vector>

View file

@ -32,6 +32,10 @@
//
// Author: Tata Elxsi
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"

View file

@ -31,6 +31,10 @@
// stackwalker_mips64_unittest.cc: Unit tests for StackwalkerMIPS class for
// mips64 platforms.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>
#include <vector>

View file

@ -30,6 +30,10 @@
// stackwalker_mips_unittest.cc: Unit tests for StackwalkerMIPS class.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>
#include <vector>

View file

@ -33,6 +33,10 @@
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "common/scoped_ptr.h"
#include "processor/stackwalker_ppc.h"
#include "google_breakpad/processor/call_stack.h"

View file

@ -31,6 +31,10 @@
// See stackwalker_ppc64.h for documentation.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "common/scoped_ptr.h"
#include "processor/stackwalker_ppc64.h"
#include "google_breakpad/processor/call_stack.h"

View file

@ -33,6 +33,10 @@
* Author: Iacopo Colonnelli
*/
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"

View file

@ -33,6 +33,10 @@
* Author: Iacopo Colonnelli
*/
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "common/scoped_ptr.h"
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/code_modules.h"

View file

@ -31,6 +31,10 @@
* Author: Iacopo Colonnelli
*/
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>
#include <vector>

View file

@ -31,6 +31,10 @@
* Author: Iacopo Colonnelli
*/
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>
#include <vector>

View file

@ -48,6 +48,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include "processor/logging.h"

View file

@ -33,6 +33,10 @@
// Author: Michael Shang
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "google_breakpad/processor/call_stack.h"
#include "google_breakpad/processor/memory_region.h"
#include "google_breakpad/processor/stack_frame_cpu.h"

View file

@ -32,6 +32,10 @@
//
// Author: Mark Mentovai
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <assert.h>
#include <string>

View file

@ -30,6 +30,10 @@
// stackwalker_x86_unittest.cc: Unit tests for StackwalkerX86 class.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string>
#include <vector>

View file

@ -30,6 +30,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <climits>
#include <cstdlib>
#include <ctime>

View file

@ -31,6 +31,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "breakpad_googletest_includes.h"
#include "common/scoped_ptr.h"
#include "processor/contained_range_map-inl.h"

View file

@ -30,6 +30,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <climits>
#include <map>

View file

@ -30,6 +30,10 @@
//
// Author: Siyang Xie (lambxsy@google.com)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "breakpad_googletest_includes.h"
#include "common/scoped_ptr.h"
#include "processor/range_map-inl.h"

View file

@ -32,6 +32,10 @@
//
// Author: Ben Wagner
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string>
#include "common/stdio_wrapper.h"

View file

@ -30,6 +30,10 @@
// synth_minidump.cc: Implementation of SynthMinidump. See synth_minidump.h
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include "processor/synth_minidump.h"
namespace google_breakpad {

View file

@ -31,6 +31,10 @@
// synth_minidump_unittest.cc: Unit tests for google_breakpad::SynthMinidump
// classes.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <sstream>
#include <string>

View file

@ -38,6 +38,10 @@
// generate an executable with STABS symbols (needs -m32), or -gdwarf-2 for one
// with DWARF symbols (32- or 64-bit)
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

View file

@ -31,6 +31,10 @@
// google_breakpad/src/client/windows/releasestaticcrt/exception_handler.lib
// Then run test_app to generate a dump, and dump_syms to create the .sym file.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <stdio.h>
#include "client/windows/handler/exception_handler.h"

View file

@ -26,6 +26,10 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifdef HAVE_CONFIG_H
#include <config.h> // Must come first
#endif
#include <string.h>
#include <string>