From b5dbf498375ca6e0035c9bdd93541b76f25c53ed Mon Sep 17 00:00:00 2001 From: Christopher Durand Date: Tue, 11 Sep 2018 19:36:53 +0200 Subject: [PATCH 1/6] [ext] Add avr-gcc libstdc++ submodule --- .gitmodules | 3 +++ ext/gcc/libstdc++ | 1 + 2 files changed, 4 insertions(+) create mode 160000 ext/gcc/libstdc++ diff --git a/.gitmodules b/.gitmodules index 8d453e2a33..45b4d49191 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "ext/arm/cmsis"] path = ext/arm/cmsis url = https://github.com/modm-io/cmsis-5-partial.git +[submodule "ext/gcc/libstdc++"] + path = ext/gcc/libstdc++ + url = https://github.com/modm-io/avr-libstdcpp.git diff --git a/ext/gcc/libstdc++ b/ext/gcc/libstdc++ new file mode 160000 index 0000000000..2030cc27f3 --- /dev/null +++ b/ext/gcc/libstdc++ @@ -0,0 +1 @@ +Subproject commit 2030cc27f3238419f792ac4558877f9bf571af2a From 07c826f97a83abfccf8e64e6359676497b28b2f9 Mon Sep 17 00:00:00 2001 From: Christopher Durand Date: Mon, 17 Sep 2018 11:30:26 +0200 Subject: [PATCH 2/6] [ext] Add module.lb for avr libstdc++ submodule --- ext/gcc/module.lb | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 ext/gcc/module.lb diff --git a/ext/gcc/module.lb b/ext/gcc/module.lb new file mode 100644 index 0000000000..76d18ba538 --- /dev/null +++ b/ext/gcc/module.lb @@ -0,0 +1,32 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# Copyright (c) 2016-2017, Niklas Hauser +# Copyright (c) 2017-2018, Fabian Greif +# Copyright (c) 2018, Christopher Durand +# +# This file is part of the modm project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# ----------------------------------------------------------------------------- + + +def init(module): + module.name = "stdc++" + + +def prepare(module, options): + target = options[":target"].identifier + if target["platform"] != "avr": + return False + + return True + + +def build(env): + env.add_metadata("include_path", "modm/ext/gcc/libstdc++/include") + + env.outbasepath = "modm/ext/gcc" + env.copy(".", ignore=env.ignore_files("*.lb", "*.md", "examples")) From cf8bee28be60441e59b191ae0b25993302f12e29 Mon Sep 17 00:00:00 2001 From: Christopher Durand Date: Mon, 17 Sep 2018 11:34:47 +0200 Subject: [PATCH 3/6] [stdc++] Remove avr stdc++ dummy headers --- src/stdc++/algorithm | 19 ---- src/stdc++/cmath | 103 --------------------- src/stdc++/cstddef | 41 --------- src/stdc++/cstdint | 84 ----------------- src/stdc++/cstdlib | 120 ------------------------- src/stdc++/cstring | 84 ----------------- src/stdc++/initializer_list | 104 --------------------- src/stdc++/internal/algorithm_base.hpp | 104 --------------------- src/stdc++/module.lb | 31 ------- src/stdc++/new | 77 ---------------- test/stdc++/algorithm_base_test.cpp | 31 ------- test/stdc++/algorithm_base_test.hpp | 25 ------ test/stdc++/module.lb | 30 ------- 13 files changed, 853 deletions(-) delete mode 100644 src/stdc++/algorithm delete mode 100644 src/stdc++/cmath delete mode 100644 src/stdc++/cstddef delete mode 100644 src/stdc++/cstdint delete mode 100644 src/stdc++/cstdlib delete mode 100644 src/stdc++/cstring delete mode 100644 src/stdc++/initializer_list delete mode 100644 src/stdc++/internal/algorithm_base.hpp delete mode 100644 src/stdc++/module.lb delete mode 100644 src/stdc++/new delete mode 100644 test/stdc++/algorithm_base_test.cpp delete mode 100644 test/stdc++/algorithm_base_test.hpp delete mode 100644 test/stdc++/module.lb diff --git a/src/stdc++/algorithm b/src/stdc++/algorithm deleted file mode 100644 index 139c4536bc..0000000000 --- a/src/stdc++/algorithm +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2009, Martin Rosekeit - * Copyright (c) 2009-2010, 2012, Fabian Greif - * Copyright (c) 2012, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- - -#ifndef STDCPP_ALGORITHM -#define STDCPP_ALGORITHM - -#include "internal/algorithm_base.hpp" - -#endif // STDCPP_ALGORITHM diff --git a/src/stdc++/cmath b/src/stdc++/cmath deleted file mode 100644 index 8c72b815de..0000000000 --- a/src/stdc++/cmath +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright (c) 2009-2010, 2012, Fabian Greif - * Copyright (c) 2010, Martin Rosekeit - * Copyright (c) 2012, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- -/** - * @file cmath - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c math.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 26.5 C library -// - -#pragma GCC system_header - -#include "internal/algorithm_base.hpp" - -#include - -#ifndef STDCPP_CMATH -#define STDCPP_CMATH - -/*// Get rid of those macros defined in -#undef M_E -#undef M_LOG2E -#undef M_LOG10E -#undef M_LN2 -#undef M_LN10 -#undef M_PI -#undef M_PI_2 -#undef M_PI_4 -#undef M_1_PI -#undef M_2_PI -#undef M_2_SQRTPI -#undef M_SQRT2 -#undef M_SQRT1_2 -#undef NAN -#undef INFINITY*/ - -namespace std -{ - using ::cos; - using ::fabs; - using ::fmod; - using ::modf; - using ::sin; - using ::sqrt; - using ::tan; - using ::floor; - using ::ceil; - using ::frexp; - using ::ldexp; - using ::cosh; - using ::sinh; - using ::atan; - using ::atan2; - using ::log; - using ::log10; - using ::pow; - using ::isnan; - using ::isinf; - using ::square; - using ::copysign; - using ::fdim; - using ::fma; - using ::fmax; - using ::fmin; - using ::signbit; - using ::trunc; - using ::isfinite; - using ::hypot; - using ::round; - using ::lround; - using ::lrint; - - inline float - abs(const float& x) - { - return ::fabs(x); - } - - inline double - abs(const double& x) - { - return ::fabs(x); - } -} - -#endif // STDCPP_CMATH diff --git a/src/stdc++/cstddef b/src/stdc++/cstddef deleted file mode 100644 index f0a5d6f492..0000000000 --- a/src/stdc++/cstddef +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) 2009, Thorsten Lajewski - * Copyright (c) 2009-2010, 2012, Fabian Greif - * Copyright (c) 2012, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- -/** - * @file cstddef - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c stddef.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 18.1 Types -// - -#pragma GCC system_header - -#include - -#ifndef STDCPP_CSTDDEF -#define STDCPP_CSTDDEF - -namespace std -{ - using ::ptrdiff_t; - using ::size_t; -} - -#endif // STDCPP_CSTDDEF diff --git a/src/stdc++/cstdint b/src/stdc++/cstdint deleted file mode 100644 index 55436e3817..0000000000 --- a/src/stdc++/cstdint +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2009, Thorsten Lajewski - * Copyright (c) 2009-2010, 2012, Fabian Greif - * Copyright (c) 2012, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- -/** - * @file cstdint - * This is a Standard C++ Library header. - */ - -#ifndef STDCPP_CSTDINT -#define STDCPP_CSTDINT - -#pragma GCC system_header - -// For 8.22.1/1 (see C99, Notes 219, 220, 222) -#ifndef __STDC_LIMIT_MACROS -# define _UNDEF__STDC_LIMIT_MACROS -# define __STDC_LIMIT_MACROS -#endif - -#ifndef __STDC_CONSTANT_MACROS -# define _UNDEF__STDC_CONSTANT_MACROS -# define __STDC_CONSTANT_MACROS -#endif - -#include - -#ifdef _UNDEF__STDC_LIMIT_MACROS -# undef __STDC_LIMIT_MACROS -# undef _UNDEF__STDC_LIMIT_MACROS -#endif -#ifdef _UNDEF__STDC_CONSTANT_MACROS -# undef __STDC_CONSTANT_MACROS -# undef _UNDEF__STDC_CONSTANT_MACROS -#endif - -namespace std -{ - using ::int8_t; - using ::int16_t; - using ::int32_t; - using ::int64_t; - - using ::int_fast8_t; - using ::int_fast16_t; - using ::int_fast32_t; - using ::int_fast64_t; - - using ::int_least8_t; - using ::int_least16_t; - using ::int_least32_t; - using ::int_least64_t; - - using ::intmax_t; - using ::intptr_t; - - using ::uint8_t; - using ::uint16_t; - using ::uint32_t; - using ::uint64_t; - - using ::uint_fast8_t; - using ::uint_fast16_t; - using ::uint_fast32_t; - using ::uint_fast64_t; - - using ::uint_least8_t; - using ::uint_least16_t; - using ::uint_least32_t; - using ::uint_least64_t; - - using ::uintmax_t; - using ::uintptr_t; -} - -#endif // STDCPP_CSTDINT diff --git a/src/stdc++/cstdlib b/src/stdc++/cstdlib deleted file mode 100644 index 6569e423d1..0000000000 --- a/src/stdc++/cstdlib +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2009-2010, Martin Rosekeit - * Copyright (c) 2009-2010, 2012, Fabian Greif - * Copyright (c) 2012, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- -/** - * @file include/cstdlib - * - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c stdlib.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#pragma GCC system_header - -#include - -#ifndef STDCPP_CSTDLIB -#define STDCPP_CSTDLIB - -#include - -// Get rid of those macros defined in in lieu of real functions. -#undef abort -#undef abs -#undef atexit -#undef atof -#undef atoi -#undef atol -#undef bsearch -#undef calloc -#undef div -#undef exit -#undef free -#undef getenv -#undef labs -#undef ldiv -#undef malloc -#undef mblen -#undef mbstowcs -#undef mbtowc -#undef qsort -#undef rand -#undef realloc -#undef srand -#undef strtod -#undef strtol -#undef strtoul -#undef system -#undef wcstombs -#undef wctomb - -namespace std -{ - using ::div_t; - using ::ldiv_t; - - using ::abort; - using ::atof; - using ::atoi; - using ::bsearch; - using ::calloc; - using ::div; - using ::exit; - using ::free; - using ::labs; - using ::ldiv; - using ::malloc; - using ::qsort; - using ::rand; - using ::realloc; - using ::srand; - using ::strtod; - using ::strtol; - using ::strtoul; - - inline int - abs(int i) - { - return ::abs(i); - } - - inline long - abs(long i) - { - return labs(i); - } - - inline ldiv_t - div(long i, long j) - { - return ldiv(i, j); - } -} - -#undef _Exit -#undef llabs -#undef lldiv -#undef atoll -#undef strtoll -#undef strtoull -#undef strtof -#undef strtold - -#endif // STDCPP_CSTDLIB diff --git a/src/stdc++/cstring b/src/stdc++/cstring deleted file mode 100644 index 9663bf1be4..0000000000 --- a/src/stdc++/cstring +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2009, Thorsten Lajewski - * Copyright (c) 2009-2010, 2012, Fabian Greif - * Copyright (c) 2012, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- -/** - * @file cstring - * - * This is a Standard C++ Library file. You should @c #include this file - * in your programs, rather than any of the "*.h" implementation files. - * - * This is the C++ version of the Standard C Library header @c string.h, - * and its contents are (mostly) the same as that header, but are all - * contained in the namespace @c std (except for names which are defined - * as macros in C). - */ - -// -// ISO C++ 14882: 20.4.6 C library -// - -#pragma GCC system_header - -#include -#include - -#ifndef STDCPP_CSTRING -#define STDCPP_CSTRING - -// Get rid of those macros defined in in lieu of real functions. -#undef memchr -#undef memcmp -#undef memcpy -#undef memmove -#undef memset -#undef strcat -#undef strchr -#undef strcmp -#undef strcoll -#undef strcpy -#undef strcspn -#undef strerror -#undef strlen -#undef strncat -#undef strncmp -#undef strncpy -#undef strpbrk -#undef strrchr -#undef strspn -#undef strstr -#undef strtok -#undef strxfrm - -namespace std -{ - using ::memchr; - using ::memcmp; - using ::memcpy; - using ::memmove; - using ::memset; - using ::strcat; - using ::strcmp; - using ::strcpy; - using ::strcspn; - using ::strlen; - using ::strncat; - using ::strncmp; - using ::strncpy; - using ::strspn; - using ::strtok; - using ::strchr; - using ::strpbrk; - using ::strrchr; - using ::strstr; -} - -#endif // STDCPP_CSTRING diff --git a/src/stdc++/initializer_list b/src/stdc++/initializer_list deleted file mode 100644 index f4fb786802..0000000000 --- a/src/stdc++/initializer_list +++ /dev/null @@ -1,104 +0,0 @@ -// std::initializer_list support -*- C++ -*- - -// Copyright (C) 2008, 2009, 2010, 2011 Free Software Foundation, Inc. -// -// This file is part of GCC. -// -// GCC 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 3, or (at your option) -// any later version. -// -// GCC 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. -// -// Under Section 7 of GPL version 3, you are granted additional -// permissions described in the GCC Runtime Library Exception, version -// 3.1, as published by the Free Software Foundation. - -// You should have received a copy of the GNU General Public License and -// a copy of the GCC Runtime Library Exception along with this program; -// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see -// . - -/** - * @file initializer_list - * This is a Standard C++ Library header. - */ - -#ifndef _INITIALIZER_LIST -#define _INITIALIZER_LIST - -#include - -#pragma GCC system_header - -#pragma GCC visibility push(default) - -//#include - -namespace std -{ - /// initializer_list - template - class initializer_list - { - public: - typedef _E value_type; - typedef const _E& reference; - typedef const _E& const_reference; - typedef size_t size_type; - typedef const _E* iterator; - typedef const _E* const_iterator; - - private: - iterator _M_array; - size_type _M_len; - - // The compiler can call a private constructor. - constexpr initializer_list(const_iterator __a, size_type __l) - : _M_array(__a), _M_len(__l) { } - - public: - constexpr initializer_list() - : _M_array(0), _M_len(0) { } - - // Number of elements. - constexpr size_type - size() const { return _M_len; } - - // First element. - constexpr const_iterator - begin() const { return _M_array; } - - // One past the last element. - constexpr const_iterator - end() const { return begin() + size(); } - }; - - /** - * @brief Return an iterator pointing to the first element of - * the initilizer_list. - * @param __ils Initializer list. - */ - template - constexpr const _Tp* - begin(initializer_list<_Tp> __ils) - { return __ils.begin(); } - - /** - * @brief Return an iterator pointing to one past the last element - * of the initilizer_list. - * @param __ils Initializer list. - */ - template - constexpr const _Tp* - end(initializer_list<_Tp> __ils) - { return __ils.end(); } -} - -#pragma GCC visibility pop - -#endif // _INITIALIZER_LIST diff --git a/src/stdc++/internal/algorithm_base.hpp b/src/stdc++/internal/algorithm_base.hpp deleted file mode 100644 index 2da7725158..0000000000 --- a/src/stdc++/internal/algorithm_base.hpp +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2010, 2012, Fabian Greif - * Copyright (c) 2012, Niklas Hauser - * Copyright (c) 2018, Raphael Lehmann - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- - -#ifndef ALGORITHM_BASE_HPP -#define ALGORITHM_BASE_HPP - -namespace std -{ - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param a A thing of arbitrary type. - * @param b Another thing of arbitrary type. - * @return The lesser of the parameters. - * - * This is the simple classic generic implementation. It will work on - * temporary expressions, since they are only evaluated once, unlike a - * preprocessor macro. - */ - template - constexpr inline const T& - min(const T& a, const T& b) - { - if (b < a) - return b; - else - return a; - } - - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param a A thing of arbitrary type. - * @param b Another thing of arbitrary type. - * @return The greater of the parameters. - * - * This is the simple classic generic implementation. It will work on - * temporary expressions, since they are only evaluated once, unlike a - * preprocessor macro. - */ - template - constexpr inline const T& - max(const T& a, const T& b) - { - if (a < b) - return b; - else - return a; - } - - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param a A thing of arbitrary type. - * @param b Another thing of arbitrary type. - * @param compare A comparison functor. - * @return The lesser of the parameters. - * - * This will work on temporary expressions, since they are only evaluated - * once, unlike a preprocessor macro. - */ - template - constexpr inline const T& - min(const T& a, const T& b, Compare compare) - { - if (compare(b, a)) - return b; - else - return a; - } - - /** - * @brief This does what you think it does. - * @ingroup sorting_algorithms - * @param a A thing of arbitrary type. - * @param b Another thing of arbitrary type. - * @param compare A comparison functor. - * @return The greater of the parameters. - * - * This will work on temporary expressions, since they are only evaluated - * once, unlike a preprocessor macro. - */ - template - constexpr inline const T& - max(const T& a, const T& b, Compare compare) - { - if (compare(a, b)) - return b; - else - return a; - } -} - -#endif // ALGORITHM_BASE_HPP diff --git a/src/stdc++/module.lb b/src/stdc++/module.lb deleted file mode 100644 index 0db6cf4a7f..0000000000 --- a/src/stdc++/module.lb +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017, Niklas Hauser -# Copyright (c) 2017-2018, Fabian Greif -# -# This file is part of the modm project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. -# ----------------------------------------------------------------------------- - - -def init(module): - module.name = "stdc++" - - -def prepare(module, options): - target = options[":target"].identifier - if target["platform"] != "avr": - return False - - return True - - -def build(env): - env.add_metadata("include_path", "modm/src/stdc++") - - env.outbasepath = "modm/src/stdc++" - env.copy(".") diff --git a/src/stdc++/new b/src/stdc++/new deleted file mode 100644 index 81b680198b..0000000000 --- a/src/stdc++/new +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2009-2010, 2012, Fabian Greif - * Copyright (c) 2010, Martin Rosekeit - * Copyright (c) 2012, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- -/** - * @file new - * This is a Standard C++ Library header. - * - * The header @c new defines several functions to manage dynamic memory and - * handling memory allocation errors; see - * http://gcc.gnu.org/onlinedocs/libstdc++/18_support/howto.html#4 for more. - */ - -#ifndef NEW -#define NEW - -#include - -extern "C++" -{ - //@{ - /** - * These are replaceable signatures: - * - * - single new and delete (no arguments, return @c NULL on error) - * - array new and delete (same) - * - * Placement new and delete signatures (take a memory address argument, - * does nothing) may not be replaced by a user's program. - */ - void* - operator new(std::size_t); - - void* - operator new[](std::size_t); - - void - operator delete(void*); - - void - operator delete[](void*); - - // Default placement versions of operator new. - inline void* - operator new(std::size_t, void* __p) - { - return __p; - } - - inline void* - operator new[](std::size_t, void* __p) - { - return __p; - } - - // Default placement versions of operator delete. - inline void - operator delete(void*, void*) - { - } - - inline void - operator delete[](void*, void*) - { - } - //@} -} // extern "C++" - -#endif diff --git a/test/stdc++/algorithm_base_test.cpp b/test/stdc++/algorithm_base_test.cpp deleted file mode 100644 index d6b40a8e42..0000000000 --- a/test/stdc++/algorithm_base_test.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2009, Martin Rosekeit - * Copyright (c) 2009, Thorsten Lajewski - * Copyright (c) 2009-2010, 2017-2018, Fabian Greif - * Copyright (c) 2012, Sascha Schade - * Copyright (c) 2012, 2017, Niklas Hauser - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- - -#include -#include "algorithm_base_test.hpp" - -void -AlgorithmBaseTest::testMin() -{ - TEST_ASSERT_EQUALS(std::min(1, 2), 1); - TEST_ASSERT_EQUALS(std::min(2, 1), 1); -} - -void -AlgorithmBaseTest::testMax() -{ - TEST_ASSERT_EQUALS(std::max(1, 2), 2); - TEST_ASSERT_EQUALS(std::max(2, 1), 2); -} diff --git a/test/stdc++/algorithm_base_test.hpp b/test/stdc++/algorithm_base_test.hpp deleted file mode 100644 index 1c22476ee4..0000000000 --- a/test/stdc++/algorithm_base_test.hpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2009, Martin Rosekeit - * Copyright (c) 2009-2010, 2017, Fabian Greif - * Copyright (c) 2012, Niklas Hauser - * Copyright (c) 2012, Sascha Schade - * - * This file is part of the modm project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ -// ---------------------------------------------------------------------------- - -#include - -class AlgorithmBaseTest : public unittest::TestSuite -{ -public: - void - testMin(); - - void - testMax(); -}; diff --git a/test/stdc++/module.lb b/test/stdc++/module.lb deleted file mode 100644 index b37c689115..0000000000 --- a/test/stdc++/module.lb +++ /dev/null @@ -1,30 +0,0 @@ -#!/usr/bin/env python3 -# -*- coding: utf-8 -*- -# -# Copyright (c) 2016-2017, Niklas Hauser -# Copyright (c) 2017-2018, Fabian Greif -# -# This file is part of the modm project. -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - - -def init(module): - module.name = "stdc++" - module.parent = "test" - - -def prepare(module, options): - target = options[":target"].identifier - if target["platform"] != "avr": - return False - - module.depends(":stdc++") - return True - - -def build(env): - env.outbasepath = "modm/test/stdc++" - env.copy('.') From a3b0d6c29fdca24f75b2b802585f844060e6238d Mon Sep 17 00:00:00 2001 From: Christopher Durand Date: Thu, 6 Sep 2018 02:22:44 +0200 Subject: [PATCH 4/6] [stdc++] Add unittests for header compilation and std::vector --- test/al-avreb-can.xml | 1 + test/stdc++/compile_test.cpp | 56 ++++++++++++++++++++ test/stdc++/module.lb | 30 +++++++++++ test/stdc++/vector/vector_test.cpp | 83 ++++++++++++++++++++++++++++++ test/stdc++/vector/vector_test.hpp | 28 ++++++++++ 5 files changed, 198 insertions(+) create mode 100644 test/stdc++/compile_test.cpp create mode 100644 test/stdc++/module.lb create mode 100644 test/stdc++/vector/vector_test.cpp create mode 100644 test/stdc++/vector/vector_test.hpp diff --git a/test/al-avreb-can.xml b/test/al-avreb-can.xml index 57d3c68be6..e9afe2a317 100644 --- a/test/al-avreb-can.xml +++ b/test/al-avreb-can.xml @@ -16,6 +16,7 @@ :test:communication :test:container :test:driver + :test:stdc++