[Home]

Summary:ASTERISK-03217: [PATCH] make flags macros warn users if they use signed variables
Reporter:Kevin P. Fleming (kpfleming)Labels:
Date Opened:2005-01-08 12:44:30.000-0600Date Closed:2008-01-15 15:20:32.000-0600
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) signed_flags_warning_rev1.diff.txt
Description:The attached patch warns (at compile time) if you try to use anything other than an "unsigned int" variable to hold bit flags using the flag macros from utils.h. The warning is not very explicit, but the comments in utils.h will tell you what to expect and why you are seeing it, if you are.

The patch also converts all existing uses of signed ints for flags into unsigned ints.

Warning: it is heavy on "compiler tricks", but the comment I added in utils.h is accurate... it produces _zero_ additional object code, unless you compile at less than -O2.

****** ADDITIONAL INFORMATION ******

Disclaimer is on file.
Comments:By: Mark Spencer (markster) 2005-01-08 12:56:21.000-0600

Fixed in CVS head, thanks!

By: Russell Bryant (russell) 2005-01-08 16:09:41.000-0600

compiler tricks... I like that :)

By: Digium Subversion (svnbot) 2008-01-15 15:20:32.000-0600

Repository: asterisk
Revision: 4713

U   trunk/apps/app_queue.c
U   trunk/apps/app_voicemail.c
U   trunk/include/asterisk/channel.h
U   trunk/include/asterisk/utils.h

------------------------------------------------------------------------
r4713 | markster | 2008-01-15 15:20:32 -0600 (Tue, 15 Jan 2008) | 2 lines

Warn if flags is signed instead of unsigned (bug ASTERISK-3217)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=4713