public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/58289] New: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs
@ 2013-09-01 5:33 jklowden at schemamania dot org
2013-09-01 18:06 ` [Bug bootstrap/58289] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: jklowden at schemamania dot org @ 2013-09-01 5:33 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58289
Bug ID: 58289
Summary: gcc/gengtype.c includes gcc/double-int.h, which uses
C++ constructs
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: jklowden at schemamania dot org
I pulled from svn://gcc.gnu.org/svn/gcc/trunk today to build gcc on OS X using
Clang. Some header files use C++ syntax, but are included in C files. The
error I'm seeing is:
/Developer/usr/bin/clang [...options omitted...]
-o build/gengtype.o ../../gcc/gengtype.c
[...warnings ommitted...]
In file included from ../../gcc/gengtype.c:28:
../../gcc/double-int.h:58:10: error: must use 'struct' tag to refer to type
'double_int'
static double_int from_uhwi (unsigned HOST_WIDE_INT cst);
The error stems from this construct in double-int.h:
==snip==
struct double_int
{
/* Normally, we would define constructors to create instances.
Two things prevent us from doing so.
First, defining a constructor makes the class non-POD in C++03,
and we certainly want double_int to be a POD.
Second, the GCC conding conventions prefer explicit conversion,
and explicit conversion operators are not available until C++11. */
static double_int from_uhwi (unsigned HOST_WIDE_INT cst);
==pins==
Comment not withstanding, the file could easily be converted to C; there are no
classes declared, for instance. All that's needed is say,
static struct double-int from_uhwi = cst;
perhaps with a cast.
I found similar problems in two other files that were small enough to repair or
work around. This file seems to be a pupa determined to become C++, and I'm
not quite sure what should be done.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/58289] gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs
2013-09-01 5:33 [Bug bootstrap/58289] New: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs jklowden at schemamania dot org
@ 2013-09-01 18:06 ` pinskia at gcc dot gnu.org
2013-09-02 3:37 ` jklowden at schemamania dot org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2013-09-01 18:06 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58289
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC is now a C++ program even though it uses the .c file extension. Use clang
in C++ mode instead.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/58289] gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs
2013-09-01 5:33 [Bug bootstrap/58289] New: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs jklowden at schemamania dot org
2013-09-01 18:06 ` [Bug bootstrap/58289] " pinskia at gcc dot gnu.org
@ 2013-09-02 3:37 ` jklowden at schemamania dot org
2013-09-02 7:14 ` jakub at gcc dot gnu.org
2013-09-02 8:01 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jklowden at schemamania dot org @ 2013-09-02 3:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58289
--- Comment #2 from James K. Lowden <jklowden at schemamania dot org> ---
(In reply to Andrew Pinski from comment #1)
> GCC is now a C++ program even though it uses the .c file extension. Use
> clang in C++ mode instead.
Thank you, but the the problem is not completely solved.
1. This is not mentioned anywhere in
http://gcc.gnu.org/install/configure.html.
2. Not all .c files needed to build gcc are C++. Setting Clang to compile
all files as C++ means libiberty cannot be compiled:
../../../libiberty/sha1.c:235:11: error: '<anonymous struct at
../../../libiberty/sha1.c:235:11>' can not be defined in a type specifier
The compiler has precious little information to tell it what language to use.
How to distinguish between C and C++ if not by the extension? Particularly in
a project with both C and C++ source files among its build-time dependencies?
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/58289] gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs
2013-09-01 5:33 [Bug bootstrap/58289] New: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs jklowden at schemamania dot org
2013-09-01 18:06 ` [Bug bootstrap/58289] " pinskia at gcc dot gnu.org
2013-09-02 3:37 ` jklowden at schemamania dot org
@ 2013-09-02 7:14 ` jakub at gcc dot gnu.org
2013-09-02 8:01 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2013-09-02 7:14 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58289
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The Makefiles use different variables for C and C++ compilers, CC for the
former and CXX for the latter.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug bootstrap/58289] gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs
2013-09-01 5:33 [Bug bootstrap/58289] New: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs jklowden at schemamania dot org
` (2 preceding siblings ...)
2013-09-02 7:14 ` jakub at gcc dot gnu.org
@ 2013-09-02 8:01 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2013-09-02 8:01 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58289
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to James K. Lowden from comment #2)
> 1. This is not mentioned anywhere in
> http://gcc.gnu.org/install/configure.html.
http://gcc.gnu.org/install/prerequisites.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-09-02 8:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-01 5:33 [Bug bootstrap/58289] New: gcc/gengtype.c includes gcc/double-int.h, which uses C++ constructs jklowden at schemamania dot org
2013-09-01 18:06 ` [Bug bootstrap/58289] " pinskia at gcc dot gnu.org
2013-09-02 3:37 ` jklowden at schemamania dot org
2013-09-02 7:14 ` jakub at gcc dot gnu.org
2013-09-02 8:01 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).