libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] enum arguments for MHD_start_daemon


From: Christian Grothoff
Subject: Re: [libmicrohttpd] enum arguments for MHD_start_daemon
Date: Tue, 21 Aug 2012 08:21:42 +0200
User-agent: Mozilla/5.0 (X11; Linux i686; rv:10.0.6esrpre) Gecko/20120805 Icedove/10.0.6

On 08/20/2012 08:29 AM, Martin Velek wrote:
Hello,

I am trying to use this library(libmicrohttpd-0.9.9.tar.gz) with LWIP
and FreeRTOS on LPC2478. Due to limited resources I have enabled an
option "-fshort-enums" (use as small as possible size to hold values
from enum). Similar post has been already written - see
http://lists.gnu.org/archive/html/libmicrohttpd/2012-06/msg00001.html

During compilation these warning messages appear ( arm-none-eabi-gcc,
gcc version 4.6.1 (Sourcery CodeBench 2011.09-60)):
../Source/Library/libmicrohttpd/daemon.c: In function 'parse_options_va':
../Source/Library/libmicrohttpd/daemon.c:1651:35: warning: 'enum
MHD_OPTION' is promoted to 'int' when passed through '...' [enabled by
default]
../Source/Library/libmicrohttpd/daemon.c:1651:35: note: (so you should
pass 'int' not 'enum MHD_OPTION' to 'va_arg')
../Source/Library/libmicrohttpd/daemon.c:1651:35: note: if this code
is reached, the program will abort

It meants that the enum MHD_OPTION is threated as uint8. But when
parameters are extracted, these are threated as int.

"simon h" has suggested to use a special option MHD_OPTION_FORCE32 =
0xFFFFFFFFUL. I would vote for this to overcome this issue.

Would it not be simpler (and possibly more efficient) to just use 'int' instead of 'enum MHD_OPTION' as suggested by the compiler's warning? I'd certainly be willing to do that instead as well...

Happy hacking.

Christian



reply via email to

[Prev in Thread] Current Thread [Next in Thread]