Issue 53950 - cppumaker: encode UNOIDL identifiers that are C++ keywords
Summary: cppumaker: encode UNOIDL identifiers that are C++ keywords
Status: ACCEPTED
Alias: None
Product: udk
Classification: Code
Component: code (show other issues)
Version: 680m124
Hardware: All All
: P3 Trivial (vote)
Target Milestone: 4.x
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-30 09:00 UTC by Stephan Bergmann
Modified: 2017-05-20 11:31 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
patch. (763 bytes, patch)
2006-03-13 11:35 UTC, mmeeks
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description Stephan Bergmann 2005-08-30 09:00:32 UTC
offapi/com/sun/star/drawing/CaptionEscapeDirection.idl 1.4 contains

  const short auto = 2;

which is translated by cppumaker to the syntax error

  static const ::sal_Int16 auto = (sal_Int16)2;

As discussed in the thread starting at
<http://udk.openoffice.org/servlets/ReadMsg?list=dev&msgNo=2389>, it is a
compatible change to fix the use of any C++ keywords (as of the 1998 C++
Standard) as UNOIDL identifiers by encoding them as <PREFIX>_<ID>.  (In
retrospect, I think mapping an <ID> that names a UNOIDL const to "constant_<ID>"
instead of "const_<ID>" to avoid clashes with the C++ keyword "const_cast" is
not necessary, as "cast" itself is not a C++ keyword.  This rule should thus be
changed.)

(Java has a similar problem; however, only changing Java 1.3 keywords would be a
compatible change---keywords added by later revisions are problematic.)
Comment 1 jsc 2006-01-23 08:29:10 UTC
change target
Comment 2 mmeeks 2006-03-13 11:35:08 UTC
Attaching the trivial patch to fix this. Assuming offuh contains all the IDL - a
diff -u of the generated headers before/after contains only:

diff -u -r unxlngi6.pro/inc/com/sun/star/drawing/CaptionEscapeDirection.hdl
unxlngi6.pro.new/inc/com/sun/star/drawing/CaptionEscapeDirection.hdl
--- unxlngi6.pro/inc/com/sun/star/drawing/CaptionEscapeDirection.hdl   
2006-03-13 11:32:10.000000000 +0000
+++ unxlngi6.pro.new/inc/com/sun/star/drawing/CaptionEscapeDirection.hdl       
2006-03-13 11:29:42.000000000 +0000
@@ -16,7 +16,7 @@
 
 static const ::sal_Int16 horizontal = (sal_Int16)0;
 static const ::sal_Int16 vertical = (sal_Int16)1;
-static const ::sal_Int16 auto = (sal_Int16)2;
+static const ::sal_Int16 const_auto = (sal_Int16)2;
 
 } } } } }

So this should be safe - I'm also assuming that no valid/compiling C++ code can
have ever used this & => not re-compile tested everything to check. Doesn't
really merit it's own cws - can someone put it in theirs ? Stefan ?

HTH.
Comment 3 mmeeks 2006-03-13 11:35:46 UTC
Created attachment 34814 [details]
patch.
Comment 4 Stephan Bergmann 2006-03-13 12:10:17 UTC
@mmeeks:  Your first attempt (UNOIDL auto -> const_auto) does not work, as it
incompatibly changes data that is not only used by C++.  Your second attempt
(cppumaker auto -> const_auto) does not work, as it incompatibly changes things
that currently work if certain requirements are met (e.g., USHRT_MAX is not
extended to const_USHRT_MAX, which is ok as long as the translation unit does
not include limits.h).
Comment 5 jsc 2006-03-15 10:10:30 UTC
Sorry Michael, but your patch is to simple and doesn't solve the problem in
general. The issue was already addressed and will be fixed completely.
Comment 6 jsc 2006-03-20 16:01:51 UTC
accepted
Comment 7 jsc 2006-04-28 07:44:54 UTC
change target to 2.0.4 because of time schedule
Comment 8 jsc 2006-07-03 09:03:23 UTC
adapt target
Comment 9 Martin Hollmichel 2007-12-07 13:00:16 UTC
set target to 3.x according to http://wiki.services.openoffice.org/wiki/Target_3x
Comment 10 Marcus 2017-05-20 11:31:43 UTC
Reset assigne to the default "issues@openoffice.apache.org".