Changeset 2282


Ignore:
Timestamp:
01/07/22 16:09:50 (2 years ago)
Author:
jderouillat
Message:

Add missing return statements detected using -fsanitize=return. Return errors at runtime if reached.

Location:
XIOS/dev/dev_ym/XIOS_COUPLING
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • XIOS/dev/dev_ym/XIOS_COUPLING/extern/remap/src/polyg.cpp

    r1614 r2282  
    9898  else if (n == 2) return midpoint(x[0], x[1]); 
    9999  else if (n == 1) return x[0]; 
     100 
     101  error_exit( "Missing return in : Coord exact_barycentre(const Coord *x, int n)" ); 
     102  return ORIGIN; 
    100103} 
    101104 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/cxios.cpp

    r2274 r2282  
    310310    if (isClient) return CClient::getPoolRessource() ; 
    311311    else if (isServer) return CServer::getServersRessource()->getPoolRessource() ; 
     312     
     313    MISSING_RETURN( "CPoolRessource* CXios::getPoolRessource()" ); 
     314    return nullptr; 
    312315  } 
    313316} 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/distribution/server_distribution_description.cpp

    r1918 r2282  
    3939    default: 
    4040      break; 
    41   }  
     41  } 
     42 
     43  MISSING_RETURN( "int CServerDistributionDescription::defaultDistributedDimension(int gridDimension, ServerDistributionType serType)" ); 
     44  return -1; 
    4245} 
    4346 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/exception.hpp

    r1622 r2282  
    7575       xios::CException exc(id);                \ 
    7676       exc.getStream() << INFO(x);              \ 
     77       error << exc.getMessage() << std::endl;  \ 
     78       throw exc;                               \ 
     79} 
     80 
     81#define MISSING_RETURN(id)  \ 
     82{                     \ 
     83       xios::CException exc(id);                \ 
     84       exc.getStream() << INFO("Missing return");              \ 
    7785       error << exc.getMessage() << std::endl;  \ 
    7886       throw exc;                               \ 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/axis.hpp

    r2274 r2282  
    209209           if (hasDirectAxisReference()) if (!getDirectAxisReference()->isCompleted()) return false; 
    210210           else return isCompleted_ ; 
     211 
     212           MISSING_RETURN( "bool CAxis::isCompleted() " ); 
     213           return true; 
    211214         } 
    212215         void setCompleted(void) { isCompleted_=true ; } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/domain.hpp

    r2274 r2282  
    175175           if (hasDirectDomainReference()) if (!getDirectDomainReference()->isCompleted()) return false; 
    176176           else return isCompleted_ ; 
     177 
     178           MISSING_RETURN( "bool CDomain::isCompleted() " ); 
     179           return true; 
    177180         } 
    178181         void setCompleted(void) { isCompleted_=true ; } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/grid.cpp

    r2270 r2282  
    461461      }   
    462462    } 
     463 
     464    MISSING_RETURN( "CDomain* CGrid::getAssociatedDomain(const string& domainId, bool noError)" ); 
     465    return nullptr; 
    463466  }  
    464467 
     
    525528      }   
    526529    } 
     530 
     531    MISSING_RETURN( "CAxis* CGrid::getAssociatedAxis(const string& axisId, bool noError)" ); 
     532    return nullptr; 
    527533  }  
    528534 
     
    589595      }   
    590596    } 
     597 
     598    MISSING_RETURN( "CScalar* CGrid::getAssociatedScalar(const string& scalarId, bool noError)" ); 
     599    return nullptr; 
    591600  }  
    592601 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/node/scalar.hpp

    r2274 r2282  
    167167        if (hasDirectScalarReference()) if (!getDirectScalarReference()->isCompleted()) return false; 
    168168        else return isCompleted_ ; 
     169 
     170        MISSING_RETURN( "bool CAxis::isCompleted() " ); 
     171        return true; 
    169172      } 
    170173      void setCompleted(void) { isCompleted_=true ; } 
  • XIOS/dev/dev_ym/XIOS_COUPLING/src/transformation/axis_algorithm/axis_algorithm_interpolate_coordinate.cpp

    r2270 r2282  
    6969    } 
    7070    if (pos==1) return false ; 
     71 
     72    MISSING_RETURN( "bool CAxisAlgorithmInterpolateCoordinate::transformAuxField(int pos)" ); 
     73    return false; 
    7174  } 
    7275 
Note: See TracChangeset for help on using the changeset viewer.