illumos / cpp Goto Github PK
View Code? Open in Web Editor NEWGive me that old time preprocessor -- it's good enough for me!
Give me that old time preprocessor -- it's good enough for me!
Joyent never quite got around to completing review and testing on TritonDataCenter/illumos-extra#12 (submitted by @richlowe), which forms the basis of this repository. We should do that. Rich's comments reproduced below:
richlowe commented on Sep 21, 2013:
This contains a chunk of fixes to improve compatible with Sun cpp
(or correctness in general). It started out as a fix for
TritonDataCenter/smartos-live#171 but grew as more problems became apparent.There are still at least 2 issues outstanding:
As documented in the first non-HACK commit, our treatment of
spaces in macros is, while considerably better, still not
strictly compatible in a couple of ways that might be
important#if conditions are not macro-expanded prior to being
processed, such that#if SOME_MACRO(5)
is a syntax error.
This is proving particularly frustrating to fix.This will definitely require more testing on the SmartOS side to
be really sure it's safe, I'd recommend a complete platform build,
testing of any SDC bits that usedtrace -C
, at least. I'd also
probably suggest runningtest.sh | squash.py
over a SmartOS
/usr/include
and checking for anything that would affect the
parseability of the result. (this is why I left them in the
source).
richlowe commented on Oct 7, 2013:
I'm more concerned with review than testing. Making sure SDC isn't
broken, etc, is important, but the scripts I attached and their
results (and just how plainly wrong some of the prior behaviour
was) suggest it's pretty unlikely. The major concern I have is
that the code is so interestingly structured (because here on the
11/34, we don't have much memory to play with!), that I could have
screwed it entirely and have it still just about work right :\
I think that fixing cpp like this is probably the right thing to
do short-term, but I pretty firmly believe that -- given just how
broken this cpp is and was -- that switching to an ANSI cpp while
perhaps wrong is actually not any worse. I think the damage to
dtrace -C
would be real, but minimal (and probably defensible).
The real problem would be how much pain it causedas
.
Take the following:
$ cat wtf.cpp
#define WTF " this is a string with spaces"
" this is a string with spaces"
WTF
This is the kind of output we would expect:
$ cat wtf.cpp | /opt/gcc-12/bin/cpp
# 0 "<stdin>"
# 0 "<built-in>"
# 0 "<command-line>"
# 1 "<stdin>"
" this is a string with spaces"
" this is a string with spaces"
In antiquarian CPP, however:
$ cat wtf.cpp | ./cpp/src/cpp
# 1 ""
" this is a string with spaces"
" this is a string with spaces"
This is due to fixing TritonDataCenter/smartos-live#171, and in particular, this code:
Lines 1307 to 1318 in f75fd24
Unforunately, this behavior is causing a DTrace test suite failure, as macros in https://github.com/illumos/illumos-gate/blob/master/usr/src/cmd/dtrace/test/tst/common/json/tst.general.d contain spaces that are being incorrectly elided.
It's unclear how hard this would be to fix or if the cure is worse than the disease on this one. If DTrace is the only consumer (but it sounds like as
is also still a consumer?), it would probabably be be worth moving to an ANSI-compatible CPP in /usr/lib
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.