Samraksh / eMote

eMote OS -- Multiple Ports (using .NET MF v4.3)
0 stars 0 forks source link

C++11 switch- resolve previous build warnings #430

Closed MichaelAtSamraksh closed 8 years ago

MichaelAtSamraksh commented 8 years ago

References: commit 3590e0b25d2872a5590ad487ac56f9d9a1461562 "Use ISO C11 instead of GCC defaults." and issue #428 "PortableArrayKitMessage.cpp does not build in GCC 5.4.1"

While I support staying current, switching to c++11 whisks away some unresolved build warnings about struct variable initializations-- warnings that are emitted when compiling the current Samraksh Emote master branch. I feel that those build warnings should be addressed before we convert to c++11 and forget about them. Safety in paranoia. After the non-c++11 build warnings are addressed, I look forward to using static asserts to write better code.

FYI, here is a quick diff of GCC 4.9.3 build flags triggered by -std=c++11:

In GCC 4.9.3: Additions:

#define __cpp_attributes 200809
#define __cpp_static_assert 200410
#define __cpp_variadic_templates 200704
#define __GXX_EXPERIMENTAL_CXX0X__ 1
#define __GNUC_STDC_INLINE__ 1
#define __cpp_raw_strings 200710
#define __STRICT_ANSI__ 1
#define __cpp_rvalue_reference 200610
#define __cpp_lambdas 200907
#define __cpp_unicode_characters 200704
#define __cpp_unicode_literals 200710
#define __cpp_decltype 200707
#define __cpp_alias_templates 200704
#define __cpp_constexpr 200704
#define __cpp_user_defined_literals 200809

Changes: #define __cplusplus 199711L changes to #define __cplusplus 201103L

Deletions: #define __GNUC_GNU_INLINE__ 1

Nathan-Stohs commented 8 years ago

Perhaps I am being too sanguine about this. Mike, how would you feel if instead of using -std=c++11 we use:

#define _POSIX_C_SOURCE=200809L

(by adding as a -D option to GCC)

The goal here is to remove extensions we don't use, in particular the BSD stuff. This would have the same effect by limiting to POSIX extensions.

EDIT: One second though, it looks like _ISOC99_SOURCE would be most appropriate?

MichaelAtSamraksh commented 8 years ago

I just care about resolving the old build warnings to ensure our code is completely initialized, so I created the ticket. c++11 seems to be fine, I just care about the initialization warnings without c++11.