From 5151cd0bfe4d594cb2b0733f83a2bbe6803b1f68 Mon Sep 17 00:00:00 2001 From: Seth Hillbrand Date: Tue, 6 Aug 2019 21:26:33 -0700 Subject: [PATCH] C++14: Remove unused make_unique.h Also removes header references now that we are in C++14, this is built-in to the std --- common/eda_pattern_match.cpp | 3 +- common/footprint_filter.cpp | 3 +- common/geometry/shape_poly_set.cpp | 2 - common/lib_tree_model.cpp | 3 +- common/view/zoom_controller.cpp | 5 +- common/widgets/wx_busy_indicator.cpp | 4 +- eeschema/dialogs/dialog_bom.cpp | 1 - include/common.h | 3 - include/make_unique.h | 88 ---------------------------- libs/sexpr/sexpr_parser.cpp | 3 +- pcbnew/footprint_info_impl.cpp | 3 +- pcbnew/footprint_preview_panel.cpp | 3 +- pcbnew/pcbnew.cpp | 1 - qa/common/test_lib_table.cpp | 4 +- 14 files changed, 10 insertions(+), 116 deletions(-) delete mode 100644 include/make_unique.h diff --git a/common/eda_pattern_match.cpp b/common/eda_pattern_match.cpp index 5251305857..80f95c919c 100644 --- a/common/eda_pattern_match.cpp +++ b/common/eda_pattern_match.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2017 Chris Pavlina - * Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2015-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,7 +26,6 @@ #include #include #include -#include bool EDA_PATTERN_MATCH_SUBSTR::SetPattern( const wxString& aPattern ) { diff --git a/common/footprint_filter.cpp b/common/footprint_filter.cpp index 58bbafb5ed..bf6d063fe3 100644 --- a/common/footprint_filter.cpp +++ b/common/footprint_filter.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -19,7 +19,6 @@ */ #include -#include #include using FOOTPRINT_FILTER_IT = FOOTPRINT_FILTER::ITERATOR; diff --git a/common/geometry/shape_poly_set.cpp b/common/geometry/shape_poly_set.cpp index ba52e63e0b..4e3c75a362 100644 --- a/common/geometry/shape_poly_set.cpp +++ b/common/geometry/shape_poly_set.cpp @@ -38,8 +38,6 @@ #include #include -#include - #include #include #include diff --git a/common/lib_tree_model.cpp b/common/lib_tree_model.cpp index 71fe74c7dc..4cf23c2d01 100644 --- a/common/lib_tree_model.cpp +++ b/common/lib_tree_model.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2017 Chris Pavlina * Copyright (C) 2014 Henner Zeller - * Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2014-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -23,7 +23,6 @@ #include #include -#include #include #include #include diff --git a/common/view/zoom_controller.cpp b/common/view/zoom_controller.cpp index 95c21763f0..735cf24700 100644 --- a/common/view/zoom_controller.cpp +++ b/common/view/zoom_controller.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2012 Torsten Hueter, torstenhtr gmx.de * Copyright (C) 2013-2015 CERN - * Copyright (C) 2012-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2012-2019 KiCad Developers, see AUTHORS.txt for contributors. * * @author Tomasz Wlostowski * @author Maciej Suminski @@ -28,7 +28,6 @@ #include -#include #include #include @@ -131,4 +130,4 @@ double CONSTANT_ZOOM_CONTROLLER::GetScaleForRotation( int aRotation ) constexpr ACCELERATING_ZOOM_CONTROLLER::TIMEOUT ACCELERATING_ZOOM_CONTROLLER::DEFAULT_TIMEOUT; constexpr double CONSTANT_ZOOM_CONTROLLER::MAC_SCALE; -constexpr double CONSTANT_ZOOM_CONTROLLER::GTK3_SCALE; \ No newline at end of file +constexpr double CONSTANT_ZOOM_CONTROLLER::GTK3_SCALE; diff --git a/common/widgets/wx_busy_indicator.cpp b/common/widgets/wx_busy_indicator.cpp index b7da24f761..141213f09d 100644 --- a/common/widgets/wx_busy_indicator.cpp +++ b/common/widgets/wx_busy_indicator.cpp @@ -23,11 +23,9 @@ #include -#include - #include WX_BUSY_INDICATOR::WX_BUSY_INDICATOR() : m_cursor( std::make_unique() ) { -} \ No newline at end of file +} diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp index 119015173b..518c0bdd33 100644 --- a/eeschema/dialogs/dialog_bom.cpp +++ b/eeschema/dialogs/dialog_bom.cpp @@ -42,7 +42,6 @@ #include #include #include -#include #include diff --git a/include/common.h b/include/common.h index a3fd9f2924..563af17861 100644 --- a/include/common.h +++ b/include/common.h @@ -45,9 +45,6 @@ #include #include -// C++11 "polyfill" for the C++14 std::make_unique function -#include "make_unique.h" - class wxAboutDialogInfo; class SEARCH_STACK; class REPORTER; diff --git a/include/make_unique.h b/include/make_unique.h deleted file mode 100644 index 1ef20658d0..0000000000 --- a/include/make_unique.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * This program source code file is part of KiCad, a free EDA CAD application. - * - * Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, you may find one here: - * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html - * or you may search the http://www.gnu.org website for the version 2 license, - * or you may write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA - */ - -/** - * @file make_unique.h - * @brief Implementation of std::make_unique for pre C++14 compilation - * environments - */ - -#ifndef MAKE_UNIQUE_H -#define MAKE_UNIQUE_H - -// Define std::make_unique if the compiler is C++11, but not C++14 -// (which provides this itself) -// When C++14 support is a KiCad pre-requisite, this entire file -// can be removed. -#if __cplusplus == 201103L - -#include -#include -#include -#include - -// It's a bit naughty to add things to std::, but the point is to -// "polyfill" this function in only if std:: doesn't have it -// -// This implementation is the one proposed by Stephan T. Lavavej -// in N3656: https://isocpp.org/files/papers/N3656.txt -// This is more or less exactly how it is implemented in GCC (e.g. 6.3.1) -// when C++14 is enabled. -namespace std -{ - template struct _Unique_if { - typedef unique_ptr _Single_object; - }; - - template struct _Unique_if { - typedef unique_ptr _Unknown_bound; - }; - - template struct _Unique_if { - typedef void _Known_bound; - }; - - /// std::make_unique for single objects - template - typename _Unique_if::_Single_object - make_unique(Args&&... args) { - return unique_ptr(new T(std::forward(args)...)); - } - - /// std::make_unique for arrays of unknown bound - template - typename _Unique_if::_Unknown_bound - make_unique(size_t n) { - typedef typename remove_extent::type U; - return unique_ptr(new U[n]()); - } - - /// Disable std::make_unique for arrays of known bound - template - typename _Unique_if::_Known_bound - make_unique(Args&&...) = delete; -} - -#endif // __cplusplus == 201103L - -#endif // WXSTRUCT_H_ diff --git a/libs/sexpr/sexpr_parser.cpp b/libs/sexpr/sexpr_parser.cpp index 3c3decd784..28fcd73464 100644 --- a/libs/sexpr/sexpr_parser.cpp +++ b/libs/sexpr/sexpr_parser.cpp @@ -1,6 +1,6 @@ /* * Copyright (C) 2016 Mark Roszko - * Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,7 +28,6 @@ #include #include -#include namespace SEXPR { diff --git a/pcbnew/footprint_info_impl.cpp b/pcbnew/footprint_info_impl.cpp index b6a6aed56b..ae1ecffad0 100644 --- a/pcbnew/footprint_info_impl.cpp +++ b/pcbnew/footprint_info_impl.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2011 Jean-Pierre Charras, * Copyright (C) 2013-2016 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software: you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/pcbnew/footprint_preview_panel.cpp b/pcbnew/footprint_preview_panel.cpp index 7fe93c96cc..9d90da91bb 100644 --- a/pcbnew/footprint_preview_panel.cpp +++ b/pcbnew/footprint_preview_panel.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 2016-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017 Chris Pavlina * Copyright (C) 2016 Tomasz Wlostowski * @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include diff --git a/pcbnew/pcbnew.cpp b/pcbnew/pcbnew.cpp index 0238f99eee..aa1a40aed6 100644 --- a/pcbnew/pcbnew.cpp +++ b/pcbnew/pcbnew.cpp @@ -38,7 +38,6 @@ #include #include #include -#include #include #include #include diff --git a/qa/common/test_lib_table.cpp b/qa/common/test_lib_table.cpp index 3394524021..c754b26d5c 100644 --- a/qa/common/test_lib_table.cpp +++ b/qa/common/test_lib_table.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2018 KiCad Developers, see CHANGELOG.TXT for contributors. + * Copyright (C) 2018-2019 KiCad Developers, see CHANGELOG.TXT for contributors. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -35,8 +35,6 @@ // Code under test #include -#include - /** * A concrete implementation of #LIB_TABLE_ROW that implements