[LU-4107] luser_user.h is not C++ compatible Created: 15/Oct/13 Updated: 01/Sep/15 Resolved: 17/Apr/14 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | Lustre 2.4.1 |
| Fix Version/s: | Lustre 2.6.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Ned Bass | Assignee: | Minh Diep |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Severity: | 3 | ||||
| Rank (Obsolete): | 11039 | ||||
| Description |
|
Some users would like to include lustre_user.h or lustreapi.h in C++ applications. There are a few compatibility issues currently preventing this. $ cat a.c #include <lustre/lustre_user.h> $ g++ -c a.c In file included from a.c:1: /usr/include/lustre/lustre_user.h:185: error: 'struct ost_id::<anonymous union>::ostid' invalid; an anonymous union can only have non-static data members /usr/include/lustre/lustre_user.h: In function 'hsm_event hsm_get_cl_event(__u16)': /usr/include/lustre/lustre_user.h:728: error: invalid conversion from 'int' to 'hsm_event' /usr/include/lustre/lustre_user.h: In function 'int hur_len(hsm_user_request*)': /usr/include/lustre/lustre_user.h:1002: error: 'hur' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '->' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '.' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h: In function 'char* hai_dump_data_field(hsm_action_item*, char*, int)': /usr/include/lustre/lustre_user.h:1068: error: 'snprintf' was not declared in this scope While we're at it, we may also want to clean up these warnings which are normally suppressed because they're in a system header. $ g++ -Wall -Wsystem-headers -c a.c In file included from a.c:1: /usr/include/lustre/lustre_user.h:185: error: 'struct ost_id::<anonymous union>::ostid' invalid; an anonymous union can only have non-static data members /usr/include/lustre/lustre_user.h: In function 'hsm_event hsm_get_cl_event(__u16)': /usr/include/lustre/lustre_user.h:728: error: invalid conversion from 'int' to 'hsm_event' /usr/include/lustre/lustre_user.h: In function 'char* hsm_progress_state2name(hsm_progress_states)': /usr/include/lustre/lustre_user.h:889: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:890: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:891: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:892: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h: In function 'char* hsm_user_action2name(hsm_user_action)': /usr/include/lustre/lustre_user.h:951: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:952: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:953: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:954: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:955: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:956: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:957: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h: In function 'int hur_len(hsm_user_request*)': /usr/include/lustre/lustre_user.h:1002: error: 'hur' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '->' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h:1002: error: '.' cannot appear in a constant-expression /usr/include/lustre/lustre_user.h: In function 'char* hsm_copytool_action2name(hsm_copytool_action)': /usr/include/lustre/lustre_user.h:1025: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1026: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1027: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1028: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1029: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h:1030: warning: deprecated conversion from string constant to 'char*' /usr/include/lustre/lustre_user.h: In function 'char* hai_dump_data_field(hsm_action_item*, char*, int)': /usr/include/lustre/lustre_user.h:1068: error: 'snprintf' was not declared in this scope /usr/include/lustre/lustre_user.h: In function 'int hal_size(hsm_action_list*)': /usr/include/lustre/lustre_user.h:1121: warning: comparison between signed and unsigned integer expressions |
| Comments |
| Comment by Peter Jones [ 15/Oct/13 ] |
|
Minh will help with this one |
| Comment by Andreas Dilger [ 16/Oct/13 ] |
|
Is this a regression compared to lustre_user.h in 2.4, or is this a new application using it for the first time? |
| Comment by Ned Bass [ 16/Oct/13 ] |
|
It's a new app, so not a regression. In fact, they were trying to build against Lustre 2.1, and got a slightly different set of errors. /usr/include/lustre/lustre_user.h: In function 'hsm_event hsm_get_cl_event(__u16)': /usr/include/lustre/lustre_user.h:565: error: invalid conversion from '__u16' to 'hsm_event' /usr/include/lustre/lustre_user.h: In function 'int hur_len(hsm_user_request*)': /usr/include/lustre/lustre_user.h:759: error: invalid use of 'void' /usr/include/lustre/lustre_user.h: In function 'char* hai_dump_data_field(hsm_action_item*, char*, int)': /usr/include/lustre/lustre_user.h:823: error: 'snprintf' was not declared in this scope |
| Comment by Minh Diep [ 21/Oct/13 ] |
| Comment by Peter Jones [ 17/Apr/14 ] |
|
Landed for 2.6 |