04.06.2015 Views

Red Hat Developer Toolset 1.x User Guide - Linux

Red Hat Developer Toolset 1.x User Guide - Linux

Red Hat Developer Toolset 1.x User Guide - Linux

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

72 Changes in Version 1.0<br />

A.1.1.6. Miscellaneous<br />

-Ofast is now supported as a general optimization level. It operates similar to -O3, adds options that<br />

can yield better-optimized code, but in turn might invalidate standards compliance (for example, -ffastmath<br />

is enabled by -Ofast).<br />

GCC can now inform users about cases in which code generation might be improved by adding<br />

attributes such as const, pure, and noreturn to functions declared in header files. Use the -<br />

Wsuggest-attribute=[const|pure|noreturn] command line option to enable this.<br />

Assembler code can now make use of a goto feature that allows for jumps to labels in C code.<br />

A.1.2. Language Compatibility<br />

In this section, we describe the compatibility between the <strong>Red</strong> <strong>Hat</strong> <strong>Developer</strong> <strong>Toolset</strong> compilers and the<br />

<strong>Red</strong> <strong>Hat</strong> Enterprise <strong>Linux</strong> system compilers at the programming-language level (for example, differences<br />

in the implementation of language standards such as C99, or changes to the warnings generated by -<br />

Wall).<br />

Some of the changes are a result of bug fixing, and some old behaviors have been intentionally changed<br />

in order to support new standards, or relaxed in standards-conforming ways to facilitate compilation or<br />

runtime performance. Some of these changes are not visible to the naked eye and will not cause<br />

problems when updating from older versions. However, some of these changes are visible, and can<br />

cause grief to users porting to <strong>Red</strong> <strong>Hat</strong> <strong>Developer</strong> <strong>Toolset</strong>'s version of GCC. The following text attempts<br />

to identify major issues and suggests solutions.<br />

A.1.2.1. C<br />

Constant expressions are now handled by GCC in a way that conforms to C90 and C99. For code<br />

expressions that can be transformed into constants by the compiler but are in fact not constant<br />

expressions as defined by ISO C, this may cause warnings or errors.<br />

Ill-formed redeclarations of library functions are not accepted anymore by the compiler. In particular, a<br />

function with a signature similar to the built-in declaration of a library function (for example, abort() or<br />

memcpy()) must be declared with extern "C" to be considered as a redeclaration, otherwise it is illformed.<br />

Duplicate Member<br />

Consider the following struct declaration:<br />

struct A { int *a; union { struct { int *a; }; }; };<br />

Previously, this declaration used to be diagnosed just by the C++ compiler, now it is diagnosed also by<br />

the C compiler. Because of the anonymous unions and structs, there is ambiguity about what .a actually<br />

refers to and one of the fields therefore needs to be renamed.<br />

A.1.2.2. C++<br />

Header Dependency Changes<br />

, , and other STL headers that previously included as an<br />

implementation detail (to get some feature macros for gthr*.h purposes) no longer do so, because it<br />

was a C++ standard violation. This can result in diagnostic output similar to the following:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!