Task: Add Feature To Eclipse CDT Formatter

FreeEMS topics that aren't specific to hardware development or firmware development.
Post Reply
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Task: Add Feature To Eclipse CDT Formatter

Post by Fred »

There are a couple of minor issues with the CDT code formatter in Juno SR1 + performance patch:

1) It screws with blank lines, make this optional, or for our purposes, just make it not screw with them at all. Optional is an upstreamable patch, but more work, as you need to make a new tab for it. JDT has this feature, so checking their code base could be helpful - I didn't look there yet, though.

2) If a macro with args is included in a block of math, it puts a trailing space after it, however not after a function in the same place, nor a literal in the same place, nor a var in the same place, etc. This is a bug IMO, and I should likely file it on eclipse CDT, but maybe with a patch.

These files (at least) have the code in them:

Code: Select all

find ~/workspace/org.eclipse.cdt/ -type d -and -name formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/formatter
/home/fred/workspace/org.eclipse.cdt/core/org.eclipse.cdt.ui.tests/resources/formatter
The formatter definition and/or patch needs to work well in order to not piss everyone off who wants to include code in the firmware. This would be a useful contribution to a HUGE project (eclipse), and to this one, as well.

Any takers?

Fred.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Task: Add Feature To Eclipse CDT Formatter

Post by Fred »

DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Task: Add Feature To Eclipse CDT Formatter

Post by Fred »

Get the source here:

Code: Select all

git clone git://git.eclipse.org/gitroot/cdt/org.eclipse.cdt.git
Unsure if this is a suitable version to use as a patch, or not. It may well be newer. We should apply the patch to the version in SR1+perfpatch before deploying it.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Task: Add Feature To Eclipse CDT Formatter

Post by Fred »

I was testing on this file src/main/fuelAndIgnitionCalcs.c

However more issues may crop up as I expand testing once those are solved.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
User avatar
Fred
Moderator
Posts: 15431
Joined: Tue Jan 15, 2008 2:31 pm
Location: Home sweet home!
Contact:

Re: Task: Add Feature To Eclipse CDT Formatter

Post by Fred »

Re the macro thing, I filed a bug on the eclipse bugzilla, hopefully someone takes a look at it sooner or later.
DIYEFI.org - where Open Source means Open Source, and Free means Freedom
FreeEMS.org - the open source engine management system
FreeEMS dev diary and its comments thread and my turbo truck!
n00bs, do NOT PM or email tech questions! Use the forum!
The ever growing list of FreeEMS success stories!
Post Reply