-
-
Notifications
You must be signed in to change notification settings - Fork 7k
New preprocessor #2729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New preprocessor #2729
Conversation
There is a problem with the function prototype generation.
generates the prototype
however that causes the compiler to fail
|
What is the correct prototype? |
Is the correct prototype. |
or with "const" if you like but without the default arguments |
Please ignore previous (deleted) build message. A new build with a fix is backing |
Ok I've fixed the issue. Given function
the correct preprocessor result should have the prototype specify the default values and the implemention just mention the var names, like
However this would mean modify your code and we will NOT do that. Instead, we now generate this code
Where default values are in the implementation, not in the prototype. This is not correct, but compiles and works fine. If you want to have the correct version, you need to type the prototype yourself: this new preprocessor will not generate prototypes when they are already specified. |
Build failed. |
I've just found out it doesn't work if you have a configuration |
OK, I downloaded the PR-2729-BUILD-219-macosx.zip, which contained only the Arduino executable. I moved this to the applications folder and did a bit of renaming so it is now "Arduino" and the previous one is "Arduino-1.5-r2". But now, it doesn't even have all the boards the previous version had. I need to support the Adafruit Trinket Pro 5V (FTDI), and the other support, for the plain Trinket, the Trinket Pro 3V, and the Gemma would be nice. I've got a question out in the Adafruit forum regarding this, but I find that there is a lot of guesswork involved in trying to understand the platform.txt file and the boards.txt file. Is there a document anywhere that defines these files and how they all cohabit my development space? |
Would it help at all if Arduino had an option to either write a log file as it is starting up, or produce a file which is its representation for boards, boot loaders, and platforms? Then I could post the file, and somebody could say "OH, the reason your definitions are not being seen is that..." instead of my having to do "black box" experiments trying to figure out what is going on. The document in the wiki is only of marginal help. I have spent three days trying to figure out how to program my Trinket Pro, with no success. In fact, I'm further behind now than I was; under the 1.5-r2 release, it could see the board types and compile, but the upload failed. Now, I can't even find the boards. The Adafruit support keeps putting me into the middle of circular link sequences, where each node has either incomplete or apparently conflicting information. I have tried every variant described in every link, and get NOTHING! What I have done is take a zip file which contains boards.txt, bootloaders.txt, and platforms.txt, and installed it in mylogin/documents/Arduino/hardware/avr with no happiness. I tried moving them up to be just under "hardware" (siblings to the avr folder) and nothing changed. I have six projects waiting for me to be able to download code, and for the last six months, I could not compile some of the code (I'm hoping 1.6.2 really does fix these problems), and while I could download the code that did compile to an Arduino Uno for prototyping, I can't get it downloaded into the Trinket Pro in the "final product" implementation. This is extremely frustrating. |
Using what I thought was the most recent version (1.6.2), I got the following error compiling my sketch: [code] |
@supuflounder yes please, send your sketch and the libraries it uses to [email protected] |
…tructs but we still don't deal with them
…ere the first function is defined and place the prototypes right before. Coan will replace excluded code with empty lines instead of removing them: this makes it easier to map preprocessed code with the original one
… are wrong though
…ts loaded first and children platform.txt can override its key value pairs
…mple when you have defined a custom hardware packge (in your own sketchbook/hardware folder) and you have not defined a platform.txt because your build.core is arduino:something
(defined in IDE/hardware/platform.txt) is used as a base for custom hardware (defined in SKETCHBOOK/hardware/platform.txt)
With a custom core I get: May someone update this PR? Without a custom core the bug, that drove me crazy is now gone. I really look forward to see this in the new IDE and working. An example where I need it: This PR fixes it, but it doesnt like my HID-Project core. You might want to try it yourself. |
Hi, This issue seems to have gone stale a bit, but I was wondering what the outlook for this is. These changes seem greatly useful to me and wanted to know if I can expect to see them hit the mainline sometime soon. |
Would love to see the preprocessor fixes merged. It has taken a good deal of my time before I figured out what was odd about the Arduino IDE. I imagine others would love being saved from this confusion about IDE behavior... |
Now there are conflicts in the branch... |
Superseded by #3779 |
This PR introduces a new preprocessor, based on two binary tools: coan and (a modified version of) ctags
coan is use to resolve #define #ifdef et al, producing a clean sketch.
If your sketch has
the resulting sketch will be
ctags is used to collect function definitions and to generate their prototypes. If a prototype is already defined, it will not be generated.
If your sketch has
the resulting sketch will be
coan and ctags are defined in a parent platform.txt (currently located in IDE_FOLDER/hardware)
A new mechanism for loading platform.txt allows to group key value pairs common to multiple platforms or packages into separate files. Those pairs will be merged into children platform.txt. The key value pair nearest to boards.txt wins and overwrites pairs with the same key.
An example is IDE_FOLDER/hardware/arduino/sam/platform.txt, where coan command line is customized with sam specific parameters.
This keep users that have defined a 3rd party platform based on the avr one from having to update it adding the new tools definitions, and lowers the burden of those that started from the sam one.
This PR fixes lots of issues: see Component: PreprocessorThe Arduino sketch preprocessor converts .ino files into C++ code before compilation
Closes #2636