OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000136OMNeT++IDE / C++ developmentpublic2010-02-03 13:372010-05-09 22:19
Reporterdaniel 
Assigned Toandras 
PrioritynormalSeverityminorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version4.0 
Target VersionFixed in Version4.1rc1 
Summary0000136: automatic message/object generation fails on "using" in cpluplus section
Descriptionbug report is actually for version 4.1b

having

using namespace std;

in a message definition file let the code generation skip the cplusplus section.

example (from inetmanet):

cplusplus {{
#include "DYMO_PacketBBMessage_m.h"
#include "DYMO_AddressBlock.h"

#include <vector>
#include <sys/types.h>

using namespace std;

typedef vector<DYMO_AddressBlock> VectorOfDYMOAddressBlocks;

#include "InspectorHelpers.h"

}}


class noncobject VectorOfDYMOAddressBlocks;

class DYMO_PacketBBMessage;

struct DYMO_AddressBlock;


message DYMO_RERR extends DYMO_PacketBBMessage
{
    VectorOfDYMOAddressBlocks unreachableNodes;
}

TagsNo tags attached.
Attached Files? file icon opp_msgc [^] (84,746 bytes) 2010-03-08 17:47 [Show Content]
? file icon opp_msgc_2 [^] (84,747 bytes) 2010-03-08 18:21 [Show Content]

- Relationships

-  Notes
(0000213)
drewhk (reporter)
2010-03-08 17:49

Attached a workaround. The problem is that the opp_msgc uses a regex to find namespace keyword in the msg file

$NAMESPACE_DECL = '\bnamespace\s+([A-Za-z0-9_:]+)\s*;'

but this regex matches the "using namespace" directive in the cplusplus{{}} block.
As a workaround I changed the line to:

$NAMESPACE_DECL = '^namespace\s+([A-Za-z0-9_:]+)\s*;'

so it matches the "namespace" token on line starts.

so
(0000214)
drewhk (reporter)
2010-03-08 18:18

Ooops. Of course that line should be

$NAMESPACE_DECL = '\nnamespace\s+([A-Za-z0-9_:]+)\s*;'

instead. Uploading fixed version.
(0000293)
andras (administrator)
2010-05-09 22:19

Fixed. Solution is to temporarily remove cplusplus blocks before looking for the namespace line in the source, and put them back afterwards.

The proposed patch, while appreciated, was not so good because both C++ and msg files are free-form and there is no requirement that in msg a namespace decl has to begin at the beginning of the line, and also in C++ one can write "using<newline>namespace x;" -- both cases would make the patch to fail.

- Issue History
Date Modified Username Field Change
2010-02-03 13:37 daniel New Issue
2010-03-08 17:47 drewhk File Added: opp_msgc
2010-03-08 17:49 drewhk Note Added: 0000213
2010-03-08 18:18 drewhk Note Added: 0000214
2010-03-08 18:21 drewhk File Added: opp_msgc_2
2010-05-09 22:19 andras Note Added: 0000293
2010-05-09 22:19 andras Status new => resolved
2010-05-09 22:19 andras Fixed in Version => 4.1rc1
2010-05-09 22:19 andras Resolution open => fixed
2010-05-09 22:19 andras Assigned To => andras


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker