[M3devel] gcc vs. g++ in config files?
microcode at zoho.com
microcode at zoho.com
Tue Sep 1 19:08:58 CEST 2015
Since you or somebody else mentioned autotools, I think the way this is
normally handled is for the script to use cc or CC and it expects you to
set those values in your shell to whatever compiler you want to use.
On Tue, Sep 01, 2015 at 05:00:07PM +0000, Jay K wrote:
> 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
> _______________________________________________
> M3devel mailing list
> M3devel at elegosoft.com
> https://mail.elegosoft.com/cgi-bin/mailman/listinfo/m3devel
--
More information about the M3devel
mailing list