Menu

#5720 Add enabling extension definitions for `-std=c++11` option

Fixed
2020-02-06
2020-02-01
No

The compiler option -std=c++11 means
to follow the strict C++11 standard,
and cannot use several extensions
such as POSIX functions/definitions
(e.g. M_PI, strdup, putenv, and chroot).

With the option, some environments (e.g. Linux)
can use the extensions as it is,
but other environments require definitions (e.g. _GNU_SOURCE)
to enable the extensions.

This commit makes
configure script checks the environments and adds the definitions.

http://codereview.appspot.com/579270051

Discussion

  • Anonymous

    Anonymous - 2020-02-01
    • Description has changed:

    Diff:

    
    
    • Needs: -->
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2020-02-01

    Passes make, make test-baseline and a full make doc.

     
  • Masamichi Hosoda

    • summary: Fix C++11 option --> Add enabling extension definitions for -std=c++11 option The compiler option -std=c++11 means to follow the strict C++11 standard, and cannot use several extensions such as POSIX functions/definitions (e.g. M_PI, strdup, putenv, and chroot). With the option, some environments (e.g. Linux) can use the extensions as it is, but other environments require definitions (e.g. _GNU_SOURCE) to enable the extensions. This commit makes configure script checks the environments and adds the definitions.
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,14 +1,15 @@
    -Fix C++11 option
    +The compiler option `-std=c++11` means
    +to follow the strict C++11 standard,
    +and cannot use several extensions
    +such as POSIX functions/definitions
    +(e.g. M_PI, strdup, putenv, and chroot).
    
    -On the Linux environments,
    -`M_PI` definition can be used with the `-std=c++11` option.
    -However, on the other environments (e.g. MinGW),
    -`M_PI` cannot be used with the `-std=c++11` option.
    +With the option, some environments (e.g. Linux)
    +can use the extensions as it is,
    +but other environments require definitions (e.g. `_GNU_SOURCE`)
    +to enable the extensions.
    
    -Originally `-std=c++11` is an option to follow the strict C++ standard,
    -and cannot use `M_PI` that is not in the C++ standard.
    -To use `M_PI`, `-std=gnu++11` instead of `-std=c++11` is required.
    -
    -Also, the current default for g++ is `-std=gnu++14`, not `-std=c++14`.
    +This commit makes
    +configure script checks the environments and adds the definitions.
    
     http://codereview.appspot.com/579270051
    
    • Needs: -->
    • Type: -->
     
  • Masamichi Hosoda

    use AC_USE_SYSTEM_EXTENSIONS
    Reply

    http://codereview.appspot.com/579270051

     
  • Anonymous

    Anonymous - 2020-02-02
    • summary: Add enabling extension definitions for -std=c++11 option The compiler option -std=c++11 means to follow the strict C++11 standard, and cannot use several extensions such as POSIX functions/definitions (e.g. M_PI, strdup, putenv, and chroot). With the option, some environments (e.g. Linux) can use the extensions as it is, but other environments require definitions (e.g. _GNU_SOURCE) to enable the extensions. This commit makes configure script checks the environments and adds the definitions. --> Add enabling extension definitions for -std=c++11 option
     
  • Anonymous

    Anonymous - 2020-02-02
    • Patch: new --> review
     
  • Anonymous

    Anonymous - 2020-02-02

    Passes make, make test-baseline and a full make doc.

     
  • Anonymous

    Anonymous - 2020-02-04
    • Patch: review --> countdown
     
  • Anonymous

    Anonymous - 2020-02-04

    Patch on countdown for Feb 6th.

     
  • Anonymous

    Anonymous - 2020-02-06
    • Patch: countdown --> push
     
  • Anonymous

    Anonymous - 2020-02-06

    Patch counted down - please push.

     
  • Masamichi Hosoda

    • labels: --> Fixed_2_21_0
    • status: Started --> Fixed
    • Patch: push -->
     
  • Masamichi Hosoda

    I've pushed.

    commit 7396a28bde310c5f43d7dcbd3dfc8f708726f3de