SLES 12 Toolchain Update Brings new Developer Tools

Share
Share

The GCC developers have released GCC 7 last year and we are making this new version available now as optional update for SUSE Linux Enterprise Server 12 via the Toolchain Module.

GCC 7 brings many improvements for developers as documented in the CHANGES file. I’d like to point out the following three areas of changes and explain them briefly:

  • Improved diagnostics
  • Support C++ 17 standard
  • DWARF5 support

In addition, GCC takes advantage of features of newer CPUs and contains improved optimization passes.

Improved diagnostics

Looking at security problems, the GCC developers improved their diagnostics to catch some common classes of problems. The option ‘-Wimplicit-fallthrough’ warns when a switch falls through. ‘-Wrestrict’ checks whether an argument passed to a restrict-qualified parameter aliases with another argument.

The warnings enabled by ‘-Wmemset-elt-size’ check that a memset for an array really cleans the used space and the developer has not passed the number of entries instead of the space.

To catch problems at runtime, the AddressSanitizer now supports a new option ‘-fsanitize-address-use-after-scope’. It checks for variables whose address is taken and used after a scope where the variable is defined.

The fix-it hints have been further improved, it now not only covers field names but also misspelled function names, macro names, enum values, type names, and named initializers (in C). Even the preprocessor gives now fix-it hints:

test.c:5:2: error:invalid preprocessing directive #endfi; did you mean #endif?
 #endfi
 ^~~~~
 endif

GCC can now emit these fix-it hints also in a machine readable format for IDEs or output a patch as unified diff using ‘-fdiagnostics-generate-patch’:

--- spellcheck-fields.cc
+++ spellcheck-fields.cc
 @@ -49,5 +49,5 @@

color get_color(struct s *ptr)
 {
 - return ptr->colour;
 + return ptr->color;
 }

C++ 17 standard

The ISO C++ standards committee announced the ISO C++ 17 specification in March ’17 as Draft Standard and it is going through a final editorial iteration. GCC already implements the C++ 17 specification with experimental support. The implementation includes ‘if constexpr’, class template argument deduction, ‘auto’ template parameters, and structured bindings. For details, see the GCC Cxx status page. Note that the C++ library is not feature complete yet for C++ 17.

To enable the compiler to use the C++ 17 features, add ‘-std=c++17’ or ‘-std=gnu++17’ to your g++ command line.

DWARF 5 support

DWARF is the main debugging format used by GCC. While GCC produces by default DWARF 4, the DWARF 5 is supported using the -gdwarf-5 option. DWARF 5 brings improvements that result in better performance for debugging. With the improved debugging format, debug files are compressed better and macros and source files descriptions are improved.

Additional updates

To support the new compiler – and developers using them – the binutils 2.29 and GDB 8.01 versions have been updated as well.

Noteworthy in GDB 8.0.1 is the support for DWARF 5 now and supporting of C++ rvalue references.

Using GCC 7

After installation, use gcc-7 or g++-7 instead of gcc/g++ to compile your program.

$ gcc-7 hello.c -o hello

Installation

These updates are available as part of the SUSE Linux Enterprise Server subscription. The compiler collection is available via the Toolchain module. User that want to install it, need to first register the Toolchain module and can then install it with YaST or using zypper (“zypper in gcc-7“). binutils and GDB are available as normal maintenance updates.

 

Share
(Visited 12 times, 1 visits today)

Comments

  • […] GNU Debugger 8.0.1 is a welcome addition as it also adds support for the latest DWARF 5 debugging format used by GCC, along with support of C++ rvalue references. For more details about their advantages please check out the blog story. […]

  • Leave a Reply

    Your email address will not be published. Required fields are marked *

    Avatar photo
    12,832 views