and first of all thanks for a great tool. This tool is really helpful. I am currently creating a documentation tool for some internal headers and being able to run a preprocessor over it like this is really convenient, especially since the documentation tool is supposed to work on different platforms and MCPP works on all of them.
When using it, I noted there seems to be an issue with single-line comments (C++/C99 comments) when they are behind an indented line with a member declaration inside a struct.
Example:
------------------------
typedef _x
{
int y; // Comment 1
int z; // Comment 2
} x;
------------------------
will yield (with the -C command line switch):
------------------------
typedef _x
{
// Comment 1 int y;
// Comment 2 int z;
} x;
------------------------
Is there any way to mitigate this? I am currently using "-@std".
Thanks again,
// Oliver
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sadly SF.net stripped the blank spaces before the member declarations. Also, these blank spaces would appear *behind* the comments in the result provided below.
// Oliver
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
mcpp V.2.7 and V.2.7.1 have the same bug with V.2.7.2. Please apply the following patch. This is a patch for V.2.7.2. The line numbers differ from it on V.2.7 or V.2.7.1.
*** support.c.orig 2008-06-10 17:32:33.000000000 +0900
--- support.c 2009-01-08 13:32:48.000000000 +0900
***************
*** 1722,1727 ****
--- 1722,1728 ----
sp -= 2;
while (*sp != '\n') /* Until end of line */
mcpp_fputc( *sp++, OUT);
+ wrong_line = TRUE;
}
goto end_line;
default: /* Not a comment */
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
and first of all thanks for a great tool. This tool is really helpful. I am currently creating a documentation tool for some internal headers and being able to run a preprocessor over it like this is really convenient, especially since the documentation tool is supposed to work on different platforms and MCPP works on all of them.
When using it, I noted there seems to be an issue with single-line comments (C++/C99 comments) when they are behind an indented line with a member declaration inside a struct.
Example:
------------------------
typedef _x
{
int y; // Comment 1
int z; // Comment 2
} x;
------------------------
will yield (with the -C command line switch):
------------------------
typedef _x
{
// Comment 1 int y;
// Comment 2 int z;
} x;
------------------------
Is there any way to mitigate this? I am currently using "-@std".
Thanks again,
// Oliver
Sadly SF.net stripped the blank spaces before the member declarations. Also, these blank spaces would appear *behind* the comments in the result provided below.
// Oliver
Thanks for the bug reporting!
mcpp V.2.7 and V.2.7.1 have the same bug with V.2.7.2. Please apply the following patch. This is a patch for V.2.7.2. The line numbers differ from it on V.2.7 or V.2.7.1.
*** support.c.orig 2008-06-10 17:32:33.000000000 +0900
--- support.c 2009-01-08 13:32:48.000000000 +0900
***************
*** 1722,1727 ****
--- 1722,1728 ----
sp -= 2;
while (*sp != '\n') /* Until end of line */
mcpp_fputc( *sp++, OUT);
+ wrong_line = TRUE;
}
goto end_line;
default: /* Not a comment */
Thanks for the fast response. It's greatly appreciated.
// Oliver
A precompiled (COMPILER=INDEPENDENT) binary for Win32 with the fix can be found here, until the next version that incorporates the patch gets released: http://assarbad.net/stuff/temp/mcpp_2.7.2_slcomm_patch.rar
// Oliver
Thanks for the upload.
BTW: I just noticed that the patch will not work. I think it requires an additional line break such as in other places. I.e.:
*** support.c.orig 2008-06-10 17:32:33.000000000 +0900
--- support.c 2009-01-08 13:32:48.000000000 +0900
***************
*** 1722,1727 ****
--- 1722,1728 ----
sp -= 2;
while (*sp != '\n') /* Until end of line */
mcpp_fputc( *sp++, OUT);
+ mcpp_fputc( '\n', OUT);
+ wrong_line = TRUE;
}
goto end_line;
default: /* Not a comment */
At least this will yield a result such as this for above example:
typedef _x
{
// Comment 1
int y;
// Comment 2
int z;
} x;
// Oliver
PS: I'll upload the patched binary once you provide feedback whether this change is logical to you or has other repercussions.
Sorry for my mistake.
The bug appears when -P option is specified along with -C.
Your patch is correct. Thanks.