Skip to content

COMP: Remove use of itkDebugMacro in static method#4544

Merged
thewtex merged 1 commit intoInsightSoftwareConsortium:masterfrom
thewtex:gdcm-this-get-debug-static
Mar 28, 2024
Merged

COMP: Remove use of itkDebugMacro in static method#4544
thewtex merged 1 commit intoInsightSoftwareConsortium:masterfrom
thewtex:gdcm-this-get-debug-static

Conversation

@thewtex
Copy link
Copy Markdown
Member

@thewtex thewtex commented Mar 27, 2024

To address:

/Users/builder/externalModules/IO/GDCM/src/itkGDCMImageIO.cxx:191:3: error: invalid use of 'this' outside of a non-static member function
  itkDebugMacro(<< "No DICOM magic number found, but the file appears to be DICOM without a preamble.");
  ^
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:504:11: note: expanded from macro 'itkDebugMacro'
      if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay())        \
          ^
/Users/builder/externalModules/IO/GDCM/src/itkGDCMImageIO.cxx:191:3: error: invalid use of 'this' outside of a non-static member function
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:508:19: note: expanded from macro 'itkDebugMacro'
               << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
                  ^
/Users/builder/externalModules/IO/GDCM/src/itkGDCMImageIO.cxx:191:3: error: invalid use of 'this' outside of a non-static member function
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:508:53: note: expanded from macro 'itkDebugMacro'
               << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
                                                    ^
3 errors generated.

Re: https://open.cdash.org/viewBuildError.php?buildid=9495220

@github-actions github-actions Bot added type:Compiler Compiler support or related warnings area:IO Issues affecting the IO module labels Mar 27, 2024
@thewtex thewtex requested review from lassoan and seanm March 27, 2024 22:20
Copy link
Copy Markdown
Member

@dzenanz dzenanz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Andras might have a different patch, but to get the nightly dashboard clean, this can be merged quickly.

Copy link
Copy Markdown
Contributor

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thank you. I haven't had the time to implement something more sophisticated.

@jhlegarreta
Copy link
Copy Markdown
Member

jhlegarreta commented Mar 27, 2024

Sorry to chime in: this note in here looks relevant:
https://github.com/InsightSoftwareConsortium/ITK/pull/4544/files#diff-216ad6bbbfe7f99a925b274660dcd203a7e873f64745ecf087dd4460c0a1ebc4R132
(should maybe say "method" instead of "file" but anyways)

But if it is relevant, it is worthwhile pointing that the DCMTK counterpart method is not static: it was recently changed in commit (including renaming it)
decc3e5#diff-4f73091b3003136c994a445b6eda56d8ac3e9044936fbb78a0649164a8c31a73R65

And thanks for all the effort to get all these fixes lately, and for noticing the dashboard failures this morning.

@N-Dekker
Copy link
Copy Markdown
Contributor

/azp run ITK.macOS

}
} while (groupNo == 2);

itkDebugMacro(<< "No DICOM magic number found, but the file appears to be DICOM without a preamble.");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Matt!

Copy link
Copy Markdown
Member

@issakomi issakomi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same should be done for DCMTK IO.

/home/r/itk/ITK/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx: In function ‘bool {anonymous}::isNoPreambleDicom(std::ifstream&)’:
/home/r/itk/ITK/Modules/Core/Common/include/itkMacro.h:504:11: error: invalid use of ‘this’ in non-member function
  504 |       if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay())        \
      |           ^~~~
/home/r/itk/ITK/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx:126:3: note: in expansion of macro ‘itkDebugMacro’
  126 |   itkDebugMacro(<< "No DICOM magic number found, but the file appears to be DICOM without a preamble.");
      |   ^~~~~~~~~~~~~
/home/r/itk/ITK/Modules/Core/Common/include/itkMacro.h:508:19: error: invalid use of ‘this’ in non-member function
  508 |                << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
      |                   ^~~~
/home/r/itk/ITK/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx:126:3: note: in expansion of macro ‘itkDebugMacro’
  126 |   itkDebugMacro(<< "No DICOM magic number found, but the file appears to be DICOM without a preamble.");
      |   ^~~~~~~~~~~~~
/home/r/itk/ITK/Modules/Core/Common/include/itkMacro.h:508:53: error: invalid use of ‘this’ in non-member function
  508 |                << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
      |                                                     ^~~~
/home/r/itk/ITK/Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx:126:3: note: in expansion of macro ‘itkDebugMacro’
  126 |   itkDebugMacro(<< "No DICOM magic number found, but the file appears to be DICOM without a preamble.");
      |   ^~~~~~~~~~~~~
make[2]: *** [Modules/IO/DCMTK/src/CMakeFiles/ITKIODCMTK.dir/build.make:76: Modules/IO/DCMTK/src/CMakeFiles/ITKIODCMTK.dir/itkDCMTKImageIO.cxx.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:9911: Modules/IO/DCMTK/src/CMakeFiles/ITKIODCMTK.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

To address:

```
/Users/builder/externalModules/IO/GDCM/src/itkGDCMImageIO.cxx:191:3: error: invalid use of 'this' outside of a non-static member function
  itkDebugMacro(<< "No DICOM magic number found, but the file appears to be DICOM without a preamble.");
  ^
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:504:11: note: expanded from macro 'itkDebugMacro'
      if (this->GetDebug() && ::itk::Object::GetGlobalWarningDisplay())        \
          ^
/Users/builder/externalModules/IO/GDCM/src/itkGDCMImageIO.cxx:191:3: error: invalid use of 'this' outside of a non-static member function
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:508:19: note: expanded from macro 'itkDebugMacro'
               << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
                  ^
/Users/builder/externalModules/IO/GDCM/src/itkGDCMImageIO.cxx:191:3: error: invalid use of 'this' outside of a non-static member function
[CTest: warning matched] /Users/builder/externalModules/Core/Common/include/itkMacro.h:508:53: note: expanded from macro 'itkDebugMacro'
               << this->GetNameOfClass() << " (" << this << "): " x << "\n\n"; \
                                                    ^
3 errors generated.
```

Re: https://open.cdash.org/viewBuildError.php?buildid=9495220
@thewtex thewtex force-pushed the gdcm-this-get-debug-static branch from 9b967f6 to 843dba1 Compare March 28, 2024 12:14
@thewtex
Copy link
Copy Markdown
Member Author

thewtex commented Mar 28, 2024

Thanks, all for the reviews. 👁️

Also removed from DCMTKImageIO.

@dzenanz dzenanz mentioned this pull request Mar 28, 2024
7 tasks
@thewtex thewtex merged commit 1780a31 into InsightSoftwareConsortium:master Mar 28, 2024
@thewtex thewtex deleted the gdcm-this-get-debug-static branch March 28, 2024 16:47
hjmjohnson pushed a commit to hjmjohnson/ITK that referenced this pull request May 6, 2026
…his-get-debug-static

COMP: Remove use of itkDebugMacro in static method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:IO Issues affecting the IO module type:Compiler Compiler support or related warnings

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants