Skip to content

Commit bdff1d1

Browse files
authored
Merge pull request #547 from sourceryinstitute/ifb-macros
Fixed CFI_SUCCESS and eliminated CFI_FAILURE after asking Bill Long.
2 parents a30c312 + 9e3e400 commit bdff1d1

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

src/iso-fortran-binding/ISO_Fortran_binding.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,17 @@ int CFI_is_contiguous (const CFI_cdesc_t *dv)
383383
for (int i = 0; i < dv->rank; i++)
384384
{
385385
if (dv->dim[i].sm != dv->elem_len)
386-
return CFI_FAILURE;
386+
return 0;
387387
}
388388

389389
/* Allocatable arrays are always contiguous. */
390390
if (dv->attribute == CFI_attribute_allocatable)
391391
{
392-
return CFI_SUCCESS;
392+
return 1;
393393
}
394394
else
395395
{
396-
return CFI_FAILURE;
396+
return 0;
397397
}
398398
}
399399

src/iso-fortran-binding/ISO_Fortran_binding.h

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,19 @@ extern "C" {
3333
#define CFI_attribute_allocatable 1
3434
#define CFI_attribute_other 2
3535

36-
/* Error codes.
37-
CFI_FAILURE and CFI_INVALID_STRIDE should be defined in the standard because they are useful to the implementation of the functions.
38-
*/
39-
#define CFI_FAILURE 0
40-
#define CFI_SUCCESS 1
41-
#define CFI_ERROR_BASE_ADDR_NULL 2
42-
#define CFI_ERROR_BASE_ADDR_NOT_NULL 3
43-
#define CFI_INVALID_ELEM_LEN 4
44-
#define CFI_INVALID_RANK 5
45-
#define CFI_INVALID_TYPE 6
46-
#define CFI_INVALID_ATTRIBUTE 7
47-
#define CFI_INVALID_EXTENT 8
48-
#define CFI_INVALID_STRIDE 9
49-
#define CFI_INVALID_DESCRIPTOR 10
50-
#define CFI_ERROR_MEM_ALLOCATION 11
51-
#define CFI_ERROR_OUT_OF_BOUNDS 12
36+
/* Error codes. */
37+
#define CFI_SUCCESS 0
38+
#define CFI_ERROR_BASE_ADDR_NULL 1
39+
#define CFI_ERROR_BASE_ADDR_NOT_NULL 2
40+
#define CFI_INVALID_ELEM_LEN 3
41+
#define CFI_INVALID_RANK 4
42+
#define CFI_INVALID_TYPE 5
43+
#define CFI_INVALID_ATTRIBUTE 6
44+
#define CFI_INVALID_EXTENT 7
45+
#define CFI_INVALID_STRIDE 8
46+
#define CFI_INVALID_DESCRIPTOR 9
47+
#define CFI_ERROR_MEM_ALLOCATION 10
48+
#define CFI_ERROR_OUT_OF_BOUNDS 11
5249

5350
/* CFI type definitions. */
5451
typedef ptrdiff_t CFI_index_t;

0 commit comments

Comments
 (0)