giaf / hpipm

High-performance interior-point-method QP and QCQP solvers
Other
524 stars 127 forks source link

Redeclaration of enums #30

Closed bnovoselnik closed 6 years ago

bnovoselnik commented 6 years ago

There are three enums with the same fields in hpipm_x_ocp_qp_ipm.h, hpipm_x_dense_qp_ipm.h and hpipm_x_tree_ocp_qp_ipm.h:

enum ocp_qp_ipm_mode
    {
    SPEED_ABS, // focus on speed, absolute IPM formulation
    SPEED, // focus on speed, relative IPM formulation
    BALANCE, // balanced mode, relative IPM formulation
    ROBUST, // focus on robustness, relative IPM formulation
    };

enum dense_qp_ipm_mode
    {
    SPEED_ABS, // focus on speed, absolute IPM formulation
    SPEED, // focus on speed, relative IPM formulation
    BALANCE, // balanced mode, relative IPM formulation
    ROBUST, // focus on robustness, relative IPM formulation
    };

enum tree_ocp_qp_ipm_mode
    {
    SPEED_ABS, // focus on speed, absolute IPM formulation
    SPEED, // focus on speed, relative IPM formulation
    BALANCE, // balanced mode, relative IPM formulation
    ROBUST, // focus on robustness, relative IPM formulation
    };

This will create problems whenever both of these headers are included somewhere else (e.g. in ACADOS OCP QP C interface) - compiler will complain about redeclaration of enumerators.

Therefore, these enum fields should be given different names (e.g. OCP_SPEED_ABS, DENSE_SPEED_ABS, TREE_OCP_SPEED, etc.) or just use one enum for everything if the modes are the same in all modules.

giaf commented 6 years ago

should be fixed with the commit https://github.com/giaf/hpipm/commit/7dfadfe8df8c7fd7ace7ad2ee43f604aa3da5d93

bnovoselnik commented 6 years ago

Great, I'll pull it once I get back from Croatia (i.e. next Monday, right now I don't have my laptop with me).