Book a Demo

Author Topic: EA - Reverse Engineering C++ code failure by the keyword namespace  (Read 4792 times)

MFranke

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Hi,

I got an issue/problem or misunderstanding related to the source code reverse engineering feature in C++ on EA Version 14 .
In my classes I use the keyword namespace,but it looks like the parser doesn't like that.

For example I have a simple class
Code: [Select]
#include <iostream>
#include <string>
namespace namespace_foo
{
   class CFoo
   {
   public:
      CFoo();
      ~CFoo();

      const char* GetFooBar();
   };

}

By Importing the header file I get an Parse Error on line xx (It reference on the line with "class CFoo").
If I delete the namespace part, than I don't get any error and the class is generated in EA.

I used the forum search and google, but I couldn't find any solution for my problem.

Thanks for your help.
MFranke



Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: EA - Reverse Engineering C++ code failure by the keyword namespace
« Reply #1 on: June 26, 2019, 05:01:54 pm »
If I copy your example code into a file it imports into EA.

I'd be looking to see if you have added any language macros for terms that EA can't skip over.

Other than that, it's possible that the actual namespace name you're using is clashing with the EA parser in some way.

MFranke

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: EA - Reverse Engineering C++ code failure by the keyword namespace
« Reply #2 on: June 26, 2019, 05:44:06 pm »
Hi Eve,

thanks for your fast reply.
I did have a problem with the defined makros, I solved it thanks.

But if I expand the test class (use of the nested namespace feature) to fit more our project structure. I have the same problem, I described earlier.
Maybe EA doesn't support nested namespaces?


Here is the extended test class.
Code: [Select]
#include <iostream>
#include <string>
namespace namespace_foo::sub_bar
{
   class CFoo
   {
   public:
      CFoo();
      ~CFoo();

      const char* GetFooBar();
   };

}

And here are my defined Makros:
WINAPI
SWLAPI
PASCAL
noexcept
final
defined()
DECLARE_MESSAGE_MAP()
DECLARE_INTERFACE_MAP()
DECLARE_DYNCREATE()
DECLARE_DYNAMIC()
CONTROLLER_API
APICALL
AFXAPI
AFX_NOVTABLE
AFX_DATA
AFX_COMDAT
AFX_CDECL
_UNICODE
_MSC_VER
_DEBUG
_AFXDLL
_AFX_PACKING
_AFX_OLD_EXCEPTIONS
_AFX_NO_OCC_SUPPORT
_AFX_NO_DEBUG_CRT

Thanks a lot.




Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: EA - Reverse Engineering C++ code failure by the keyword namespace
« Reply #3 on: June 27, 2019, 09:00:47 am »
Maybe EA doesn't support nested namespaces?
That's entirely possible. Last time I worked with EA's C++ parser it wasn't part of the language at all. (I can see it was added in C++17)

MFranke

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: EA - Reverse Engineering C++ code failure by the keyword namespace
« Reply #4 on: June 27, 2019, 03:14:32 pm »
Hi Eve,

do you have any idea, how we can proceed? I would like to use the EA reverse engineering feature, but I don't want to rewrite all our classes.
Do you know of any workaround?

Best regards,
MFranke

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: EA - Reverse Engineering C++ code failure by the keyword namespace
« Reply #5 on: June 28, 2019, 08:12:34 am »
Send your second example into support. For something like this you'll generally get an MDG technology that patches the grammar. It's conceptually the same as the way other languages handle it, so I don't expect it would be hard.

I believe there's some weirdness about needing to build a new perspective containing the patch technology in the current build, but other than that it's pretty simple.