Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cppcheck is seeing issues #233

Open
schwehr opened this issue Sep 23, 2021 · 0 comments
Open

cppcheck is seeing issues #233

schwehr opened this issue Sep 23, 2021 · 0 comments

Comments

@schwehr
Copy link
Owner

schwehr commented Sep 23, 2021

Lots of troubles with

  • initialization
  • not using override
  • members in parent and child with the same name - spare and status
cppcheck --enable=all --std=c++17 -I. ais14.cpp 
Checking ais14.cpp ...
ais.h:445:3: warning: Member variable 'AisMsg::message_id' is not initialized in the constructor. [uninitMemberVar]
  AisMsg() : status(AIS_UNINITIALIZED), num_chars(0), num_bits(0), bits() {}
  ^
ais.h:445:3: warning: Member variable 'AisMsg::repeat_indicator' is not initialized in the constructor. [uninitMemberVar]
  AisMsg() : status(AIS_UNINITIALIZED), num_chars(0), num_bits(0), bits() {}
  ^
ais.h:445:3: warning: Member variable 'AisMsg::mmsi' is not initialized in the constructor. [uninitMemberVar]
  AisMsg() : status(AIS_UNINITIALIZED), num_chars(0), num_bits(0), bits() {}
  ^
ais.h:677:7: warning: The class 'Ais6_1_5' defines member variable with name 'spare' also defined in its parent class 'Ais6'. [duplInheritedMember]
  int spare;
      ^
ais.h:576:7: note: Parent variable 'Ais6::spare'
  int spare;
      ^
ais.h:677:7: note: Derived variable 'Ais6_1_5::spare'
  int spare;
      ^
ais.h:1018:7: warning: The class 'Ais8_1_19' defines member variable with name 'status' also defined in its parent class 'AisMsg'. [duplInheritedMember]
  int status;
      ^
ais.h:440:14: note: Parent variable 'AisMsg::status'
  AIS_STATUS status;  // AIS_OK or error code
             ^
ais.h:1018:7: note: Derived variable 'Ais8_1_19::status'
  int status;
      ^
ais.h:1150:27: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_CIRCLE;}
                          ^
ais.h:1131:35: note: Virtual function in base class
  virtual Ais8_1_22_AreaShapeEnum getType() const = 0;
                                  ^
ais.h:1150:27: note: Function in derived class
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_CIRCLE;}
                          ^
ais.h:1164:27: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_RECT;}
                          ^
ais.h:1131:35: note: Virtual function in base class
  virtual Ais8_1_22_AreaShapeEnum getType() const = 0;
                                  ^
ais.h:1164:27: note: Function in derived class
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_RECT;}
                          ^
ais.h:1178:27: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_SECTOR;}
                          ^
ais.h:1131:35: note: Virtual function in base class
  virtual Ais8_1_22_AreaShapeEnum getType() const = 0;
                                  ^
ais.h:1178:27: note: Function in derived class
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_SECTOR;}
                          ^
ais.h:1195:27: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_POLYLINE;}
                          ^
ais.h:1131:35: note: Virtual function in base class
  virtual Ais8_1_22_AreaShapeEnum getType() const = 0;
                                  ^
ais.h:1195:27: note: Function in derived class
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_POLYLINE;}
                          ^
ais.h:1211:27: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_POLYGON;}
                          ^
ais.h:1131:35: note: Virtual function in base class
  virtual Ais8_1_22_AreaShapeEnum getType() const = 0;
                                  ^
ais.h:1211:27: note: Function in derived class
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_POLYGON;}
                          ^
ais.h:1222:27: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_TEXT;}
                          ^
ais.h:1131:35: note: Virtual function in base class
  virtual Ais8_1_22_AreaShapeEnum getType() const = 0;
                                  ^
ais.h:1222:27: note: Function in derived class
  Ais8_1_22_AreaShapeEnum getType() const {return AIS8_1_22_SHAPE_TEXT;}
                          ^
ais.h:1323:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const { return AIS8_1_26_SENSOR_LOCATION; }
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1323:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const { return AIS8_1_26_SENSOR_LOCATION; }
                       ^
ais.h:1333:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_STATION;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1333:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_STATION;}
                       ^
