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