NOAA-EMC / NCEPLIBS-bacio

This library performs binary I/O for the NCEP models.
Other
2 stars 6 forks source link

Lots and lots of preprocessor defines in bacio.c that are never set #55

Closed edwardhartnett closed 2 years ago

edwardhartnett commented 2 years ago

In bacio.c we have code like this:

#ifdef CRAY90
  #include <fortran.h>
  int BACIO
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes,
          _fcd fcd_fname, _fcd fcd_datary) {
  char *fname, *datary;
  int namelen;
#endif
#ifdef HP
  int bacio
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes, const char *fname, char *datary,
          int  namelen, int  datanamelen) {
#endif
#ifdef SGI
  int bacio_
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes, const char *fname, char *datary,
          int  namelen, int  datanamelen) {
#endif
#ifdef LINUX
  int bacio_
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes, const char *fname, char *datary,
          int  namelen, int  datanamelen) {
#endif
#ifdef LINUXF90
  int BACIO
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes, const char *fname, char *datary,
          int  namelen, int  datanamelen) {
#endif
#ifdef APPLE
  int bacio_
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes, const char *fname, char *datary,
          int  namelen, int  datanamelen) {
#endif
#ifdef VPP5000
  int bacio_
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes, const char *fname, char *datary,
          int  namelen, int  datanamelen) {
#endif
#ifdef IBM4
  int bacio
         (int * mode, int * start, int *newpos, int * size, int * no,
          int * nactual, int * fdes, const char *fname, char *datary,
          int  namelen, int  datanamelen) {
#endif
#ifdef IBM8
  long long int bacio
         (long long int * mode, long long int * start, long long int *newpos,
          long long int * size, long long int * no,
          long long int * nactual, long long int * fdes, const char *fname,
          char *datary,
          long long int  namelen, long long int  datanamelen) {
#endif

Yet in the build system we have:

add_compile_definitions(UNDERSCORE)
if(APPLE)
  add_compile_definitions(APPLE)
elseif(UNIX)
  add_compile_definitions(LINUX)
endif()

So it looks like LINUX and APPLE are the only two we are using. And they are the same, so we could just declare the function bacio_ without worrying about these preprocessor symbols.