[vtk-developers] GCC 8.2 Warning in Testing

Bill Lorensen bill.lorensen at gmail.com
Tue Feb 5 10:15:14 EST 2019


Folks,

The following warnings are present with the gcc 8.2 compiler. They
occur in the test cxx files.

Building CXX object
Common/Core/Testing/Cxx/CMakeFiles/vtkCommonCoreCxxTests.dir/vtkCommonCoreCxxTests.cxx.o
In function ‘char* lowercase(const char*)’,
    inlined from ‘int main(int, char**)’ at
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:380:20:
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:332:10:
warning: ‘char* strncpy(char*, const char*, size_t)’ specified
bound depends on the length of the source argument
[-Wstringop-overflow=]
   strncpy(new_string, string, stringSize);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:
In function ‘int main(int, char**)’:
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:326:38:
note: length computed here
   stringSize = CM_CAST(size_t, strlen(string) + 1);
                                ~~~~~~^~~~~~~~
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:73:47:
note: in definition of macro ‘CM_CAST’
 #define CM_CAST(TYPE, EXPR) static_cast<TYPE>(EXPR)
                                               ^~~~
In function ‘char* lowercase(const char*)’,
    inlined from ‘int main(int, char**)’ at
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:383:26:
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:332:10:
warning: ‘char* strncpy(char*, const char*, size_t)’ specified
bound depends on the length of the source argument
[-Wstringop-overflow=]
   strncpy(new_string, string, stringSize);
   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:
In function ‘int main(int, char**)’:
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:326:38:
note: length computed here
   stringSize = CM_CAST(size_t, strlen(string) + 1);
                                ~~~~~~^~~~~~~~
/home/lorensen/ProjectsGIT/VTKNewModules-linux/Common/Core/Testing/Cxx/vtkCommonCoreCxxTests.cxx:73:47:
note: in definition of macro ‘CM_CAST’
 #define CM_CAST(TYPE, EXPR) static_cast<TYPE>(EXPR)


-- 
Unpaid intern in BillsParadise at noware dot com


More information about the vtk-developers mailing list