This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

fixed-point support in c++


It looks like my patches for avr target to get native fixed-point
support may be included soon.  I realized that many users use avr-g++
for their projects, and I cannot get the fixed point types working in
c++.   The question is generic and should apply to all targets.

Compiling a simple test program:

int main()
{
    _Accum x;
}

Works fine in c, but under c++ I get:

test.cpp:5: error: ‘_Accum’ was not declared in this scope

So I modified c-common.c:

Index: c-common.c
===================================================================
--- c-common.c	(revision 157409)
+++ c-common.c	(working copy)
@@ -561,9 +561,9 @@
   { "_Decimal32",       RID_DFLOAT32,  D_CONLY | D_EXT },
   { "_Decimal64",       RID_DFLOAT64,  D_CONLY | D_EXT },
   { "_Decimal128",      RID_DFLOAT128, D_CONLY | D_EXT },
-  { "_Fract",           RID_FRACT,     D_CONLY | D_EXT },
-  { "_Accum",           RID_ACCUM,     D_CONLY | D_EXT },
-  { "_Sat",             RID_SAT,       D_CONLY | D_EXT },
+  { "_Fract",           RID_FRACT,     D_EXT },
+  { "_Accum",           RID_ACCUM,     D_EXT },
+  { "_Sat",             RID_SAT,       D_EXT },
   { "__FUNCTION__",	RID_FUNCTION_NAME, 0 },
   { "__PRETTY_FUNCTION__", RID_PRETTY_FUNCTION_NAME, 0 },
   { "__alignof",	RID_ALIGNOF,	0 },


Now the error is:

test.cpp:5:4: error: expected primary-expression before ‘_Accum’

Does anyone have clues as to the problem?  I have tried a few other
things with no success.


Thanks
Sean


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]