Skip to content

Commit

Permalink
Allow to include pretty printers only once
Browse files Browse the repository at this point in the history
* some linkers will include the section many times in the executable,
  resulting in increased load time and warning messages inside gdb
* allows including them only once by defining
  BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS, and including the printers.hpp
  file only once.

Signed-off-by: Julien Blanc <julien.blanc@tgcm.eu>
  • Loading branch information
Julien-Blanc-tgcm authored and grisumbras committed Sep 23, 2024
1 parent 906bf1a commit 743be7f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
14 changes: 14 additions & 0 deletions include/boost/json/debug_printers.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// Copyright (c) 2024 Julien Blanc (julien.blanc@tgcm.eu)
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// Official repository: https://github.com/boostorg/json
//

#ifndef BOOST_JSON_DEBUG_PRINTERS_HPP

#include <boost/json/detail/gdb_printers.hpp>

#endif
2 changes: 2 additions & 0 deletions include/boost/json/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ constexpr T static_const<T>::value;
# define BOOST_JSON_DEPRECATED(x)
#endif

#ifndef BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS
#include <boost/json/detail/gdb_printers.hpp>
#endif

#endif
4 changes: 0 additions & 4 deletions include/boost/json/detail/gdb_printers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
#ifndef BOOST_JSON_DETAIL_GDB_PRINTERS_HPP
#define BOOST_JSON_DETAIL_GDB_PRINTERS_HPP

#ifndef BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS

#if defined(__ELF__)

#if defined(__clang__)
Expand Down Expand Up @@ -343,6 +341,4 @@ __asm__(

#endif // defined(__ELF__)

#endif // BOOST_ALL_NO_EMBEDDED_GDB_SCRIPTS

#endif // BOOST_JSON_DETAIL_GDB_PRINTERS_HPP

0 comments on commit 743be7f

Please sign in to comment.