diff --git a/common/api/api_plugin.cpp b/common/api/api_plugin.cpp index 5ae559be4b..8b5df5b550 100644 --- a/common/api/api_plugin.cpp +++ b/common/api/api_plugin.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include #include diff --git a/common/design_block.h b/common/design_block.h index 533c3008b2..a08b172ad3 100644 --- a/common/design_block.h +++ b/common/design_block.h @@ -27,7 +27,7 @@ #include #include -#include +#include class KICOMMON_API DESIGN_BLOCK diff --git a/common/dialogs/dialog_design_block_properties.h b/common/dialogs/dialog_design_block_properties.h index 00fd46355e..ae65da6b0e 100644 --- a/common/dialogs/dialog_design_block_properties.h +++ b/common/dialogs/dialog_design_block_properties.h @@ -26,7 +26,7 @@ #define DIALOG_DESIGN_BLOCK_PROPERTIES_H #include -#include +#include class SCH_EDIT_FRAME; class DESIGN_BLOCK; diff --git a/common/gal/color4d.cpp b/common/gal/color4d.cpp index 4ed718dc9f..31504b72ca 100644 --- a/common/gal/color4d.cpp +++ b/common/gal/color4d.cpp @@ -24,7 +24,7 @@ */ #include -#include +#include #include #include #include diff --git a/common/http_lib/http_lib_connection.cpp b/common/http_lib/http_lib_connection.cpp index 6cfe81d992..28b27a150b 100644 --- a/common/http_lib/http_lib_connection.cpp +++ b/common/http_lib/http_lib_connection.cpp @@ -24,7 +24,7 @@ #include #include -#include +#include #include #include diff --git a/common/http_lib/http_lib_settings.cpp b/common/http_lib/http_lib_settings.cpp index 03a52a4f93..40ccd13c9f 100644 --- a/common/http_lib/http_lib_settings.cpp +++ b/common/http_lib/http_lib_settings.cpp @@ -22,7 +22,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include #include #include diff --git a/common/io/easyeda/easyeda_parser_structs.h b/common/io/easyeda/easyeda_parser_structs.h index 7c711fb249..2eb2dcb60f 100644 --- a/common/io/easyeda/easyeda_parser_structs.h +++ b/common/io/easyeda/easyeda_parser_structs.h @@ -35,7 +35,7 @@ #include #include -#include +#include namespace EASYEDA { diff --git a/common/io/easyedapro/easyedapro_parser.h b/common/io/easyedapro/easyedapro_parser.h index 86d5731ac8..f3da8ab6aa 100644 --- a/common/io/easyedapro/easyedapro_parser.h +++ b/common/io/easyedapro/easyedapro_parser.h @@ -34,7 +34,7 @@ #include -#include +#include #include diff --git a/common/jobs/jobset.cpp b/common/jobs/jobset.cpp index 107ad7e2eb..be0ed492b6 100644 --- a/common/jobs/jobset.cpp +++ b/common/jobs/jobset.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include diff --git a/common/json_conversions.cpp b/common/json_conversions.cpp index 4839bf9725..24b21ef6ed 100644 --- a/common/json_conversions.cpp +++ b/common/json_conversions.cpp @@ -17,7 +17,7 @@ * with this program. If not, see . */ -#include +#include #include // Specializations to allow directly reading/writing wxStrings from JSON diff --git a/common/kiid.cpp b/common/kiid.cpp index a78ccf585a..925a9e8d91 100644 --- a/common/kiid.cpp +++ b/common/kiid.cpp @@ -33,7 +33,7 @@ #include #endif -#include +#include #include #include diff --git a/common/project/component_class_settings.cpp b/common/project/component_class_settings.cpp index 53f7ad0a8a..9a4c71b30c 100644 --- a/common/project/component_class_settings.cpp +++ b/common/project/component_class_settings.cpp @@ -17,7 +17,7 @@ * with this program. If not, see . */ -#include +#include #include #include diff --git a/common/project/net_settings.cpp b/common/project/net_settings.cpp index 54b81d32c6..62eb771558 100644 --- a/common/project/net_settings.cpp +++ b/common/project/net_settings.cpp @@ -22,7 +22,7 @@ #include #include -#include +#include #include #include diff --git a/common/settings/aui_settings.cpp b/common/settings/aui_settings.cpp index 28faaf57ec..fbb2c99a1b 100644 --- a/common/settings/aui_settings.cpp +++ b/common/settings/aui_settings.cpp @@ -21,7 +21,7 @@ */ #include -#include +#include #include #include diff --git a/common/settings/bom_settings.cpp b/common/settings/bom_settings.cpp index 69d7fdbe81..e4d7143903 100644 --- a/common/settings/bom_settings.cpp +++ b/common/settings/bom_settings.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include diff --git a/common/settings/grid_settings.cpp b/common/settings/grid_settings.cpp index 2648174a99..966fd6dabe 100644 --- a/common/settings/grid_settings.cpp +++ b/common/settings/grid_settings.cpp @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include diff --git a/common/settings/kicad_settings.cpp b/common/settings/kicad_settings.cpp index db79a36fab..2a31008934 100644 --- a/common/settings/kicad_settings.cpp +++ b/common/settings/kicad_settings.cpp @@ -20,7 +20,7 @@ #include // ensure class wxAuiPaneInfo is defined for other includes #include "settings/kicad_settings.h" -#include +#include #include #include diff --git a/common/settings/parameters.cpp b/common/settings/parameters.cpp index 2839176bd7..9de94ba848 100644 --- a/common/settings/parameters.cpp +++ b/common/settings/parameters.cpp @@ -20,7 +20,7 @@ #include -#include +#include #include #include diff --git a/common/tool/ui/toolbar_configuration.cpp b/common/tool/ui/toolbar_configuration.cpp index 598b0cd00d..c3221a5d2a 100644 --- a/common/tool/ui/toolbar_configuration.cpp +++ b/common/tool/ui/toolbar_configuration.cpp @@ -23,7 +23,7 @@ */ #include -#include +#include #include #include diff --git a/eeschema/erc/erc_report.cpp b/eeschema/erc/erc_report.cpp index 1ab459aafc..425d870070 100644 --- a/eeschema/erc/erc_report.cpp +++ b/eeschema/erc/erc_report.cpp @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include diff --git a/eeschema/netlist_exporters/netlist_exporter_xml.cpp b/eeschema/netlist_exporters/netlist_exporter_xml.cpp index a3a33a8031..8aaeb7e379 100644 --- a/eeschema/netlist_exporters/netlist_exporter_xml.cpp +++ b/eeschema/netlist_exporters/netlist_exporter_xml.cpp @@ -34,7 +34,7 @@ #include #include #include // also nests: -#include +#include #include #include diff --git a/eeschema/sch_design_block_utils.cpp b/eeschema/sch_design_block_utils.cpp index 8db9803fce..647c53264a 100644 --- a/eeschema/sch_design_block_utils.cpp +++ b/eeschema/sch_design_block_utils.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include bool checkOverwriteDb( wxWindow* aFrame, wxString& libname, wxString& newName ) { diff --git a/eeschema/sch_io/easyeda/sch_io_easyeda.cpp b/eeschema/sch_io/easyeda/sch_io_easyeda.cpp index 0b4dfc85af..e31447e094 100644 --- a/eeschema/sch_io/easyeda/sch_io_easyeda.cpp +++ b/eeschema/sch_io/easyeda/sch_io_easyeda.cpp @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include diff --git a/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp b/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp index dfbaca6d57..af9d427e5e 100644 --- a/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp +++ b/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp @@ -40,7 +40,7 @@ #include #include -#include +#include #include #include #include diff --git a/gerbview/gerbview.cpp b/gerbview/gerbview.cpp index 109cc6a84a..b7d03f224f 100644 --- a/gerbview/gerbview.cpp +++ b/gerbview/gerbview.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/gerbview/job_file_reader.cpp b/gerbview/job_file_reader.cpp index 82d05587f3..3dfe193b2c 100644 --- a/gerbview/job_file_reader.cpp +++ b/gerbview/job_file_reader.cpp @@ -26,7 +26,7 @@ * @file job_file_reader.cpp */ -#include +#include #include #include diff --git a/include/json_common.h b/include/json_common.h index e37cb5809f..9ad72a5004 100644 --- a/include/json_common.h +++ b/include/json_common.h @@ -20,8 +20,137 @@ #ifndef JSON_COMMON_H #define JSON_COMMON_H -#include +/*********************************************************************************************************************** + * If we are compiling on Apple with Clang >= 17, the version of LLVM no longer includes a generic template for + * char_traits for char types which are not specified in the C++ standard. We define our own here for types required by + * the JSON library. + * + * From: https://github.com/llvm/llvm-project/commit/c3668779c13596e223c26fbd49670d18cd638c40 + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + **********************************************************************************************************************/ +#ifdef __APPLE__ +#if __clang_major__ >= 17 + +#include + +template <> +struct std::char_traits +{ + using char_type = wxUniChar; + using int_type = int; + using off_type = std::streamoff; + using pos_type = std::streampos; + using state_type = mbstate_t; + + static inline void assign( char_type& __c1, const char_type& __c2 ) noexcept { __c1 = __c2; } + + static inline bool eq( char_type __c1, char_type __c2 ) noexcept { return __c1 == __c2; } + + static inline bool lt( char_type __c1, char_type __c2 ) noexcept { return __c1 < __c2; } + + static constexpr int compare( const char_type* __s1, const char_type* __s2, size_t __n ) + { + for( ; __n; --__n, ++__s1, ++__s2 ) + { + if( lt( *__s1, *__s2 ) ) + return -1; + + if( lt( *__s2, *__s1 ) ) + return 1; + } + + return 0; + } + + static size_t length( const char_type* __s ) + { + size_t __len = 0; + + for( ; !eq( *__s, char_type( 0 ) ); ++__s ) + ++__len; + + return __len; + } + + static constexpr const char_type* find( const char_type* __s, size_t __n, const char_type& __a ) + { + for( ; __n; --__n ) + { + if( eq( *__s, __a ) ) + return __s; + ++__s; + } + + return nullptr; + } + + static constexpr char_type* move( char_type* __s1, const char_type* __s2, size_t __n ) + { + if( __n == 0 ) + return __s1; + + char_type* __r = __s1; + + if( __s1 < __s2 ) + { + for( ; __n; --__n, ++__s1, ++__s2 ) + assign( *__s1, *__s2 ); + } + else if( __s2 < __s1 ) + { + __s1 += __n; + __s2 += __n; + + for( ; __n; --__n ) + assign( *--__s1, *--__s2 ); + } + + return __r; + } + + static constexpr char_type* copy( char_type* __s1, const char_type* __s2, size_t __n ) + { + char_type* __r = __s1; + + for( ; __n; --__n, ++__s1, ++__s2 ) + assign( *__s1, *__s2 ); + + return __r; + } + + static char_type* assign( char_type* __s, size_t __n, char_type __a ) + { + char_type* __r = __s; + + for( ; __n; --__n, ++__s ) + assign( *__s, __a ); + + return __r; + } + + static inline constexpr int_type not_eof( int_type __c ) noexcept + { + return eq_int_type( __c, eof() ) ? ~eof() : __c; + } + + static inline char_type to_char_type( int_type __c ) noexcept { return char_type( __c ); } + + static inline int_type to_int_type( char_type __c ) noexcept { return static_cast( __c ); } + + static inline constexpr bool eq_int_type( int_type __c1, int_type __c2 ) noexcept { return __c1 == __c2; } + + static inline constexpr int_type eof() noexcept { return static_cast( EOF ); } +}; + +#endif +#endif + +#include #include /** @@ -32,4 +161,4 @@ class KICOMMON_API JSON_COMMON_EXPORT_STUB final : public nlohmann::json { }; -#endif \ No newline at end of file +#endif diff --git a/include/lockfile.h b/include/lockfile.h index 4911048029..54bcbb6a59 100644 --- a/include/lockfile.h +++ b/include/lockfile.h @@ -34,7 +34,7 @@ #include #include #include -#include +#include #include #define LCK "KICAD_LOCKING" diff --git a/include/project/board_project_settings.h b/include/project/board_project_settings.h index cf7f77ea39..2aef966733 100644 --- a/include/project/board_project_settings.h +++ b/include/project/board_project_settings.h @@ -26,7 +26,7 @@ #include // Can be removed by refactoring PARAM_LAYER_PRESET -#include +#include #include #include diff --git a/include/rc_json_schema.h b/include/rc_json_schema.h index f50cf0c610..b185e919e1 100644 --- a/include/rc_json_schema.h +++ b/include/rc_json_schema.h @@ -20,7 +20,7 @@ #ifndef RC_JSON_SCHEMA_H #define RC_JSON_SCHEMA_H -#include +#include #include #include #include diff --git a/kicad/update_manager.cpp b/kicad/update_manager.cpp index d854a73a75..932db293f5 100644 --- a/kicad/update_manager.cpp +++ b/kicad/update_manager.cpp @@ -38,7 +38,7 @@ #include -#include +#include #include #include diff --git a/libs/core/include/core/json_serializers.h b/libs/core/include/core/json_serializers.h index b5079fc209..17b1057de9 100644 --- a/libs/core/include/core/json_serializers.h +++ b/libs/core/include/core/json_serializers.h @@ -24,7 +24,7 @@ #ifndef JSON_SERIALIZERS_H_ #define JSON_SERIALIZERS_H_ -#include +#include #include #include diff --git a/pcbnew/drc/drc_report.cpp b/pcbnew/drc/drc_report.cpp index 272555aba3..eb39966edc 100644 --- a/pcbnew/drc/drc_report.cpp +++ b/pcbnew/drc/drc_report.cpp @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include diff --git a/pcbnew/exporters/gerber_jobfile_writer.h b/pcbnew/exporters/gerber_jobfile_writer.h index 2cc8b8e4ac..529222ee4d 100644 --- a/pcbnew/exporters/gerber_jobfile_writer.h +++ b/pcbnew/exporters/gerber_jobfile_writer.h @@ -30,7 +30,7 @@ #ifndef GERBER_JOBFILE_WRITER_H #define GERBER_JOBFILE_WRITER_H -#include +#include // A helper enum to handle sides of some layers (silk, mask) diff --git a/pcbnew/netlist_reader/kicad_netlist_reader.cpp b/pcbnew/netlist_reader/kicad_netlist_reader.cpp index 9fff709de7..32229883d3 100644 --- a/pcbnew/netlist_reader/kicad_netlist_reader.cpp +++ b/pcbnew/netlist_reader/kicad_netlist_reader.cpp @@ -24,7 +24,7 @@ #include // netlist_lexer is common to Eeschema and Pcbnew #include -#include +#include #include "pcb_netlist.h" #include "netlist_reader.h" diff --git a/pcbnew/netlist_reader/pcb_netlist.h b/pcbnew/netlist_reader/pcb_netlist.h index e3886a082f..d54d1b517f 100644 --- a/pcbnew/netlist_reader/pcb_netlist.h +++ b/pcbnew/netlist_reader/pcb_netlist.h @@ -28,7 +28,7 @@ #include #include -#include +#include #include #include diff --git a/pcbnew/pcb_design_block_utils.cpp b/pcbnew/pcb_design_block_utils.cpp index e6af96092b..cde8562b01 100644 --- a/pcbnew/pcb_design_block_utils.cpp +++ b/pcbnew/pcb_design_block_utils.cpp @@ -46,7 +46,7 @@ #include #include #include -#include +#include bool checkOverwriteDb( wxWindow* aFrame, wxString& libname, wxString& newName ) { diff --git a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp index 7c7c1fffb6..88f66712d6 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.cpp @@ -26,7 +26,7 @@ #include -#include +#include #include #include #include diff --git a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.h b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.h index 887786edd6..853e046f7b 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.h +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_parser.h @@ -37,7 +37,7 @@ #include #include -#include +#include #include class BOARD; diff --git a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp index 930e096e41..7e2b9e9806 100644 --- a/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp +++ b/pcbnew/pcb_io/easyeda/pcb_io_easyeda_plugin.cpp @@ -41,7 +41,7 @@ #include #include -#include +#include #include diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp index 67c132191d..0a7bed3ca0 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.cpp @@ -27,7 +27,7 @@ #include -#include +#include #include #include #include diff --git a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.h b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.h index 45084e3302..14f6f0dd48 100644 --- a/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.h +++ b/pcbnew/pcb_io/easyedapro/pcb_io_easyedapro_parser.h @@ -37,7 +37,7 @@ #include #include -#include +#include #include #include diff --git a/thirdparty/nanodbc/nanodbc/nanodbc.cpp b/thirdparty/nanodbc/nanodbc/nanodbc.cpp index c62605aeb8..04f86025e4 100644 --- a/thirdparty/nanodbc/nanodbc/nanodbc.cpp +++ b/thirdparty/nanodbc/nanodbc/nanodbc.cpp @@ -153,6 +153,137 @@ using nanodbc::wide_string; #endif #endif +/*********************************************************************************************************************** + * + * KICAD-SPECIFIC ADDITION + * + * If we are compiling on Apple with Clang >= 17, the version of LLVM no longer includes a generic template for + * char_traits for char types which are not specified in the C++ standard. We define our own here for types required by + * the database library. + * + * From: https://github.com/llvm/llvm-project/commit/c3668779c13596e223c26fbd49670d18cd638c40 + * + * Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. + * See https://llvm.org/LICENSE.txt for license information. + * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception + * + **********************************************************************************************************************/ + +#ifdef __APPLE__ +#if __clang_major__ >= 17 + +template <> +struct std::char_traits +{ + using char_type = NANODBC_SQLCHAR; + using int_type = int; + using off_type = std::streamoff; + using pos_type = std::streampos; + using state_type = mbstate_t; + + static inline void assign( char_type& __c1, const char_type& __c2 ) noexcept { __c1 = __c2; } + + static inline bool eq( char_type __c1, char_type __c2 ) noexcept { return __c1 == __c2; } + + static inline bool lt( char_type __c1, char_type __c2 ) noexcept { return __c1 < __c2; } + + static constexpr int compare( const char_type* __s1, const char_type* __s2, size_t __n ) + { + for( ; __n; --__n, ++__s1, ++__s2 ) + { + if( lt( *__s1, *__s2 ) ) + return -1; + + if( lt( *__s2, *__s1 ) ) + return 1; + } + + return 0; + } + + static size_t length( const char_type* __s ) + { + size_t __len = 0; + + for( ; !eq( *__s, char_type( 0 ) ); ++__s ) + ++__len; + + return __len; + } + + static constexpr const char_type* find( const char_type* __s, size_t __n, const char_type& __a ) + { + for( ; __n; --__n ) + { + if( eq( *__s, __a ) ) + return __s; + ++__s; + } + + return nullptr; + } + + static constexpr char_type* move( char_type* __s1, const char_type* __s2, size_t __n ) + { + if( __n == 0 ) + return __s1; + + char_type* __r = __s1; + + if( __s1 < __s2 ) + { + for( ; __n; --__n, ++__s1, ++__s2 ) + assign( *__s1, *__s2 ); + } + else if( __s2 < __s1 ) + { + __s1 += __n; + __s2 += __n; + + for( ; __n; --__n ) + assign( *--__s1, *--__s2 ); + } + + return __r; + } + + static constexpr char_type* copy( char_type* __s1, const char_type* __s2, size_t __n ) + { + char_type* __r = __s1; + + for( ; __n; --__n, ++__s1, ++__s2 ) + assign( *__s1, *__s2 ); + + return __r; + } + + static char_type* assign( char_type* __s, size_t __n, char_type __a ) + { + char_type* __r = __s; + + for( ; __n; --__n, ++__s ) + assign( *__s, __a ); + + return __r; + } + + static inline constexpr int_type not_eof( int_type __c ) noexcept + { + return eq_int_type( __c, eof() ) ? ~eof() : __c; + } + + static inline char_type to_char_type( int_type __c ) noexcept { return char_type( __c ); } + + static inline int_type to_int_type( char_type __c ) noexcept { return static_cast( __c ); } + + static inline constexpr bool eq_int_type( int_type __c1, int_type __c2 ) noexcept { return __c1 == __c2; } + + static inline constexpr int_type eof() noexcept { return static_cast( EOF ); } +}; + +#endif +#endif + // clang-format off // .d88888b. 8888888b. 888888b. .d8888b. 888b d888 // d88P" "Y88b 888 "Y88b 888 "88b d88P Y88b 8888b d8888