Skip to main content



      Home
Home » Modeling » Papyrus » Adding pragma and pragmaoption in C++ code generation
Adding pragma and pragmaoption in C++ code generation [message #1863500] Tue, 06 February 2024 10:42 Go to next message
Eclipse UserFriend
I try to create C++ code from the UML diagram.

For DataType, I want to add a pragma before and after the declaration.

In DataType stereotypes I added PragmaOption and Pragma.

For Pragma Option I set preDecl and postDecl to some pragmas that I want to use, however generated code uses preDecl value for postDecl.

Example:
preDecl = #pragma pack(push,1)
postDecl = #pragma pack(pop, 1)

Generated code uses #pragma pack(push,1) for postDecl.
#pragma pack(push,1)
struct DataPacketTypeDef {
     int a;
     char *b;	
};
#pragma pack(push,1)


index.php/fa/43966/0/
Re: Adding pragma and pragmaoption in C++ code generation [message #1863513 is a reply to message #1863500] Wed, 07 February 2024 05:12 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

this is a bug, unnoticed since some time, as we don ´t use the pragma feature internally. I've created issue https://gitlab.eclipse.org/eclipse/papyrus/org.eclipse.papyrus-designer/-/issues/4
(as SW designer moved to gitlab, this is now a gitlab issue and no longer done via bugzilla)
Re: Adding pragma and pragmaoption in C++ code generation [message #1863623 is a reply to message #1863513] Fri, 16 February 2024 12:23 Go to previous messageGo to next message
Eclipse UserFriend
I've created issue https://gitlab.eclipse.org/eclipse/papyrus/org.eclipse.papyrus-designer/-/issues/4
It is hopefully fixed (in nighly build tomorrow)
Re: Adding pragma and pragmaoption in C++ code generation [message #1864598 is a reply to message #1863623] Wed, 27 March 2024 12:57 Go to previous messageGo to next message
Eclipse UserFriend
Thanks for the fix for C++.

I checked for C code generation, too. However pragmas are not generated, before and after struct definitions no pragma is added. Is it possible to fix it for C?
Re: Adding pragma and pragmaoption in C++ code generation [message #1864713 is a reply to message #1864598] Thu, 04 April 2024 08:01 Go to previous message
Eclipse UserFriend
Pragmas are currently not supported for C, but it might be relatively easy to add it by sharing more code between the C++ and C generator. Please create an issue (with a low priority), but I'm not sure if/when I have the time to work on it.
Previous Topic:How to change the font of a guard specification under an interaction operand
Next Topic:C code generation static and inline function
Goto Forum:
  


Current Time: Mon Jul 14 04:55:38 EDT 2025

Powered by FUDForum. Page generated in 0.09622 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top