热爱生活,热爱linux

KDE 4.0-alpha1发布 代号Knut
Nero Linux 3发布

GCC 4.2.0发布

linuxfan posted @ 2007年5月18日 04:34 in 新闻 with tags gcc linux , 2428 阅读

GCC 4.2 Release Series
Changes, New Features, and Fixes

Caveats

  • GCC no longer accepts the -fshared-data option. This option has had no effect in any GCC 4 release; the targets to which the option used to apply had been removed before GCC 4.0.

General Optimizer Improvements

  • New command-line options specify the possible relationships among parameters and between parameters and global data. For example, -fargument-noalias-anything specifies that arguments do not alias any other storage.

    Each language will automatically use whatever option is required by the language standard. You should not need to use these options yourself.

New Languages and Language specific improvements

  • OpenMP is now supported for the C, C++ and Fortran compilers.
  • New command line options -fstrict-overflow and -Wstrict-overflow have been added. -fstrict-overflow tells the compiler that it may assume that the program follows the strict signed overflow semantics permitted for the language: for C and C++ this means that the compiler may assume that signed overflow does not occur. For example, a loop like
    for (i = 1; i > 0; i *= 2)
    is presumably intended to continue looping until i overflows. With -fstrict-overflow, the compiler may assume that signed overflow will not occur, and transform this into an infinite loop. -fstrict-overflow is turned on by default at -O2, and may be disabled via -fno-strict-overflow. The -Wstrict-overflow option may be used to warn about cases where the compiler assumes that signed overflow will not occur. It takes five different levels: -Wstrict-overflow=1 to 5. See the documentation for details. -Wstrict-overflow=1 is enabled by -Wall.
  • The new command line option -fno-toplevel-reorder directs GCC to emit top-level functions, variables, and asm statements in the same order that they appear in the input file. This is intended to support existing code which relies on a particular ordering (for example, code which uses top-level asm statements to switch sections). For new code, it is generally better to use function and variable attributes. The -fno-toplevel-reorder option may be used for most cases which currently use -fno-unit-at-a-time. The -fno-unit-at-a-time option will be removed in some future version of GCC. If you know of a case which requires -fno-unit-at-a-time which is not fixed by -fno-toplevel-reorder, please open a bug report.

C family

  • The pragma redefine_extname will now macro expand its tokens for compatibility with SunPRO.
  • In the next release of GCC, 4.3, -std=c99 or -std=gnu99 will direct GCC to handle inline functions as specified in the C99 standard. In preparation for this, GCC 4.2 will warn about any use of non-static inline functions in gnu99 or c99 mode. This new warning may be disabled with the new gnu_inline function attribute or the new -fgnu89-inline command line option. Also, GCC 4.2 and later will define one of the preprocessor macros __GNUC_GNU_INLINE__ or __GNUC_STDC_INLINE__ to indicate the semantics of inline functions in the current compilation.
  • A new command line option -Waddress has been added to warn about suspicious uses of memory addresses as, for example, using the address of a function in a conditional expression, and comparisons against the memory address of a string literal. This warning is enabled by -Wall.

C++

  • C++ visibility handling has been overhauled.

    Restricted visiblity is propagated from classes to members, from functions to local statics, and from templates and template arguments to instantiations, unless the latter has explicitly declared visibility.

    The visibility attribute for a class must come between the class-key and the name, not after the closing brace.

    Attributes are now allowed for enums and elaborated-type-specifiers that only declare a type.

    Members of the anonymous namespace are now local to a particular translation unit, along with any other declarations which use them, though they are still treated as having external linkage for language semantics.

  • The (undocumented) extension which permitted templates with default arguments to be bound to template template parameters with fewer parameters has been removed. For example:
    template <template <typename> class C>
    void f(C<double>) {}

    template <typename T, typename U = int>
    struct S {};

    template void f(S<double>);
    is no longer accepted by G++. The reason this code is not accepted is that S is a template with two parameters; therefore, it cannot be bound to C which has only one parameter.
  • The <?, >?, <?=, and >?= operators, deprecated in previous GCC releases, have been removed.
  • The command line option -fconst-strings, deprecated in previous GCC releases, has been removed.
  • The configure variable enable-__cxa_atexit is now enabled by default for more targets. Enabling this variable is necessary in order for static destructors to be executed in the correct order, but it depends upon the presence of a non-standard C library in the target library in order to work. The variable is now enabled for more targets which are known to have suitable C libraries.
  • -Wextra will produce warnings for if statements with a semicolon as the only body, to catch code like:
    if (a);
    return 1;
    return 0;
    To suppress the warning in valid cases, use { } instead.
  • The C++ frontend now also produces strict aliasing warnings when -fstrict-aliasing -Wstrict-aliasing is in effect.