ais.h:1354:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_WIND;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1354:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_WIND;}
                       ^
ais.h:1374:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_WATER_LEVEL;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1374:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_WATER_LEVEL;}
                       ^
ais.h:1392:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_CURR_2D;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1392:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_CURR_2D;}
                       ^
ais.h:1411:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_CURR_3D;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1411:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_CURR_3D;}
                       ^
ais.h:1430:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_HORZ_FLOW;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1430:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_HORZ_FLOW;}
                       ^
ais.h:1451:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_SEA_STATE;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1451:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_SEA_STATE;}
                       ^
ais.h:1466:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_SALINITY;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1466:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_SALINITY;}
                       ^
ais.h:1485:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_WX;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1485:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_WX;}
                       ^
ais.h:1501:24: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_AIR_DRAUGHT;}
                       ^
ais.h:1305:32: note: Virtual function in base class
  virtual Ais8_1_26_SensorEnum getType() const = 0;
                               ^
ais.h:1501:24: note: Function in derived class
  Ais8_1_26_SensorEnum getType() const {return AIS8_1_26_SENSOR_AIR_DRAUGHT;}
                       ^
ais.h:1774:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_CIRCLE;}
                            ^
ais.h:1756:39: note: Virtual function in base class
    virtual Ais8_366_22_AreaShapeEnum getType() = 0;
                                      ^
ais.h:1774:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_CIRCLE;}
                            ^
ais.h:1788:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_RECT;}
                            ^
ais.h:1756:39: note: Virtual function in base class
    virtual Ais8_366_22_AreaShapeEnum getType() = 0;
                                      ^
ais.h:1788:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_RECT;}
                            ^
ais.h:1802:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_SECTOR;}
                            ^
ais.h:1756:39: note: Virtual function in base class
    virtual Ais8_366_22_AreaShapeEnum getType() = 0;
                                      ^
ais.h:1802:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_SECTOR;}
                            ^
ais.h:1819:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYLINE;}
                            ^
ais.h:1756:39: note: Virtual function in base class
    virtual Ais8_366_22_AreaShapeEnum getType() = 0;
                                      ^
ais.h:1819:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYLINE;}
                            ^
ais.h:1834:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYGON;}
                            ^
ais.h:1756:39: note: Virtual function in base class
    virtual Ais8_366_22_AreaShapeEnum getType() = 0;
                                      ^
ais.h:1834:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_POLYGON;}
                            ^
ais.h:1844:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_TEXT;}
                            ^
ais.h:1756:39: note: Virtual function in base class
    virtual Ais8_366_22_AreaShapeEnum getType() = 0;
                                      ^
ais.h:1844:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() {return AIS8_366_22_SHAPE_TEXT;}
                            ^
ais.h:1898:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_CIRCLE;}
                            ^
ais.h:1881:37: note: Virtual function in base class
  virtual Ais8_366_22_AreaShapeEnum getType() const = 0;
                                    ^
ais.h:1898:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_CIRCLE;}
                            ^
ais.h:1912:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_RECT;}
                            ^
ais.h:1881:37: note: Virtual function in base class
  virtual Ais8_366_22_AreaShapeEnum getType() const = 0;
                                    ^
ais.h:1912:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_RECT;}
                            ^
ais.h:1926:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_SECTOR;}
                            ^
ais.h:1881:37: note: Virtual function in base class
  virtual Ais8_366_22_AreaShapeEnum getType() const = 0;
                                    ^
ais.h:1926:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_SECTOR;}
                            ^
ais.h:1944:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() const {return shape;}
                            ^
ais.h:1881:37: note: Virtual function in base class
  virtual Ais8_366_22_AreaShapeEnum getType() const = 0;
                                    ^
ais.h:1944:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() const {return shape;}
                            ^
ais.h:1954:29: style: The function 'getType' overrides a function in a base class but is not marked with a 'override' specifier. [missingOverride]
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_TEXT;}
                            ^
ais.h:1881:37: note: Virtual function in base class
  virtual Ais8_366_22_AreaShapeEnum getType() const = 0;
                                    ^
ais.h:1954:29: note: Function in derived class
  Ais8_366_22_AreaShapeEnum getType() const {return AIS8_366_22_SHAPE_TEXT;}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant