Skip to content

Commit 4ac2999

Browse files
ferdymercuryguitargeek
authored andcommitted
[hbook] Adapt to GCC 8 passing convention for string length
Follow-up of #20535
1 parent 5ca7f5c commit 4ac2999

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

hist/hbook/src/THbookFile.cxx

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,15 @@ static Int_t gLastEntry = -1;
137137
# define type_of_call
138138
# define DEFCHAR const char*
139139
# define PASSCHAR(string) string
140+
141+
// As recommended in
142+
// https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html
143+
#if __GNUC__ > 7
144+
typedef size_t fortran_charlen_t;
145+
#else
146+
typedef int fortran_charlen_t;
147+
#endif
148+
140149
#else
141150
# define hlimit HLIMIT
142151
# define hldir HLDIR
@@ -177,8 +186,8 @@ static Int_t gLastEntry = -1;
177186
extern "C" void type_of_call hlimit(const int&);
178187
#ifndef WIN32
179188
extern "C" void type_of_call hropen(const int&,DEFCHAR,DEFCHAR,DEFCHAR,
180-
const int&,const int&,const int,const int,const int);
181-
extern "C" void type_of_call hrend(DEFCHAR,const int);
189+
const int&,const int&,fortran_charlen_t,fortran_charlen_t,fortran_charlen_t);
190+
extern "C" void type_of_call hrend(DEFCHAR,fortran_charlen_t);
182191
#else
183192
extern "C" void type_of_call hropen(const int&,DEFCHAR,DEFCHAR,DEFCHAR,
184193
const int&,const int&);
@@ -189,7 +198,7 @@ extern "C" void type_of_call hrin(const int&,const int&,const int&);
189198
extern "C" void type_of_call hnoent(const int&,const int&);
190199
#ifndef WIN32
191200
extern "C" void type_of_call hgive(const int&,DEFCHAR,const int&,const float&,const float&,
192-
const int&,const float&,const float&,const int&,const int&,const int);
201+
const int&,const float&,const float&,const int&,const int&,fortran_charlen_t);
193202
#else
194203
extern "C" void type_of_call hgive(const int&,DEFCHAR,const int&,const float&,const float&,
195204
const int&,const float&,const float&,const int&,const int&);
@@ -198,24 +207,24 @@ extern "C" void type_of_call hgive(const int&,DEFCHAR,const int&,const float&,c
198207
//SUBROUTINE HGNT1(IDD,BLKNA1,VAR,IOFFST,NVAR,IDNEVT,IERROR)
199208
#ifndef WIN32
200209
extern "C" void type_of_call hgiven(const int&,DEFCHAR,const int&,DEFCHAR,
201-
const float&,const float&,const int,const int);
202-
extern "C" void type_of_call hgnt1(const int&,DEFCHAR,DEFCHAR,const int&,const int&,const int&,const int&,const int,const int);
210+
const float&,const float&,fortran_charlen_t,fortran_charlen_t);
211+
extern "C" void type_of_call hgnt1(const int&,DEFCHAR,DEFCHAR,const int&,const int&,const int&,const int&,fortran_charlen_t,fortran_charlen_t);
203212
#else
204213
extern "C" void type_of_call hgiven(const int&,DEFCHAR,const int&,DEFCHAR,
205214
const float&,const float&);
206215
extern "C" void type_of_call hgnt1(const int&,DEFCHAR,DEFCHAR,const int&,const int&,const int&,const int&);
207216
#endif
208217

209218
#ifndef WIN32
210-
extern "C" void type_of_call hntvar2(const int&,const int&,DEFCHAR,DEFCHAR,DEFCHAR,int&,int&,int&,int&,int&,const int,const int, const int);
211-
extern "C" void type_of_call hntvar3(const int&,const int&,DEFCHAR, const int);
219+
extern "C" void type_of_call hntvar2(const int&,const int&,DEFCHAR,DEFCHAR,DEFCHAR,int&,int&,int&,int&,int&,fortran_charlen_t,fortran_charlen_t, fortran_charlen_t);
220+
extern "C" void type_of_call hntvar3(const int&,const int&,DEFCHAR, fortran_charlen_t);
212221
#else
213222
extern "C" void type_of_call hntvar2(const int&,const int&,DEFCHAR,DEFCHAR,DEFCHAR,int&,int&,int&,int&,int&);
214223
extern "C" void type_of_call hntvar3(const int&,const int&,DEFCHAR);
215224
#endif
216225

217226
#ifndef WIN32
218-
extern "C" void type_of_call hbnam(const int&,DEFCHAR,const int&,DEFCHAR,const int&,const int, const int);
227+
extern "C" void type_of_call hbnam(const int&,DEFCHAR,const int&,DEFCHAR,const int&,fortran_charlen_t, fortran_charlen_t);
219228
#else
220229
extern "C" void type_of_call hbnam(const int&,DEFCHAR,const int&,DEFCHAR,const int&);
221230
#endif
@@ -237,8 +246,8 @@ extern "C" void type_of_call hix(const int&,const int&,const float&);
237246
extern "C" void type_of_call hijxy(const int&,const int&,const int&,const float&,const float&);
238247
extern "C" float type_of_call hije(const int&,const int&,const int&);
239248
#ifndef WIN32
240-
extern "C" void type_of_call hcdir(DEFCHAR,DEFCHAR ,const int,const int);
241-
extern "C" void type_of_call hldir(DEFCHAR,DEFCHAR ,const int,const int);
249+
extern "C" void type_of_call hcdir(DEFCHAR,DEFCHAR ,fortran_charlen_t,fortran_charlen_t);
250+
extern "C" void type_of_call hldir(DEFCHAR,DEFCHAR ,fortran_charlen_t,fortran_charlen_t);
242251
#else
243252
extern "C" void type_of_call hcdir(DEFCHAR,DEFCHAR);
244253
extern "C" void type_of_call hldir(DEFCHAR,DEFCHAR);

0 commit comments

Comments
 (0)