Skip to content

Fixed format warnings in 64 bit integer builds. #700

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CBLAS/examples/cblas_example1.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int main ( )
y, incy );
/* Print y */
for( i = 0; i < n; i++ )
printf(" y%d = %f\n", i, y[i]);
printf(" y%" CBLAS_IFMT " = %f\n", i, y[i]);
free(a);
free(x);
free(y);
Expand Down
12 changes: 12 additions & 0 deletions CBLAS/include/cblas.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CBLAS_H
#include <stddef.h>
#include <stdint.h>
#include <inttypes.h>


#ifdef __cplusplus
Expand All @@ -24,6 +25,17 @@ extern "C" { /* Assume C declarations for C++ */
#endif
#endif

/*
* Integer format string
*/
#ifndef CBLAS_IFMT
#ifdef WeirdNEC
#define CBLAS_IFMT PRId64
#else
#define CBLAS_IFMT PRId32
#endif
#endif

typedef enum CBLAS_LAYOUT {CblasRowMajor=101, CblasColMajor=102} CBLAS_LAYOUT;
typedef enum CBLAS_TRANSPOSE {CblasNoTrans=111, CblasTrans=112, CblasConjTrans=113} CBLAS_TRANSPOSE;
typedef enum CBLAS_UPLO {CblasUpper=121, CblasLower=122} CBLAS_UPLO;
Expand Down
2 changes: 1 addition & 1 deletion CBLAS/src/cblas_xerbla.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cblas_xerbla(CBLAS_INT info, const char *rout, const char *form, ...)
}
}
if (info)
fprintf(stderr, "Parameter %d to routine %s was incorrect\n", info, rout);
fprintf(stderr, "Parameter %" CBLAS_IFMT " to routine %s was incorrect\n", info, rout);
vfprintf(stderr, form, argptr);
va_end(argptr);
if (info && !info)
Expand Down
2 changes: 1 addition & 1 deletion CBLAS/testing/c_xerbla.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void cblas_xerbla(CBLAS_INT info, const char *rout, const char *form, ...)
}

if (info != cblas_info){
printf("***** XERBLA WAS CALLED WITH INFO = %d INSTEAD OF %d in %s *******\n",info, cblas_info, rout);
printf("***** XERBLA WAS CALLED WITH INFO = %" CBLAS_IFMT " INSTEAD OF %d in %s *******\n",info, cblas_info, rout);
cblas_lerr = PASSED;
cblas_ok = FALSE;
} else cblas_lerr = FAILED;
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/example/example_DGESV_colmajor.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ int main(int argc, char **argv) {
/* Check for the exact singularity */
if( info > 0 ) {
printf( "The diagonal element of the triangular factor of A,\n" );
printf( "U(%i,%i) is zero, so that A is singular;\n", info, info );
printf( "U(%" LAPACK_IFMT ",%" LAPACK_IFMT ") is zero, so that A is singular;\n", info, info );
printf( "the solution could not be computed.\n" );
exit( 1 );
}
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/example/example_DGESV_rowmajor.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ int main(int argc, char **argv) {
/* Check for the exact singularity */
if( info > 0 ) {
printf( "The diagonal element of the triangular factor of A,\n" );
printf( "U(%i,%i) is zero, so that A is singular;\n", info, info );
printf( "U(%" LAPACK_IFMT ",%" LAPACK_IFMT ") is zero, so that A is singular;\n", info, info );
printf( "the solution could not be computed.\n" );
exit( 1 );
}
Expand Down
2 changes: 1 addition & 1 deletion LAPACKE/example/lapacke_example_aux.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ void print_matrix_colmajor( char* desc, lapack_int m, lapack_int n, double* mat,
void print_vector( char* desc, lapack_int n, lapack_int* vec ) {
lapack_int j;
printf( "\n %s\n", desc );
for( j = 0; j < n; j++ ) printf( " %6i", vec[j] );
for( j = 0; j < n; j++ ) printf( " %6" LAPACK_IFMT, vec[j] );
printf( "\n" );
}
20 changes: 18 additions & 2 deletions LAPACKE/include/lapack.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <stdlib.h>
#include <stdarg.h>
#include <inttypes.h>

/* It seems all current Fortran compilers put strlen at end.
* Some historical compilers put strlen after the str argument
Expand Down Expand Up @@ -80,11 +81,26 @@ extern "C" {

/*----------------------------------------------------------------------------*/
#ifndef lapack_int
#define lapack_int int
#if defined(LAPACK_ILP64)
#define lapack_int int64_t
#else
#define lapack_int int32_t
#endif
#endif

/*
* Integer format string
*/
#ifndef LAPACK_IFMT
#if defined(LAPACK_ILP64)
#define LAPACK_IFMT PRId64
#else
#define LAPACK_IFMT PRId32
#endif
#endif

#ifndef lapack_logical
#define lapack_logical lapack_int
#define lapack_logical lapack_int
#endif

/* f2c, hence clapack and MacOS Accelerate, returns double instead of float
Expand Down
18 changes: 15 additions & 3 deletions LAPACKE/include/lapacke_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,29 @@ extern "C" {

#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>

#ifndef lapack_int
#if defined(LAPACK_ILP64)
#define lapack_int int64_t
#define lapack_int int64_t
#else
#define lapack_int int32_t
#define lapack_int int32_t
#endif
#endif

/*
* Integer format string
*/
#ifndef LAPACK_IFMT
#if defined(LAPACK_ILP64)
#define LAPACK_IFMT PRId64
#else
#define LAPACK_IFMT PRId32
#endif
#endif

#ifndef lapack_logical
#define lapack_logical lapack_int
#define lapack_logical lapack_int
#endif

#ifndef LAPACK_COMPLEX_CUSTOM
Expand Down