RSS/Atom feed Twitter
Site is read-only, email is disabled

Trouble with GIMP_LOG

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Trouble with GIMP_LOG Hans Breuer 18 Nov 13:29
  Trouble with GIMP_LOG Michael Natterer 18 Nov 18:07
Trouble with GIMP_LOG Hans Breuer 21 Nov 22:43
Hans Breuer
2007-11-18 13:29:01 UTC (about 17 years ago)

Trouble with GIMP_LOG

The recently added GIMP_LOG macro does not compile on win32/msvc6.

D:\devel\from-svn\gimp\app>nmake -nologo -f makefile.msc sub-one THIS=display [...]
..\../app\gimp-log.h(31) : error C2010: '.' : unexpected in macro formal parameter list
[...]
gimpdisplayshell-callbacks.c(671) : error C4002: too many actual parameters for macro 'GIMP_LOG'

This is due to the use of variadic macros [1]. Also it seems the macro code is not correct, due to the lack of __VA_ARGS__ usage in the macro definition.

It would be nice if the GIMP_LOG facility could be modified to follow the pattern given by GDK_NOTE [2] to not exclude all pre-C99 compilers.

Thanks, Hans

[1] http://en.wikipedia.org/wiki/Variadic_macro [2] http://svn.gnome.org/viewvc/gtk%2B/trunk/gtk/gtkdebug.h?view=markup

-------- Hans "at" Breuer "dot" Org ----------- Tell me what you need, and I'll tell you how to get along without it. -- Dilbert

Michael Natterer
2007-11-18 18:07:38 UTC (about 17 years ago)

Trouble with GIMP_LOG

On Sun, 2007-11-18 at 13:29 +0100, Hans Breuer wrote:

The recently added GIMP_LOG macro does not compile on win32/msvc6.

D:\devel\from-svn\gimp\app>nmake -nologo -f makefile.msc sub-one THIS=display [...]
..\../app\gimp-log.h(31) : error C2010: '.' : unexpected in macro formal parameter list
[...]
gimpdisplayshell-callbacks.c(671) : error C4002: too many actual parameters for macro 'GIMP_LOG'

This is due to the use of variadic macros [1]. Also it seems the macro code is not correct, due to the lack of __VA_ARGS__ usage in the macro definition.

It would be nice if the GIMP_LOG facility could be modified to follow the pattern given by GDK_NOTE [2] to not exclude all pre-C99 compilers.

Nope, GDK_NOTE() is ugly ;) I changed it to how g_message() and friends do it. Can you check if this compiles fine now?

ciao, --mitch

Hans Breuer
2007-11-21 22:43:28 UTC (about 17 years ago)

Trouble with GIMP_LOG

Sun Nov 18 09:07:38, Michael Natterer:

On Sun, 2007-11-18 at 13:29 +0100, Hans Breuer wrote:

The recently added GIMP_LOG macro does not compile on win32/msvc6.

[...]

It would be nice if the GIMP_LOG facility could be modified to follow the pattern given by GDK_NOTE [2] to not exclude all pre-C99 compilers.

Nope, GDK_NOTE() is ugly ;) I changed it to how g_message() and friends do it. Can you check if this compiles fine now?

Thanks for the fast answer and sorry for me being slow. Apparently I was bounced away from gimp-developer list.

With the current approach I'm getting :

cl -G5 -Zi -MD -W3 -nologo -Zi -FImsvc_recommended_pragmas.h -I..\.. -I..\../app -I ..\..\..\glib -I ..\..\..\glib\glib -I ..\..\..\glib\gmodule -I d:\devel\my-gtk\other\intl-tml -I ..\..\../atk -I..\..\../gtk+\gdk -I..\..\../gtk+\gdk -I..\..\../gtk+ -I..\..\../pango -I..\..\../atk -I d:\devel\my-gtk\cairo\cairo-1.4.8\src -I d:\devel\my-gtk\cairo\cairo-1.4.8 -DG_LOG_DOMAIN=\"Gimp-Dialog\" -GD -c file-save-dialog.c
file-save-dialog.c
file-save-dialog.c(222) : error C2065: 'SAVE_DIALOG' : undeclared identifier file-save-dialog.c(222) : error C4047: 'function' : 'const char *' differs in levels of indirection from 'int ' file-save-dialog.c(222) : warning C4024: 'GIMP_LOG' : different types for formal and actual parameter 1
file-save-dialog.c(222) : error C4047: 'function' : 'int ' differs in levels of indirection from 'char [32]' file-save-dialog.c(222) : warning C4024: 'GIMP_LOG' : different types for formal and actual parameter 2
file-save-dialog.c(222) : error C2198: 'GIMP_LOG' : too few actual parameters

The expansion of GIMP_LOG (SAVE_DIALOG, ...) still depends on the preprocessor so just making GIMP_LOG a function does not work.

The ugly (but working;)) thing with something like GDK_NOTE (DRAW, g_print (" +%d+%d..+%d+%d", x1, y1, x2, y2)); is the fixed number of parameters combined with the macro expansion of the key. Currently I can't think of a solution giving both at the same time without variadic macros or at least grouping the parameters from 2 to n within their own braces.

But maybe there is another way?

Thanks, Hans

-------- Hans "at" Breuer "dot" Org ----------- Tell me what you need, and I'll tell you how to get along without it. -- Dilbert