1
0
Fork 0

Switch to using C++14

This commit is contained in:
Patryk Obara 2020-05-09 21:07:02 +02:00 committed by Patryk Obara
parent 2463626c96
commit 064108c9c4
7 changed files with 12 additions and 19 deletions

View file

@ -25,7 +25,9 @@ ColumnLimit: 80
# C/C++ Language specifics
#
Language: Cpp
Standard: Cpp11 # in clang-format 11.x: c++11
# in clang-format 9.x "Cpp11" covers formatting for C++11 and C++14
# in clang-format 10.x: switch to "c++14"
Standard: Cpp11
# The extra indent or outdent of class access modifiers, e.g. public:
#
@ -97,8 +99,6 @@ AlwaysBreakTemplateDeclarations: Yes
# shortname = "dddd"
# "eeee";
#
# TODO Test interaction with C++11 raw string literals
#
# AlwaysBreakBeforeMultilineStrings: true
# Attach braces to surrounding context except break before braces on function
@ -230,13 +230,6 @@ SpacesInParentheses: false
#
SpacesInSquareBrackets: false
# Insert a space after '{' and before '}' in struct initializers
#
# This is native C++11 style, but it looks very weird.
# TODO Investigate if it has any tangible benefits.
#
# Cpp11BracedListStyle: false
# A list of macros that should be interpreted as foreach loops instead of as
# function calls.
#

View file

@ -93,15 +93,15 @@ Do not do mass reformating or renaming of existing code.
### Language
We use C-like C++11. To clarify:
We use C-like C++14. To clarify:
- Avoid designing your code in complex object-oriented style.
This does not mean "don't use classes", it means "don't use stuff like
multiple inheritance, overblown class hierarchies, operator overloading,
iostreams for stdout/stderr, etc, etc".
- C++11 has rich STL library, use it (responsibly - sometimes using
- C++14 has rich STL library, use it (responsibly - sometimes using
C standard library makes more sense).
- Use C++11 features like `constexpr`, `static_assert`, managed pointers,
- Use modern C++ features like `constexpr`, `static_assert`, managed pointers,
lambda expressions, for-each loops, etc.
- Avoid using exceptions. C++ exceptions are trickier than you think.
No, you won't get it right. Or person touching the code after you won't get

View file

@ -16,7 +16,7 @@ support today's systems.
| | dosbox-staging | DOSBox
|- |- |-
| **Version control** | Git | [SVN]
| **Language** | C++11 | C++03<sup>[1]</sup>
| **Language** | C++14 | C++03<sup>[1]</sup>
| **SDL** | 2.0 | 1.2<sup></sup>
| **CI** | Yes | No
| **Static analysis** | Yes<sup>[2],[3],[4]</sup> | No

View file

@ -54,9 +54,9 @@ AC_CHECK_SIZEOF(unsigned long)
AC_CHECK_SIZEOF(unsigned long long)
AC_CHECK_SIZEOF(int *)
dnl Require compiler with C++11 support.
dnl Require compiler with C++14 support.
dnl Allow GNU extensions to work around MinGW bugs around POSIX compatibility.
AX_CXX_COMPILE_STDCXX_11(ext, mandatory)
AX_CXX_COMPILE_STDCXX_14(ext, mandatory)
dnl some semi complex check for sys/socket so it works on darwin as well
AC_CHECK_HEADERS([stdlib.h sys/types.h])

View file

@ -40,7 +40,7 @@
#if !defined(_MSC_VER)
/* Aside of MSVC, every C++11-capable compiler provides __builtin_bswap*
/* Aside of MSVC, every C++14-capable compiler provides __builtin_bswap*
* as compiler intrinsics or builtin functions.
*/

View file

@ -29,7 +29,7 @@
// The __attribute__ syntax is supported by GCC, Clang, and IBM compilers.
//
// TODO: C++11 introduces standard syntax for implementation-defined attributes,
// TODO: C++11 introduced standard syntax for implementation-defined attributes,
// it should allow for removal of C_HAS_ATTRIBUTE from the buildsystem.
// However, the vast majority of GCC_ATTRIBUTEs in DOSBox code need
// to be reviewed, as many of them seem to be incorrectly/unnecessarily

View file

@ -94,7 +94,7 @@ void GFX_ShowMsg(char const* format,...) GCC_ATTRIBUTE(__format__(__printf__, 1,
// be redirected into internal DOSBox debugger for DOS programs (C_DEBUG feature).
#define DEBUG_LOG_MSG(...)
#else
// There's no portable way to expand variadic macro using C99/C++11 (or older)
// There's no portable way to expand variadic macro using C99/C++14 (or older)
// alone. This language limitation got removed only with C++20 (through addition
// of __VA_OPT__ macro).
#ifdef _MSC_VER