Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fastddsgen generates invalid #ifndef header fence on IDL filename with "-" #298

Open
okellogg opened this issue Feb 12, 2024 · 0 comments
Open

Comments

@okellogg
Copy link

For an IDL file named outer-middle-inner.idl with content

module outer {
   module middle {
      module inner {
         enum some_type { A, B, C };
      };
   };
};

fastddsgen generates the start of header file

#ifndef _FAST_DDS_GENERATED_OUTER-MIDDLE-INNER_H_
#define _FAST_DDS_GENERATED_OUTER-MIDDLE-INNER_H_

Notice that the dashes from the input filename are directly transferred to the header guard symbol.
Looking at src/main/java/com/eprosima/fastdds/idl/grammar/Context.java function getHeaderGuardName,

            if (m_lastStructure.getHasScope())
            {
                return m_lastStructure.getScope().replaceAll("::", "_").toUpperCase() +
                       "_" + m_fileNameUpper.replaceAll("\\.", "_");
            }

IMHO it would be good to extend the pattern in the m_fileNameUpper.replaceAll to include "-".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant