[Development] Order of macro expansion in compiler error messages

Mandeep Sandhu mandeepsandhu.chd at gmail.com
Tue Dec 17 07:30:17 CET 2013


On Sun, Dec 8, 2013 at 1:54 AM, Thiago Macieira
<thiago.macieira at intel.com> wrote:
> On sábado, 7 de dezembro de 2013 15:03:26, Chris Colbert wrote:
>> Is there a line missing from Option A, just after the line for <stdin>?
>
> This specific compiler did not output anything for this case.
>
> That case was a misuse of a macro. Here's another example, where the problem
> is inside the macro.
>
> Option A:
> qmetatype.h:1785:43: error: conversion to ‘int’ from ‘uint {aka unsigned int}’
> may change the sign of the result
>          const int tNameLen = qstrlen(tName); \
>                                            ^
> qmetatype.h:1913:1: note: in expansion of macro
> ‘Q_DECLARE_METATYPE_TEMPLATE_2ARG’
>  Q_DECLARE_METATYPE_TEMPLATE_2ARG(QPair)
>  ^

+1 to A as it shows the offending line first, and then it's usage via
the macro (though the error message in B is more clear! :)).

-mandeep


>
> Option B:
> qmetatype.h:1913:1: error: implicit conversion changes signedness: 'uint' (aka
> 'unsigned int') to 'const int'
> Q_DECLARE_METATYPE_TEMPLATE_2ARG(QPair)
> ^
> qmetatype.h:1785:30: note: expanded from macro
> 'Q_DECLARE_METATYPE_TEMPLATE_2ARG'
>         const int tNameLen = qstrlen(tName); \
>                   ~~~~~~~~   ^~~~~~~~~~~~~~
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Software Architect - Intel Open Source Technology Center
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>



More information about the Development mailing list