CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Compiler discrepancy between two versions [SOLVED]

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
benoitstjean



Joined: 30 Oct 2007
Posts: 546
Location: Ottawa, Ontario, Canada

View user's profile Send private message

Compiler discrepancy between two versions [SOLVED]
PostPosted: Tue Feb 27, 2024 8:41 am     Reply with quote

Hi guys,

FINALLY got my hands on the latest version of CCS.

On my PC, I now have 5.026 and 5.116.

If I open the exact same project on both and hit "rebuild all", on 5.026 it compiles as it should without errors.

On 5.116, it's giving me an error that an #ENDIF is missing in my main file:


*** Error 14 "C:\MyProject\MyProject.c" Line 237(5,6): Missing #ENDIF

I've searched in the file and there are only four #ifdef and four #endif with one #ifdef having an #elseif but that's it.

Any idea?

Thanks,

Ben


Last edited by benoitstjean on Tue Feb 27, 2024 12:20 pm; edited 1 time in total
Ttelmah



Joined: 11 Mar 2010
Posts: 19233

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 8:49 am     Reply with quote

This has been happening for quite a few versions now. It should have
compiled OK, despite this. I'm surprised it never happened on your previous
version. It seems to be random. You can compile the same project after
re-launching the IDE, and it then sometimes works.
Try deleting the .ccspjt file for the project, and then re-opening the
source file. This rebuilds the project file, and seems to sometimes fix
it.
Using a very old project file seems to make it more likely.
benoitstjean



Joined: 30 Oct 2007
Posts: 546
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 9:22 am     Reply with quote

Tried it but still does the same thing.

I emailed CCS.

If you think of anything else, let me know.

Your help is greatly appreciated!

Ben
benoitstjean



Joined: 30 Oct 2007
Posts: 546
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 9:27 am     Reply with quote

Could it have to do with the fact that I have #CASE and all my #ifdef/#endif are in small caps?
benoitstjean



Joined: 30 Oct 2007
Posts: 546
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 10:21 am     Reply with quote

Tried deleting the .ccspjt file and reopening my source file and recompiling but it still returns the error. Since it returns the error, it doesn't re-create the project file.

Any other idea?
Ttelmah



Joined: 11 Mar 2010
Posts: 19233

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 10:43 am     Reply with quote

but does it output a compile?.
A lot of people have been seeing this, but normally it actually compiles OK!.
benoitstjean



Joined: 30 Oct 2007
Posts: 546
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 10:45 am     Reply with quote

Nope! Since I've deleted the .ccspjt, it won't compile a new .ccspjt file since it's generating the error.

It'll only generate a new .ccspjt file once all errors are fixed.
Ttelmah



Joined: 11 Mar 2010
Posts: 19233

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 11:45 am     Reply with quote

As others have said, you need to get in touch with CCS urgently.
There has been an oddity about this for a lot of versions, but it does
normally compile, so yours is an order of magnitude 'worse'. Touch wood
solving this may tell CCS what they have actually got wrong.
I'm guessing line 237, is actually the end of the main file here?. This is
normally where it flags the error.
benoitstjean



Joined: 30 Oct 2007
Posts: 546
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 12:00 pm     Reply with quote

CCS replied back, they are very quick but they want a copy of my code to try it out. Unfortunately I cannot give-out my code.

However, I was able to pin-point to one file where the compiling stopped. This file has #ifdef/#endif so I commented-them all out and it got rid of the problem.

The only thing I noticed (and I guess I should try to confirm) is that one line in particular had the #ifdef and #endif on the same line like this example:

#ifdef MY_IFDEF fprintf( serial, "bla bla" ); #endif

All the other ones are like this:

#ifdef MY_IFDEF
fprintf( serial, "bla bla" );
#endif

Now my code compiles BUT I ran into another issue: I get the infamous "out of rom".... but the same code compiles just fine on 5.026 with 58% RAM and 94% ROM (PIC24EP512GP806).

I did add #separate in the past in 5.026 to resolve that problem and it worked. But now with the new compiler - even with the #separate still in place - I get that error.... and that out of rom error is exactly at the same function where I had added the #separate thingy.

Not sure if there's another solution to this other than revamping my code.... which I really don't want to do.
temtronic



Joined: 01 Jul 2010
Posts: 9118
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 12:14 pm     Reply with quote

hmm, raining here but....
can you take a 'big' function and turn into 2 or 3 smaller sub functions ?
benoitstjean



Joined: 30 Oct 2007
Posts: 546
Location: Ottawa, Ontario, Canada

View user's profile Send private message

PostPosted: Tue Feb 27, 2024 12:20 pm     Reply with quote

Alrighty, problem solved with the #ENDIF thing.

When compiling, it was generating a warning for some other file but an error for my main file. The main file had only 4 pairs of #ifdef/#endif.... but the other file had about like 30.

After commenting-out all #ifdef / #endif pairs, it compiled. So I reverted back and re-enabled the pairs and manually checked all of them one by one.

Of course, as much as this code has been working for YEARS, there was ONE which I missed the #endif somehow.

5.026 never complained and the code always worked but I guess the numerous changes between 5.026 and 5.116 changed and detected that error.

As for the out of rom, I will see if there's stuff I can remove like printf's.

Cheers and thanks for your help!

Benoit
Ttelmah



Joined: 11 Mar 2010
Posts: 19233

View user's profile Send private message

PostPosted: Wed Feb 28, 2024 7:07 am     Reply with quote

OK.
That sort of makes sense. They at some point have tightened up on the
checking of the unbalanced #if/#endif's, and the missing one was therefore
being spotted. This tightening though does also cause the random errors
I was talking about. This seems to happen most when you have a project
open for a long time, and it then suddenly decides these are unbalanced,
when they are not. Duh. The separate issue with the single line format
is interesting, since C is normally unfazed by the presence or lack of
whitespace.

Glad you have now got it working, though I think you should go back to
them and point out the having the #endif on the same line is legal (it
is listed as such in K&R).
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group