Hi Gerel,

There is still a minor issue in the PDF_DEBUG_* macros, when the corresponding configure option is enabled and no extra argument is given in addition to the formatting string, for example:
PDF_DEBUG_BASE("Whatever");

We get a compiler error, because __VA_ARGS__ is expanded to nothing, and we get the following expression: pdf_error (0, stderr, "***DEBUG BASE***:%s:%d: " "Whatever", __FILE__, __LINE__,);

This statement is wrong due to the last comma before the parenthesis, which shouldn't appear.

The fix is simple: instead of `__VA_ARGS__' we must use `##__VA_ARGS__', as the `##' will remove the previous comma if there is no extra argument.

Regards,

-Aleksander


Index: pdf-error.h
===================================================================
RCS file: /cvsroot/pdf/libgnupdf/src/base/pdf-error.h,v
retrieving revision 1.2
diff -r1.2 pdf-error.h
34c34
<   __FILE__, __LINE__, __VA_ARGS__)
---
>   __FILE__, __LINE__, ##__VA_ARGS__)
36c36
< #define PDF_DEBUG_BASE ""
---
> #define PDF_DEBUG_BASE(...)
42c42
<   __FILE__, __LINE__, __VA_ARGS__)
---
>   __FILE__, __LINE__, ##__VA_ARGS__)
44c44
< #define PDF_DEBUG_OBJECT ""
---
> #define PDF_DEBUG_OBJECT(...)
50c50
<   __FILE__, __LINE__, __VA_ARGS__)
---
>   __FILE__, __LINE__, ##__VA_ARGS__)
52c52
< #define PDF_DEBUG_DOCUMENT ""
---
> #define PDF_DEBUG_DOCUMENT(...)
58c58
<   __FILE__, __LINE__, __VA_ARGS__)
---
>   __FILE__, __LINE__, ##__VA_ARGS__)
60c60
< #define PDF_DEBUG_PAGE ""
---
> #define PDF_DEBUG_PAGE(...)


Reply via email to