Hi,
please consider the attached patch for git, which allows code input like this
to be processed correctly:
#ifndef DECLARE_ENUM
# define DECLARE_ENUM(type, ...) enum type { __VA_ARGS__ }
#endif
DECLARE_ENUM(Foo_t,
foo1 = 0x000000001, ///< First comment.
foo2 = 22, ///< Second comment.
foo3
);
The current general behavior of dropping all new line characters on macro
expansion is preserved. Accordingly those C++ comments are automatically
rewritten as inline C comments instead.
Best regards,
Christian Schoenebeck>From 38a43b4d237fa60395c7814aeffef9d26497d5bd Mon Sep 17 00:00:00 2001
From: Christian Schoenebeck <[email protected]>
Date: Sun, 10 Dec 2017 18:24:47 +0100
Subject: [PATCH] Support for C++ comments next to arguments of macro function
calls.
This allows code input like this to be processed correctly:
#ifndef DECLARE_ENUM
# define DECLARE_ENUM(type, ...) enum type { __VA_ARGS__ }
#endif
DECLARE_ENUM(Foo_t,
foo1 = 0x000000001, ///< First comment.
foo2 = 22, ///< Second comment.
foo3
);
The current general behavior of dropping all new line characters
on macro expansion is preserved. Accordingly those C++ comments
are automatically rewritten as inline C comments instead.
---
src/pre.l | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/pre.l b/src/pre.l
index bf1ec9b6..fd745579 100644
--- a/src/pre.l
+++ b/src/pre.l
@@ -1980,6 +1980,15 @@ CHARLIT (("'"\\[0-7]{1,3}"'")|("'"\\."'")|("'"[^'\\\n]{1,4}"'"))
g_defArgsStr+=yytext;
BEGIN(ArgCopyCComment);
}
+<FindDefineArgs>"//"[^\n\r]* { // C++ comment next to individual preprocessor macro argument ...
+ QCString comment(yytext);
+ // rewrite C++ comment as C comment (so we can drop \n)
+ comment.rawData()[1]='*';
+ if (comment.size() > 2 && comment[2]=='/')
+ comment.rawData()[2]='*';
+ comment+=" */";
+ g_defArgsStr+=comment;
+ }
<FindDefineArgs>\" {
g_defArgsStr+=*yytext;
BEGIN(ReadString);
--
2.11.0
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Doxygen-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/doxygen-develop