Web lists-archives.com

Re: Debug build compile error in 'gobject/gobject.c'




I don't believe you're allowed to legally use macros inside a macro
expansion - https://stackoverflow.com/questions/19111383/ifdef-inside-a-macro-call-works-with-gcc-but-not-with-msvc

On Wed, Aug 3, 2016 at 10:46 AM, Emmanuele Bassi <ebassi@xxxxxxxxx> wrote:
> Hi;
>
> On 3 August 2016 at 18:36, John Emmas <johne53@xxxxxxxxxxxxx> wrote:
>> Hi there - I just came across a problem after updating libglib to the latest
>> git master (my last update was about a fortnight ago).
>>
>> I'm building with MSVC 8 and when I try to compile 'gobject/gobject.c' the
>> Release version compiles fine but compiling in Debug mode gives me an error
>> around these lines at the end of function 'void g_object_type_init (void)
>> (approximately line 400):-
>>
>>       GOBJECT_IF_DEBUG (OBJECTS,
>>       {
>>           debug_objects_ht = g_hash_table_new (g_direct_hash, NULL);
>> #ifndef G_HAS_CONSTRUCTORS
>>           g_atexit (debug_objects_atexit);
>> #endif /* G_HAS_CONSTRUCTORS */
>>       });
>>
>> The error I see is:-
>>
>>       gobject\gobject.c(403) : error C2121: '#' : invalid character :
>> possibly the result of a macro expansion
>>
>> AFAICT gobject.c itself hasn't changed recently so is it possible that
>> GOBJECT_IF_DEBUG has changed somehow?  The Release build compiles okay so I
>> guess that seems plausible.  Thanks,
>
> This is likely a MSVC 8 issue. The GOBJECT_IF_DEBUG macro expands the
> second argument to a code block, and it seems MSVC 8 has issues when
> that includes a conditional pre-processor directive.
>
> GOBJECT_IF_DEBUG hasn't changed since 2014, and the same commit
> introduced the use you see failing.
>
> Ciao,
>  Emmanuele.
>
> --
> https://www.bassi.io
> [@] ebassi [@gmail.com]
> _______________________________________________
> gtk-devel-list mailing list
> gtk-devel-list@xxxxxxxxx
> https://mail.gnome.org/mailman/listinfo/gtk-devel-list
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-devel-list