Обсуждение: error: expected initializer before ‘!’ token

Поиск
Список
Период
Сортировка

error: expected initializer before ‘!’ token

От
Peter Geoghegan
Дата:
Hi,

I attempted to build master this evening, but came up against this error:

make[3]: Entering directory `/home/peter/pgadmin3/pgadmin'
g++ -DHAVE_CONFIG_H -I. -I..
-DDATA_DIR=\"/usr/local/pgadmin3/share/pgadmin3/\"
-I../pgadmin/include   -I/usr/local/pgsql/include
-I/usr/local/pgsql/include -DHAVE_CONNINFO_PARSE
-I/usr/local/lib/wx/include/gtk2-unicode-debug-2.8
-I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
-D__WXDEBUG__ -D__WXGTK__ -I/usr/include/libxml2
-I/usr/include/libxml2  -g -O0 -MT explainShape.o -MD -MP -MF
.deps/explainShape.Tpo -c -o explainShape.o `test -f
'./ctl/explainShape.cpp' || echo './'`./ctl/explainShape.cpp
In file included from ./ctl/explainShape.cpp:32:0:
../pgadmin/include/images/ex_hash_setop_except.pngc:194:33: warning:
missing whitespace after the macro name
../pgadmin/include/images/ex_hash_setop_except.pngc:203:33: warning:
missing whitespace after the macro name
../pgadmin/include/images/ex_hash_setop_except.pngc:203:0: warning:
"ex_hash_setop_except_png" redefined
../pgadmin/include/images/ex_hash_setop_except.pngc:194:0: note: this
is the location of the previous definition
../pgadmin/include/images/ex_hash_setop_except.pngc:215:33: warning:
missing whitespace after the macro name
../pgadmin/include/images/ex_hash_setop_except.pngc:215:0: warning:
"ex_hash_setop_except_png" redefined
../pgadmin/include/images/ex_hash_setop_except.pngc:203:0: note: this
is the location of the previous definition
../pgadmin/include/images/ex_hash_setop_except.pngc:4:52: error:
expected initializer before ‘!’ token
../pgadmin/include/images/ex_hash_setop_except.pngc:182:41: error:
expected initializer before ‘!’ token

No doubt this has something to do with the XPM/PNG thing. Are you aware of this?

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


Re: [pgadmin-hackers] error: expected initializer before ‘!’ token

От
Dave Page
Дата:
On Sat, Mar 12, 2011 at 6:34 AM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
> Hi,
>
> I attempted to build master this evening, but came up against this error:
>
> make[3]: Entering directory `/home/peter/pgadmin3/pgadmin'
> g++ -DHAVE_CONFIG_H -I. -I..
> -DDATA_DIR=\"/usr/local/pgadmin3/share/pgadmin3/\"
> -I../pgadmin/include   -I/usr/local/pgsql/include
> -I/usr/local/pgsql/include -DHAVE_CONNINFO_PARSE
> -I/usr/local/lib/wx/include/gtk2-unicode-debug-2.8
> -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
> -D__WXDEBUG__ -D__WXGTK__ -I/usr/include/libxml2
> -I/usr/include/libxml2  -g -O0 -MT explainShape.o -MD -MP -MF
> .deps/explainShape.Tpo -c -o explainShape.o `test -f
> './ctl/explainShape.cpp' || echo './'`./ctl/explainShape.cpp
> In file included from ./ctl/explainShape.cpp:32:0:
> ../pgadmin/include/images/ex_hash_setop_except.pngc:194:33: warning:
> missing whitespace after the macro name
> ../pgadmin/include/images/ex_hash_setop_except.pngc:203:33: warning:
> missing whitespace after the macro name
> ../pgadmin/include/images/ex_hash_setop_except.pngc:203:0: warning:
> "ex_hash_setop_except_png" redefined
> ../pgadmin/include/images/ex_hash_setop_except.pngc:194:0: note: this
> is the location of the previous definition
> ../pgadmin/include/images/ex_hash_setop_except.pngc:215:33: warning:
> missing whitespace after the macro name
> ../pgadmin/include/images/ex_hash_setop_except.pngc:215:0: warning:
> "ex_hash_setop_except_png" redefined
> ../pgadmin/include/images/ex_hash_setop_except.pngc:203:0: note: this
> is the location of the previous definition
> ../pgadmin/include/images/ex_hash_setop_except.pngc:4:52: error:
> expected initializer before ‘!’ token
> ../pgadmin/include/images/ex_hash_setop_except.pngc:182:41: error:
> expected initializer before ‘!’ token
>
> No doubt this has something to do with the XPM/PNG thing. Are you aware of this?

Nope - works fine here. Can you see the problem? I don't see anything
unusual in pgadmin/include/images/ex_hash_setop_except.pngc here.

--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Re: [pgadmin-hackers] Re: [pgadmin-hackers] error: expected initializer before ‘!’ token

