Comments (5)
should these macros be defined in another file e.g.
stdbool.c
rather thanc.c
?
No, maintaining our copy of <stdbool.h>
is not necessary. By leveraging the shecc-specific identifier (__SHECC__
), we can easily define the bool
-related macros directly in src/defs.h
, thereby ensuring our implementation adheres to C99 standards.
from shecc.
should these macros be defined in another file e.g. stdbool.c
rather than c.c
?
from shecc.
After further investigation by utilize bool
back on declarations, e.g. return type / parameter type in functions (see bb677b4), I found that the issue that caused stage 2 compilation failure is the global variable initialization with bool type, specifically this one. By replacing int
with bool
, the stage 2 compilation would fail.
I think this is not frontend but codegen's fault?
from shecc.
This problem is probably caused by the unmatched size of the datatype when allocating variable in either
Lines 259 to 265 in cb49429
or
Lines 347 to 352 in cb49429
We need to check the type bool
also.
BTW, can we simply replace the macro in lib/c.c
Line 12 in cb49429
with
- type = add_named_type("_Bool");
+ type = add_named_type("bool");
at src/parser.c
?
Line 2882 in cb49429
The current preprocessor only support number or string if it is not a function-like macro.
from shecc.
Current macro supports identifier macro but only "_Bool" will be supported at this moment
Lines 391 to 394 in cb49429
Lines 524 to 530 in cb49429
And I will rework on frontend tokenizing process recently to hopefully eliminate some unintentional limitations, e.g. single token aliasing in macro.
from shecc.
Related Issues (20)
- Integrate with semu HOT 5
- Parse syntax for include macro in parser.c HOT 5
- Uninitialized variable: pred HOT 2
- The peephole optimization breaks the macro expansion HOT 2
- Declare variables where needed
- Fail to self-host HOT 1
- Unable to self compile stage 1 HOT 1
- Fail to pass stage1 HOT 6
- For a coding question: about parser HOT 3
- Error on make: /bin/sh: line 1: 21530 Segmentation fault out/shecc --dump-ir -o out/shecc-stage1.elf HOT 7
- Support conversion specifier ā%cā inside printf HOT 1
- Support mmap on shecc HOT 2
- Improve intermediate representation and also register allocation
- Handle non-zero integers in if statements HOT 1
- Thoughts on cfront's potential improvements HOT 11
- Determine the factors contributing to unexpected slowdowns during self-hosting HOT 2
- Eliminate compilation warnings
- Implement basic optimizations HOT 3
- High branch-miss rate when hosting shecc on the Raspberry Pi 3B
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shecc.