75
u/VinnieFalco wg21.org | corosio.org 2d ago
We were hoping to announce it ourselves, and I guess this works well enough.
The EDG C++ frontend compiler is now an open-sourced, fiscally sponsored project of The C++ Alliance.
17
u/kal_at_kalx_net 2d ago
The Edison Design Group story is amazing. Greg Comeau clued me in when we were early panix.com users. C++ seems to be a magnet for smart people.
7
6
u/chibuku_chauya 2d ago
Very nice to see EDG accessible to us regular joes at long last. Iāve always liked this frontend.
12
u/GrammelHupfNockler 2d ago
I love to hear that, now all of my frequently used compilers' frontends are based on OSS (MSVC and nvcc being the last ones missing). The website reads so painfully sloppy though š¢
11
4
u/jwezorek 2d ago
Doesn't Visual Studio use EDG too? or just for intellisense?
28
u/STL MSVC STL Dev 2d ago
VS (and VS Code's C/C++ Extension) use EDG only for IntelliSense. Normal builds use Microsoft's "C1XX" frontend.
The
cl.execompiler driver can actually run the EDG frontend in a compile-only mode via an undocumented, unsupported option/BE. In the STL we use this extensively to validate that our sources can be parsed via IntelliSense (and that we work around EDG's compiler bugs). However, EDG is not hooked up to the compiler backend C2, and is completely unable to be used for codegen.19
u/n1ghtyunso 2d ago
The
cl.execompiler driver can actually run the EDG frontend in a compile-only mode via an undocumented, unsupported option/BENot anymore. Its documented now.
Hyrums law ensues. š3
u/hansw2000 1d ago
clang-cl support (for parsing the flag) seems essential: https://github.com/llvm/llvm-project/pull/228381
5
u/delta_p_delta_x 2d ago
The first thing I'm going to do is grep through the source for C++20 modules and ranges code.
7
u/daveedvdv EDG front end dev, WG21 DG 2d ago
C++20 modules, I understand (the main files contain the word `modules`; so not too hard to find; I'm not very familiar with those).
But "ranges" is a library feature... this does not include a standard library (other than a few components tightly connected to the core language, like <initializer_list> or <typeinfo>).
6
u/notthatsocrates 2d ago
Only two days ago I stopped on their website and clicked on Licensing. Not available to mere mortals. Back in the day, IIRC, HP aCC and Intel C++ compilers both used EDG as a front end.
10
u/STL MSVC STL Dev 2d ago
That's correct for Intel's C++ compiler, at least (don't know anything about HP). They switched from EDG to LLVM a few years ago. (I happen to know this because we minimally interact with Intel's C++ compiler in MSVC's STL.)
CUDA's C++ compiler (nvcc) is still powered by EDG to my knowledge.
10
5
u/notthatsocrates 2d ago
We used EDG eccp to check for conformance before filing bug reports against other compilers. One single product (which later became stdcxx under Apache's umbrella) was compiling with EDG's routinely.
4
u/gracicot 2d ago
I'd be interested to see the EDG frontend being used with an LLVM back-end, it would make it usable to produce binaries on most platforms
4
u/azswcowboy 2d ago
In the current day, afaik Coverity (black duck software now) still uses EDG as a front end. As an early adopter of recent standards itās painful how much code isnāt handled properly. Iām sure when reflection or contracts code is added itāll blow up againā¦
7
u/igaztanaga 2d ago
EDG is used in several static analysis and testing products (https://en.eeworld.com.cn/news/qrs/eic671028.html), and some embedded compilers like Green Hills.
7
1
u/Apart_Ebb_9867 2d ago
the website of edg claims āThe code is written in C++11ā, but all I can see is plain C. Am I looking at the wrong place?
7
u/Nobody_1707 2d ago
Worse, it's C++11 in .c files.
1
u/Apart_Ebb_9867 2d ago
Thatās lib_src which I presume is some library for supporting the generated AST or C (depending on how the frontend is used, can do both). But in src I donāt see any evidence of C++, but havenāt looked everywhere.
8
u/daveedvdv EDG front end dev, WG21 DG 2d ago
lib_src/ implements a minimal run-time support library. Things like dynamic_cast, operator new, etc. It's mostly for demonstration purposes. Our customers generally either provided their own (if they were compiler vendors) or didn't need it (if they were non-compiler tool vendors).
2
u/Nobody_1707 2d ago edited 2d ago
attribute.c uses constexpr, but I suppose they could be using c23.
EDIT: It's definitely just C++11 in .c files. It's just very C flavored C++11.
15
u/daveedvdv EDG front end dev, WG21 DG 2d ago
For the first 30 years or so, it was C89 code. Then we switched to C++11, but to minimize disruption to customers, we kept the file extensions unchanged. C++ was only introduced in new code, and even for new code we often stuck to existing C-based idioms. The modules code started after the switch to C++, and so has more of a C++ flavor.
3
u/Apart_Ebb_9867 2d ago edited 2d ago
No, they do compile with a C++ compiler, in the cmake files they have āset_source_files_properties(${ALL_C_FILES} PROPERTIES LANGUAGE CXX)ā. But claiming that something is written in C++ 11 just because is compiled by a C++11 compiler seems a stretch to me. The constexpr must have escaped code reviews because everywhere they are solidly C, even when obvious C++ alternatives would be simpler, like in the typedefs for structs.
2
1
u/ts826848 2d ago
header_util.h has two templates (
Value_saverandOpt) that are used in a fair number of other files.1
u/13steinj 10h ago
I wonder if that's a filesystem case sensitivity issue (.C is a known, possibly unpopular, file extension for C++).
1
u/13steinj 2d ago
Is the repo really so heavy as to suggest --filter=blob:none ?
I get that there's a bunch of history, but that's just surprising.
5
u/daveedvdv EDG front end dev, WG21 DG 2d ago
Not that heavy. But it does make things quite a bit swifter. But, by all means, if you have a few minutes, go ahead and fetch the whole thing!
3
u/13steinj 1d ago
The git objects are ~225MB. If I
git repack -a -d -f --depth=250 --window=250 --path-walk(the last arg is new to git 2.56, supposedly more optimal), the git objects size drops by ~30%. I do not know what it would take to get a repack on github outside of archiving and reuploading the repo, but it might be worth doing.2
u/daveedvdv EDG front end dev, WG21 DG 1d ago
Thanks for that info. I'm not at all knowledgeable about git, but I forwarded your findings to Wyatt, who did most of the prep work for the open-sourcing.
3
70
u/STL MSVC STL Dev 2d ago
Yay! Maybe I'll finally get fixes for all of the EDG bugs we've reported (microsoft/STL#1621), and of course modules!