Bug #5367
complex.h /* #if !defined(__cplusplus) */ comment foils gcc fixincludes
Start date:
2014-11-22
Due date:
% Done:
100%
Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:
Description
With the recently merged libm, the beginning of complex.h is as follows:
#ifndef _COMPLEX_H #define _COMPLEX_H #ifdef __cplusplus extern "C" { #endif /* #if !defined(__cplusplus) */ /* * Compilation environments for Solaris must provide the _Imaginary datatype * and the compiler intrinsics _Complex_I and _Imaginary_I */
so fixincludes, when building gcc, will conveniently substitute this 'marker' line giving:
#ifndef _COMPLEX_H #define _COMPLEX_H #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus extern "C" { #endif /* * Compilation environments for Solaris must provide the _Imaginary datatype * and the compiler intrinsics _Complex_I and _Imaginary_I */
unfortunately, adding the opening brace causes precompiler issues as the corresponding closing brace is not added at the same time.
As provided to Piotr, simply deleting these comments seems to get over the problem.
Files
Updated by Richard PALO about 6 years ago
Just to show the problem on unfixed omnios bloody with gcc4.8
and with gcc49 fixed up in pkgsrc...
richard@omnis:/home/richard/src$ cat foo.cpp #include <complex.h> double foo() { double complex z1 = 1.0 - 4.0*I; return creal(z1); } richard@omnis:/home/richard/src$ /opt/gcc-4.8.1/bin/g++ -c foo.cpp foo.cpp: In function ‘double foo()’: foo.cpp:5:17: error: expected initializer before ‘z1’ double complex z1 = 1.0 - 4.0*I; ^ foo.cpp:6:15: error: ‘z1’ was not declared in this scope return creal(z1); ^ foo.cpp:6:17: error: ‘creal’ was not declared in this scope return creal(z1); ^ richard@omnis:/home/richard/src$ /opt/local/gcc49/bin/g++ -c foo.cpp richard@omnis:/home/richard/src$
Updated by Electric Monk about 6 years ago
- Status changed from New to Closed
- % Done changed from 0 to 100
git commit 0b51021a5ac604aec4fe23e2cdcf97e3e886b9ec
commit 0b51021a5ac604aec4fe23e2cdcf97e3e886b9ec Author: Piotr Jasiukajtis <estibi@me.com> Date: 2014-11-26T21:44:21.000Z 5367 complex.h /* #if !defined(__cplusplus) */ comment foils gcc fixincludes Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com> Approved by: Dan McDonald <danmcd@omniti.com>