От
Guillaume Lelarge
Дата:
Le 12/03/2011 07:07, Dave Page a écrit :
> On Sat, Mar 12, 2011 at 6:34 AM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
>> Hi,
>>
>> I attempted to build master this evening, but came up against this error:
>>
>> make[3]: Entering directory `/home/peter/pgadmin3/pgadmin'
>> g++ -DHAVE_CONFIG_H -I. -I..
>> -DDATA_DIR=\"/usr/local/pgadmin3/share/pgadmin3/\"
>> -I../pgadmin/include   -I/usr/local/pgsql/include
>> -I/usr/local/pgsql/include -DHAVE_CONNINFO_PARSE
>> -I/usr/local/lib/wx/include/gtk2-unicode-debug-2.8
>> -I/usr/local/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
>> -D__WXDEBUG__ -D__WXGTK__ -I/usr/include/libxml2
>> -I/usr/include/libxml2  -g -O0 -MT explainShape.o -MD -MP -MF
>> .deps/explainShape.Tpo -c -o explainShape.o `test -f
>> './ctl/explainShape.cpp' || echo './'`./ctl/explainShape.cpp
>> In file included from ./ctl/explainShape.cpp:32:0:
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:194:33: warning:
>> missing whitespace after the macro name
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:203:33: warning:
>> missing whitespace after the macro name
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:203:0: warning:
>> "ex_hash_setop_except_png" redefined
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:194:0: note: this
>> is the location of the previous definition
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:215:33: warning:
>> missing whitespace after the macro name
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:215:0: warning:
>> "ex_hash_setop_except_png" redefined
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:203:0: note: this
>> is the location of the previous definition
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:4:52: error:
>> expected initializer before ‘!’ token
>> ../pgadmin/include/images/ex_hash_setop_except.pngc:182:41: error:
>> expected initializer before ‘!’ token
>>
>> No doubt this has something to do with the XPM/PNG thing. Are you aware of this?
>
> Nope - works fine here. Can you see the problem? I don't see anything
> unusual in pgadmin/include/images/ex_hash_setop_except.pngc here.
>

Maybe a stupid question but what is the ! in the variable name
(ex_hash_setop_except_png!_data)?

Anyway, I have the same issue:

In file included from ./ctl/explainShape.cpp:32:
../pgadmin/include/images/ex_hash_setop_except.pngc:194: warning:
missing whitespace after the macro name
../pgadmin/include/images/ex_hash_setop_except.pngc:203: warning:
missing whitespace after the macro name
../pgadmin/include/images/ex_hash_setop_except.pngc:203: warning:
"ex_hash_setop_except_png" redefined
../pgadmin/include/images/ex_hash_setop_except.pngc:194: note: this is
the location of the previous definition
../pgadmin/include/images/ex_hash_setop_except.pngc:215: warning:
missing whitespace after the macro name
../pgadmin/include/images/ex_hash_setop_except.pngc:215: warning:
"ex_hash_setop_except_png" redefined
../pgadmin/include/images/ex_hash_setop_except.pngc:203: note: this is
the location of the previous definition
[...]
g++ -DHAVE_CONFIG_H -I. -I..
-DDATA_DIR=\"/opt/pgadmin-trunk/share/pgadmin3/\" -I../pgadmin/include
 -I/opt/postgresql-head/include -I/opt/postgresql-head/include -DSSL
-DHAVE_CONNINFO_PARSE
-I/opt/wxgtk-2.8/lib/wx/include/gtk2-unicode-debug-2.8
-I/opt/wxgtk-2.8/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES
-D__WXDEBUG__ -D__WXGTK__ -I/usr/include/libxml2 -I/usr/include/libxml2
 -g -O0 -MT xh_ctlcolourpicker.o -MD -MP -MF
.deps/xh_ctlcolourpicker.Tpo -c -o xh_ctlcolourpicker.o `test -f
'./ctl/xh_ctlcolourpicker.cpp' || echo './'`./ctl/xh_ctlcolourpicker.cpp
../pgadmin/include/images/ex_hash_setop_except.pngc:4: error: expected
initializer before ‘!’ token
../pgadmin/include/images/ex_hash_setop_except.pngc:182: error: expected
initializer before ‘!’ token
make[3]: *** [explainShape.o] Error 1

gcc --version
gcc (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com


Re: [pgadmin-hackers] Re: [pgadmin-hackers] error: expected initializer before ‘!’ token

От
Peter Geoghegan
Дата:
On 12 March 2011 19:13, Guillaume Lelarge <guillaume@lelarge.info> wrote:
> Maybe a stupid question but what is the ! in the variable name
> (ex_hash_setop_except_png!_data)?

There's no good reason. It isn't a valid identifier name.

Whatever preprocessor generates ex_hash_setop_except.pngc and other
files like it is broken.

Take a look at this code, at line 205 of same, that clearly illustrates this:

static wxIcon *ex_hash_setop_except_png!_ico()
{
    static wxIcon *ico_ex_hash_setop_except_png!;
    if (!ico_ex_hash_setop_except_png! || !ico_ex_hash_setop_except_png!->IsOk())
    {
        ico_ex_hash_setop_except_png! = new wxIcon();
        ico_ex_hash_setop_except_png!->CopyFromBitmap(*ex_hash_setop_except_png!_bmp);
    }
    return ico_ex_hash_setop_except_png!;
}

--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


Re: [pgadmin-hackers] Re: [pgadmin-hackers] error: expected initializer before ‘!’ token

От
Dave Page
Дата:
On Sun, Mar 13, 2011 at 1:52 AM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
> On 12 March 2011 19:13, Guillaume Lelarge <guillaume@lelarge.info> wrote:
>> Maybe a stupid question but what is the ! in the variable name
>> (ex_hash_setop_except_png!_data)?
>
> There's no good reason. It isn't a valid identifier name.
>
> Whatever preprocessor generates ex_hash_setop_except.pngc and other
> files like it is broken.
>
> Take a look at this code, at line 205 of same, that clearly illustrates this:
>
> static wxIcon *ex_hash_setop_except_png!_ico()

Line 205 here reads:

static wxIcon *ex_hash_setop_except_png_ico()

On Mac and Windows (and Linux worked last time I tried it). Can you
see what's causing the issue for you in the preprorocessor?

/D

--

Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Le 13/03/2011 09:46, Dave Page a écrit :
> On Sun, Mar 13, 2011 at 1:52 AM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
>> On 12 March 2011 19:13, Guillaume Lelarge <guillaume@lelarge.info> wrote:
>>> Maybe a stupid question but what is the ! in the variable name
>>> (ex_hash_setop_except_png!_data)?
>>
>> There's no good reason. It isn't a valid identifier name.
>>
>> Whatever preprocessor generates ex_hash_setop_except.pngc and other
>> files like it is broken.
>>
>> Take a look at this code, at line 205 of same, that clearly illustrates this:
>>
>> static wxIcon *ex_hash_setop_except_png!_ico()
>
> Line 205 here reads:
>
> static wxIcon *ex_hash_setop_except_png_ico()
>
> On Mac and Windows (and Linux worked last time I tried it). Can you
> see what's causing the issue for you in the preprorocessor?
>

So I worked a bit on this issue tonight. I think you didn't allocate
enough memory for filename. See the patch attached. With this patch, it
works OK for me. I'm wondering if the patch should also do +1 on the
other calloc calls. Any ideas on this?

Can you check that it still works on Windows and Mac OS X with this patch?


--
Guillaume
 http://www.postgresql.fr
 http://dalibo.com

Вложения
On 14 March 2011 20:22, Guillaume Lelarge <guillaume@lelarge.info> wrote:
> So I worked a bit on this issue tonight. I think you didn't allocate
> enough memory for filename. See the patch attached. With this patch, it
> works OK for me. I'm wondering if the patch should also do +1 on the
> other calloc calls. Any ideas on this?
>
> Can you check that it still works on Windows and Mac OS X with this patch?

This would of course explain the inconsistent behaviour across
platforms - it was undefined.

This is the the classic "strlen() doesn't include null terminated byte" mistake.


--
Peter Geoghegan       http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training and Services


On Mon, Mar 14, 2011 at 8:22 PM, Guillaume Lelarge
<guillaume@lelarge.info> wrote:
> Le 13/03/2011 09:46, Dave Page a écrit :
>> On Sun, Mar 13, 2011 at 1:52 AM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
>>> On 12 March 2011 19:13, Guillaume Lelarge <guillaume@lelarge.info> wrote:
>>>> Maybe a stupid question but what is the ! in the variable name
>>>> (ex_hash_setop_except_png!_data)?
>>>
>>> There's no good reason. It isn't a valid identifier name.
>>>
>>> Whatever preprocessor generates ex_hash_setop_except.pngc and other
>>> files like it is broken.
>>>
>>> Take a look at this code, at line 205 of same, that clearly illustrates this:
>>>
>>> static wxIcon *ex_hash_setop_except_png!_ico()
>>
>> Line 205 here reads:
>>
>> static wxIcon *ex_hash_setop_except_png_ico()
>>
>> On Mac and Windows (and Linux worked last time I tried it). Can you
>> see what's causing the issue for you in the preprorocessor?
>>
>
> So I worked a bit on this issue tonight. I think you didn't allocate
> enough memory for filename. See the patch attached. With this patch, it
> works OK for me. I'm wondering if the patch should also do +1 on the
> other calloc calls. Any ideas on this?

Good catch - you're right. Fix pushed.

Thanks!


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Mon, Mar 14, 2011 at 8:37 PM, Peter Geoghegan <peter@2ndquadrant.com> wrote:
> On 14 March 2011 20:22, Guillaume Lelarge <guillaume@lelarge.info> wrote:
>> So I worked a bit on this issue tonight. I think you didn't allocate
>> enough memory for filename. See the patch attached. With this patch, it
>> works OK for me. I'm wondering if the patch should also do +1 on the
>> other calloc calls. Any ideas on this?
>>
>> Can you check that it still works on Windows and Mac OS X with this patch?
>
> This would of course explain the inconsistent behaviour across
> platforms - it was undefined.
>
> This is the the classic "strlen() doesn't include null terminated byte" mistake.

Yup :-)


--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company