Runtime Library (libstdc++)

  • Added support for TR1 <random>, <complex>, and C compatibility headers. In addition, a lock-free version of shared_ptr was contributed as part of Phillip Jordan's Google Summer of Code project on lock-free containers. The implementation status for TR1 can be tracked in tr1.html
  • In association with the Summer of Code work on lock-free containers, the interface for atomic builtins was adjusted, creating simpler alternatives for non-threaded code paths. Also, usage was consolidated and all elements were moved from namespace std to namespace__gnu_cxx. Affected interfaces are the functions __exchange_and_add, __atomic_add, and the objects __mutex, __recursive_mutex, and __scoped_lock.
  • Support for versioning weak symbol names via namespace association was added. However, as this changes the names of exported symbols, this is turned off by default in the current ABI. Intrepid users can enable this feature by using --enable-symvers=gnu-versioned-namespace during configuration.
  • Revised, simplified, and expanded policy-based associative containers, including data types for tree and trie forms (basic_tree, tree, trie), lists (list_update), and both collision-chaining and probing hash-based containers (basic_hash_table, cc_hash_table, gp_hash_table). More details per the documentation.
  • The implementation of the debug mode was modified, whereby the debug namespaces were nested inside of namespace std and namespace __gnu_cxx in order to resolve some long standing corner cases involving name lookup. Debug functionality from the policy-based data structures was consolidated and enabled with the single macro, _GLIBCXX_DEBUG. See PR 26142 for more information.
  • Added extensions for type traits: __conditional_type, __numeric_traits, __add_unsigned, __removed_unsigned, __enable_if.
  • Added a typelist implementation for compile-time meta-programming. Elements for typelist construction and operation can be found within namespace __gnu_cxx::typelist.
  • Added a new allocator, __gnu_cxx::throw_allocator, for testing exception-safety.
  • Enabled library-wide visibility control, allowing -fvisibility to be used.
  • Consolidated all nested namespaces and the conversion of __gnu_internal implementation-private details to anonymous namespaces whenever possible.
  • Implemented LWG resolutions DR 431 and DR 538.

Fortran

  • Support for allocatable components has been added (TR 15581 and Fortran 2003).
  • Support for the Fortran 2003 streaming IO extension has been added.
  • The GNU Fortran compiler now uses 4-byte record markers by default for unformatted files to be compatible with g77 and most other compilers. The implementation allows for records greater than 2 GB and is compatible with several other compilers. Older versions of gfortran used 8-byte record markers by default (on most systems). In order to change the length of the record markers, e.g. to read unformatted files created by older gfortran versions, the -frecord-marker=8 option can be used.

Java (GCJ)

  • A new command line option -static-libgcj has been added for targets that use a linker compatible with GNU Binutils. As its name implies, this causes libgcj to be linked statically. In some cases this causes the resulting executable to start faster and use less memory than if the shared version of libgcj were used. However caution should be used as it can also cause essential parts of the library to be omitted. Some of these issues are discussed in: http://gcc.gnu.org/wiki/Statically%20linking%20libgcj
  • fastjar is no longer bundled with GCC. To build libgcj, you will need either InfoZIP (both zip and unzip) or an external jar program. In the former case, the GCC build will install a jar shell script that is based on InfoZIP and provides the same functionality as fastjar.

New Targets and Target Specific Improvements

IA-32/x86-64

  • -mtune=generic can now be used to generate code running well on common x86 chips. This includes AMD Athlon, AMD Opteron, Intel Pentium-M, Intel Pentium 4 and Intel Core 2.
  • -mtune=native and -march=native will produce code optimized for the host architecture as detected using the cpuid instruction.
  • Added a new command line option -fstackrealign and and __attribute__ ((force_align_arg_pointer)) to realign the stack at runtime. This allows functions compiled with a vector-aligned stack to be invoked from legacy objects that keep only word-alignment.

SPARC

  • The default CPU setting has been changed from V7 to V9 in 32-bit mode on Solaris 7 and above. This is already the case in 64-bit mode. It can be overridden by specifying --with-cpu at configure time.
  • Back-end support of built-in functions for atomic memory access has been implemented.
  • Support for the Sun UltraSPARC T1 (Niagara) processor has been added.

M32C

  • Various bug fixes have made some functions (notably, functions returning structures) incompatible with previous releases. Recompiling all libraries is recommended. Note that code quality has considerably improved since 4.1, making a recompile even more beneficial.

MIPS

  • Added support for the Broadcom SB-1A core.

IA-64

  • Added support for IA-64 data and control speculation. By default speculation is enabled only during second scheduler pass. A number of machine flags was introduced to control the usage of speculation for both scheduler passes.

HPPA

  • Added Java language support (libffi and libjava) for 32-bit HP-UX 11 target.

Obsolete Systems

Documentation improvements

PDF Documentation

  • A make pdf target has been added to the top-level makefile, enabling automated production of PDF documentation files. (Front-ends external to GCC should modify their Make-lang.in file to add a lang.pdf: target.)

Other significant improvements

Build system improvements

  • All the components of the compiler are now bootstrapped by default. This improves the resilience to bugs in the system compiler or binary compatibility problems, as well as providing better testing of GCC 4.2 itself. In addition, if you build the compiler from a combined tree, the assembler, linker, etc. will also be bootstrapped (i.e. built with themselves).

    You can disable this behavior, and go back to the pre-GCC 4.2 set up, by configuring GCC with --disable-bootstrap.

  • The rules that configure follows to find target tools resemble more closely the locations that the built compiler will search. In addition, you can use the new configure option --with-target-tools to specify where to find the target tools used during the build, without affecting what the built compiler will use.

    This can be especially useful when building packages of GCC. For example, you may want to build GCC with GNU as or ld, even if the resulting compiler to work with the native assembler and linker. To do so, you can use --with-target-tools to point to the native tools.

Incompatible changes to the build system

  • Front-ends external to GCC should modify their Make-lang.in file to replace double-colon rules (e.g. dvi::) with normal rules (like lang.dvi:). Front-end makefile hooks do not use double-colon rules anymore.
  • Up to GCC 4.1, a popular way to specify the target tools used during the build was to create directories named gas, binutils, etc. in the build tree, and create links to the tools from there. This does not work any more when the compiler is bootstrapped. The new configure option --with-target-tools provides a better way to achieve the same effect, and works for all native and cross settings.

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter