Violations of the One Definition Rule
Compiling with GCC 6.3.0 with Link-Time Optimization enabled uncovers two violations of C++'s One Definition Rule:
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkLine.cxx:735:3: warning: type ‘struct LINE_CASES’ violates the C++ One Definition Rule [-Wodr]
} LINE_CASES;
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkQuad.cxx:382:3: note: a different type is defined in another translation unit
} LINE_CASES;
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkLine.cxx:734:25: note: the first difference of corresponding definitions is field ‘lines’
LINE_LIST lines[2];
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkQuad.cxx:381:25: note: a field with different name is defined in another translation unit
EDGE_LIST edges[5];
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkPyramid.cxx:341:3: warning: type ‘struct TRIANGLE_CASES’ violates the C++ One Definition Rule [-Wodr]
} TRIANGLE_CASES;
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkTetra.cxx:228:3: note: a different type is defined in another translation unit
} TRIANGLE_CASES;
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkPyramid.cxx:340:26: note: the first difference of corresponding definitions is field ‘edges’
EDGE_LIST edges[13];
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkTetra.cxx:227:25: note: a field of same name but different type is defined in another translation unit
EDGE_LIST edges[7];
^
/usr/local/src/VTK-7.1.0/Common/DataModel/vtkPyramid.cxx:341:3: note: array types have different bounds
} TRIANGLE_CASES;
^
and
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYReader.cxx:56:16: warning: type ‘struct _plyFace’ violates the C++ One Definition Rule [-Wodr]
typedef struct _plyFace {
^
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYWriter.cxx:68:16: note: a different type is defined in another translation unit
typedef struct _plyFace {
^
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYReader.cxx:57:17: note: the first difference of corresponding definitions is field ‘intensity’
unsigned char intensity; // optional face attributes
^
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYWriter.cxx:69:17: note: a field with different name is defined in another translation unit
unsigned char nverts; // number of vertex indices in list
^
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYReader.cxx:47:16: warning: type ‘struct _plyVertex’ violates the C++ One Definition Rule [-Wodr]
typedef struct _plyVertex {
^
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYWriter.cxx:60:16: note: a different type is defined in another translation unit
typedef struct _plyVertex {
^
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYReader.cxx:49:14: note: the first difference of corresponding definitions is field ‘tex’
float tex[2];
^
/usr/local/src/VTK-7.1.0/IO/PLY/vtkPLYWriter.cxx:62:17: note: a field with different name is defined in another translation unit
unsigned char red;
^