View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004618ITKpublic2007-03-16 11:242010-10-21 12:31
ReporterMathieu Coursolle 
Assigned ToLuis Ibanez 
PrioritylowSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0004618: itkDebugMacro causes warning in XCode with enum types.
DescriptionWhen including itk headers in a XCode project, the itkSetMacro, itkGetMacro, itkGetConstMacro and itkGetConstReferenceMacro produce a warning when the input type is an enum:

/include/InsightToolkit/IO/itkImageIOBase.h: In member function 'virtual void itk::ImageIOBase::SetPixelType(itk::ImageIOBase::IOPixelType)':
/include/InsightToolkit/IO/itkImageIOBase.h:136: warning: passing 'itk::ImageIOBase::IOPixelType' chooses 'int' over 'long unsigned int'
/include/InsightToolkit/IO/itkImageIOBase.h:136: warning: in call to 'std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator<<(int) [with _CharT = char, _Traits = std::char_traits<char>]'

A patch is provide which solves the problem for the IO classes. New macro were added to handle enum types: itkSetEnumMacro, etc. The enum type is there casted into a long value to force the type.

Another proposed solution would be to force the enum type at declaration:

Replace typedef enum{TYPE1, TYPE2} MyEnum;

with

enum { TYPE1, TYPE2}
typedef long MyEnum;

This forces the enum type. Otherwise, the enum type might be considered as a different type according to the platform it is used on. This is mainly true for 64 bits platforms.
TagsNo tags attached.
Resolution Date
Sprint
Sprint Status
Attached Filestxt file icon patchfileEnums.txt [^] (4,585 bytes) 1969-12-31 19:00 [Show Content]
txt file icon patch.txt [^] (1,090 bytes) 2009-03-02 12:36 [Show Content]

 Relationships

  Notes
(0006828)
Luis Ibanez (manager)
2007-03-18 11:11

The patch was modified to have only a Get macro that generates a const method.

http://www.itk.org/cgi-bin/viewcvs.cgi/Code/Common/itkMacro.h?root=Insight&sortby=date&r2=1.70&r1=1.69 [^]
(0015493)
Mathieu Coursolle (developer)
2009-03-02 12:35

CVS revision 1.19 of itkConnectedThresholdImageFilter reintroduced the issue.

Building with xCode 3.1.2 on Mac OS 10.5.6 produces the warning for the Connectiviy ivar when ITK_USE_REVIEW is turned on.

The itkSetEnumMacro and itkGetEnumMacro should be used instead of itkSetMacro and itkGetMacro for enum types.

A patch will be provided.
(0015494)
Mathieu Coursolle (developer)
2009-03-02 12:37

patch.txt was uploaded (See 0015493 note).
(0016635)
Sean McBride (developer)
2009-06-04 10:14

Luis, any objections to me committing this? It seems quite harmless.
(0016646)
Sean McBride (developer)
2009-06-05 12:06

/cvsroot/Insight/Insight/Code/BasicFilters/itkConnectedThresholdImageFilter.h,v <-- itkConnectedThresholdImageFilter.h
new revision: 1.22; previous revision: 1.21

 Issue History
Date Modified Username Field Change
2009-03-02 12:35 Mathieu Coursolle Note Added: 0015493
2009-03-02 12:35 Mathieu Coursolle Status closed => feedback
2009-03-02 12:35 Mathieu Coursolle Resolution fixed => reopened
2009-03-02 12:36 Mathieu Coursolle File Added: patch.txt
2009-03-02 12:37 Mathieu Coursolle Note Added: 0015494
2009-06-04 10:14 Sean McBride Note Added: 0016635
2009-06-05 12:06 Sean McBride Note Added: 0016646
2009-06-05 12:06 Sean McBride Status feedback => resolved
2009-06-05 12:06 Sean McBride Resolution reopened => fixed
2010-10-21 12:31 Gabe Hart Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team