This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 249698 - Add support for binary constants
Summary: Add support for binary constants
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 5.0.1   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 5.0.2   Edit
Assignee: Sergey Prigogin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-05 08:30 EDT by Thomas Holland CLA
Modified: 2014-01-29 22:18 EST (History)
3 users (show)

See Also:


Attachments
org.eclipse.cdt.core patch to add support for binary constants (7.51 KB, patch)
2008-10-05 08:30 EDT, Thomas Holland CLA
cdtdoug: iplog+
Details | Diff
org.eclipse.cdt.core patch to test the support for binary constants (1.44 KB, patch)
2008-10-05 08:31 EDT, Thomas Holland CLA
cdtdoug: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Holland CLA 2008-10-05 08:30:11 EDT
Created attachment 114271 [details]
org.eclipse.cdt.core patch to add support for binary constants

GCC has supported binary constants (prefixed with 0b or 0B) since 4.3.0,
see http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html

Some GCC derivatives (like avr-gcc) and some other C compilers have supported binary constants even longer.

However CDT flags them as "Invalid decimal format" in the source editor. As eclipse/CDT is already popular for embedded processor work, binary constants should be supported by CDT.

I have attached a patch to org.eclipse.cdt.core to add this support to the parser scanner.

Also attached is a patch to org.eclipse.cdt.core.tests containing a small test case for binary constants.

I have run the full CDT test suite against the patch and there seem to be no side effects.

The patch is fairly straightforward and on behalf of many bit-fiddling programmers I would appreciate it if this patch could be included in one of the next CDT releases.

brgds,

Thomas
Comment 1 Thomas Holland CLA 2008-10-05 08:31:14 EDT
Created attachment 114272 [details]
org.eclipse.cdt.core patch to test the support for binary constants
Comment 2 Sergey Prigogin CLA 2008-10-06 01:28:33 EDT
Thanks a lot for contributing to CDT. The patches applied to cdt_5_0 and HEAD > 20081005.
Comment 3 Doug Schaefer CLA 2009-06-03 17:00:31 EDT
assigning
Comment 4 Doug Schaefer CLA 2009-06-03 17:01:02 EDT
assigned.