[M3devel] gcc vs. g++ in config files?
Jay K
jay.krell at cornell.edu
Tue Sep 1 19:00:07 CEST 2015
Sorry, this merits more discussion.
- There are at least three ways compilers chose between C and C++.
invocation name: gcc vs. g++, lowercase cc vs. uppercase CC
I think clang vs. clang++.
Visual C++ only has one invocation: cl
Source file extension: .c vs. .cpp, .cxx, .cc, .C, etc.This is very common with Visual C++.
Command line switches:
gcc -x c++
clang -x C++
cl -Tc means next source file is C
-TC means all are C
-Tp means next is C++
-TP means all are C++
We'd have to read up on others.
One of the combinations implemented by gcc is deprecated by clang.
I think clang++ foo.c. And, actually g++ foo.c (Apple installs clang as gcc).
So I switched to use -x c++.
"cpp" is ambiguous between C preprocessor and C++.
"cxx" is often therefore used to indicate C++. x is a rotated +.
We could have config files specify SYSTEM_CC and SYSTEM_CXX.
And we could have functions compile_c and compile_cxx.
We could have builder c_source("foo") probe for foo.c, and foo.cpp, maybe
others, error if there are multiple, and chose compile_c vs. compile_cxx.
Or compile_c could chose based on the extension.
In any case, makes changes to the C backend path, and in the llvm binding/backend
directories should be easy. We don't *have* to change the meanings everywhere
to effect them. I do not actually intend to rewrite all of our little bits
of C using C++ specific features. But the LLVM stuff uses C++ and the C backend
imho ought to.
- Jay
From: jay.krell at cornell.edu
To: m3devel at elegosoft.com
Date: Tue, 1 Sep 2015 16:28:10 +0000
Subject: [M3devel] gcc vs. g++ in config files?
I suggest we replace "gcc" with "g++".In all the config files (and in the bootstrap archives).And similar for Sun CC, and Visual C++ use -TP.
rationale: It will likely cleanup our LLVM stuff, which currently uses a custom Makefile and drops derived files into the src directory. It will ease/allow using C++ exception handling in the C backend. I've been using g++ for months/years on Darwin. counter-rationale: Not all C code is valid C++, and sometimes the meanings are different. I converted the coverage code only recently.
- Jay
_______________________________________________
M3devel mailing list
M3devel at elegosoft.com
https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20150901/e6dffbaf/attachment-0002.html>
More information about the M3devel
mailing list