Open tgtakaoka opened 6 years ago
cool.
i don't understand how this stuff works in nesc and am buried in getting a release of the msp432/arm cortex-4mf based mammark code out.
is this simple to do following the proposed commits that david has done?
Thank you for being interested in. In order to support
1) restrict
, as I commented in pull request#42, a simple text substitution seems enough.
2) _Noreturn
, adding it as one of storage class specification (SCSPEC
) seems work. The change is such like adding a few lines. I'm happy to upload a pull request once I could prepare a regression test case.
3) _Bool
, adding it as one of a primitive type (TYPESPEC
) seems work, The change is not a simple but rather straightforward (adding a dozen of lines). I'll upload a pull request once I can come up with a regression test case.
Adding _Bool is definitely not going to be completely straightforward, e.g., from an extremely brief perusal of the C standard: 6.3.1.2 Boolean type: When any scalar value is converted to _Bool, the result is 0 if the value compares equal to 0; otherwise, the result is 1.
nesC does constant folding, so will need to implement this rule.
thanks to both of you.
If we find ourselves in the same place physically, beers all around (or replacement beverage of choice).
On Thu, May 3, 2018 at 9:59 PM, dgay42 notifications@github.com wrote:
Adding _Bool is definitely not going to be completely straightforward, e.g., from an extremely brief perusal of the C standard: 6.3.1.2 Boolean type: When any scalar value is converted to _Bool, the result is 0 if the value compares equal to 0; otherwise, the result is 1.
nesC does constant folding, so will need to implement this rule.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/tinyos/nesc/issues/43#issuecomment-386506029, or mute the thread https://github.com/notifications/unsubscribe-auth/AAY46b2XN-GLZDjwI-B5qdlqpkkNUH_Bks5tu-A-gaJpZM4TwjLT .
-- Eric B. Decker Senior (over 50 :-) Researcher
Thank you for your precious insight, David.
I'll look into constant folding code in nesc
and try implementing _Bool
handling.
And I pull-requested the change to support _Noreturn
. It is great if you can review it.
For constant folding of _Bool
, as far as I can tell, since _Bool
constant is parsed as int
, constant folding of _Bool
is already correctly handled by nesc
without further modification (except an issue I found with fixing).
Anyway I created a pull request for _Bool
handling. It is great if you can take a look.
It is great if
nesc
can support some of C99 and C11 reserved keywords, for instancerestrict
,_Noreturn
, and_Bool
.While I tried the latest nesc and tinyos with the beta release of TI MSP430-GCC which is based on
gcc 7.3
, I noticed thatrestrict
and_Noreturn
weren't processed correctly bynesc
and caused errors. I worked around errors by making those keywords as empty string. But supporting those keywords innesc
is apparently preferable.TinyOS defines
bool
asuint8_t
in tos.h, but defining it as_Bool
may utilize further compiler optimization.nx_bool
has similar definition too. So it is highly preferable fornesc
to support_Bool
type.