Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Clang's compile errors are great

This thread is locked; no one can reply to it. rss feed Print
Clang's compile errors are great
Mark Oates
Member #1,146
March 2001
avatar

If you guys are using a different compiler, ya'll are missing out:

{"name":"611460","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b81c3c044a25185ed716f167c17ff525.png","w":1176,"h":148,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/b\/8\/b81c3c044a25185ed716f167c17ff525"}611460

--
Visit CLUBCATT.com for cat shirts, cat mugs, puzzles, art and more <-- coupon code ALLEGRO4LIFE at checkout and get $3 off any order of 3 or more items!

AllegroFlareAllegroFlare DocsAllegroFlare GitHub

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Chris Katko
Member #1,881
January 2002
avatar

Clang is !@$!@$!@$(!&@$)(!@$()!&@$)(&!@$ amazing. The first time I finally tried it, it blew me away.

(Though I miss all the cool GCC extensions to C and C++.)

It's worlds better than GCC. And I salute GCC for their effort, but they have multiple distinct passes and optimize (and toss away data) inbetween them which means when it tries to generate error messages you get "tits all" compared to Clang.

I've been using the LLVM-backend with D (LDC) and I like that as well. Though I recently switched to DMD (the spec compiler) because it compiles faster, and has easier-to-access profiling data and more detailed usage instructions. But that's not as applicable.

Sorry but last time I tried to use Clang on Windoze it was a horrible broken mess.

Use Linux. :) Or get "Linux for Windows." But yeah, give Clang a try. It's getting better every year. (Really, every 6 months! They're rapidly passing GCC.) It's really a brilliant idea. You decouple the front-end from the back-end, keep everything modular, and you can WAY more easily add a new language to a front end, while keeping all the back-end the same. Or vice versa, and support a new OS or CPU.

Some guys literally combined D (using LDC) and... C++ (using Clang)... and combined them together to let you directly import C++ code into D code without tons of wrappers/bindings/etc. I don't think you could do that easily with any/most other compilers--especially for a project with one or two guys writing/maintaining it.

https://github.com/Syniurge/Calypso

I don't know if these numbers are meaningful, or meaningless, but they took LDC, and they're only 1310 commits ahead, added C++. Those commits could be huge, I don't know. But it seems like a small number of "decisions" needed to convert a compiler to add an entirely separate second compiler into the mix.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Sorry, clang is fail. CMake doesn't support it. Clang doesn't support windows. They claim to, but it doesn't work. At all. It tries to use MSVC.

EDIT
If there were binaries that were configured correctly for Windows I would try it again, but I don't know how to get clang to work right.

dthompson
Member #5,749
April 2005
avatar

Quote:

CMake doesn't support Clang

Correct me if I'm wrong, but aren't A5 builds (which heavily involve CMake) tested on Clang in addition to gcc?

I'm considering making the move from gcc, but would probably want to add an MSVC deviation to any Windows builds I'd do of A5 projects anyway (regardless of how hard Microsoft might try to crowbar Unix tools into Windows these days)

______________________________________________________
Website. It was freakdesign.bafsoft.net.
This isn't a game!

raynebc
Member #11,908
May 2010

I installed Clang years ago when I found they were releasing Windows binaries:
http://releases.llvm.org/download.html#6.0.0

I don't remember it being complicated, I just installed it to C:\LLVM and can invoke it separately from MinGW's GCC. I run it every once in a while to see if it picks up any warnings that GCC doesn't give.

Chris Katko
Member #1,881
January 2002
avatar

Yeah, I don't... I don't know the details for Windows. But I've had zero problems with Clang on Linux.

Like, incredibly easy to both install binaries, OR, compile straight from a git clone. All you need is some GB of space and some time, and it just runs, and finishes.

I've installed multiple forks of both LLVM and Clang (and LLVM-based LDC) with no problem.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Neil Roy
Member #2,229
April 2002
avatar

Never had a problem tracking down my bugs with GCC and Code::Blocks yet. Plus GCC is more widely supported with good extensions and up to date.

---
“I love you too.” - last words of Wanda Roy

bamccaig
Member #7,536
July 2006
avatar

Chris Katko
Member #1,881
January 2002
avatar

Yeah. C is a pretty simple language--by design. I can't imagine errors "should" be that complex compared to template within template instantiation errors.

-----sig:
“Programs should be written for people to read, and only incidentally for machines to execute.” - Structure and Interpretation of Computer Programs
"Political Correctness is fascism disguised as manners" --George Carlin

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Okay, I figured I'd give latest Clang LLVM a go. It's on version 6 point 0 and last version I tried was 3 point 9, so it's been a while.

Installing out the box, a huge red flag came up. Why does it need 1.000 GB of space? Dang dude, what gives? I'll install somewhere else, but really, sheesh. Is this VS or what?

{"name":"611480","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/5\/e56b7ecae8c1f1aa8b90bfb419b3e7db.png","w":581,"h":477,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/e\/5\/e56b7ecae8c1f1aa8b90bfb419b3e7db"}611480

EDIT
If anyone can give me a quick guide to compiling with clang (in C++) I'd like to give it a go. ;)

EDIT 2

Okay, it can compile an empty main. However it chokes on some use of std::vector<std::string>, or at least chokes out a warning and compiles anyway. However, I can't give you much credit here Oates, this one is a doozy :

e:\LLVM32\bin>clang ..\CODE\SplitTest.cpp
SplitTest-e670c2.o : warning LNK4217: locally defined symbol ___std_terminate imported in function "int `public: __thiscall std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >(void)'::`1'::dtor$2" (?dtor$2@?0???0?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAE@XZ@4HA)
SplitTest-e670c2.o : warning LNK4217: locally defined symbol __CxxThrowException@8 imported in function "int `public: void __thiscall std::vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::emplace_back<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &>(class vector<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::allocator<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > >::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)'::`1'::catch$6" (?catch$6@?0???$emplace_back@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@?$vector@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$allocator@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@2@@std@@QAEXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@1@@Z@4HA)

e:\LLVM32\bin>

Go to: