Skip to content

Commit

Permalink
r.sun: remove unused function 'cube'
Browse files Browse the repository at this point in the history
For now only comments out relevant parts.
Addresses -Wimplicit-int compiler warnings.
The warning is treated as an error by Clang 16+ and the compilation fails.

This is a partial, manual backport of #1405,
commit 594c947.
  • Loading branch information
nilason committed Jul 31, 2023
1 parent 0a236d9 commit 664581a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion raster/r.sun/local_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void setHorizonInterval(double val);
void setAngularLossDenominator();


void cube(int, int);
/* void cube(int, int); */

double com_sol_const(int no_of_day);

Expand Down
12 changes: 6 additions & 6 deletions raster/r.sun/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ int OUTGR(void);
int min(int, int);
int max(int, int);

void cube(int, int);
void (*func) (int, int);
/* void cube(int, int);
void (*func) (int, int); */

void joules2(struct SunGeometryConstDay *sunGeom,
struct SunGeometryVarDay *sunVarGeom,
Expand Down Expand Up @@ -1685,9 +1685,9 @@ void where_is_point(double *length, struct SunGeometryVarDay *sunVarGeom,
* }
*/

void cube(jmin, imin)
/* void cube(jmin, imin)
{
}
} */


/*////////////////////////////////////////////////////////////////////// */
Expand Down Expand Up @@ -1837,7 +1837,7 @@ void calculate(double singleSlope, double singleAspect, double singleAlbedo,
}
sunVarGeom.zmax = zmax;
shadowoffset_base = (j % (numRows)) * n * arrayNumInt;
#pragma omp parallel firstprivate(q1,tan_lam_l,z1,i,shadowoffset,longitTime,coslat,coslatsq,func,latitude,longitude,sin_phi_l,latid_l,sin_u,cos_u,sin_v,cos_v,lum,gridGeom,elevin,aspin,slopein,civiltime,linkein,albedo,latin,coefbh,coefdh,incidout,longin,horizon,beam_rad,insol_time,diff_rad,refl_rad,glob_rad,mapset,per,decimals,str_step)
#pragma omp parallel firstprivate(q1,tan_lam_l,z1,i,shadowoffset,longitTime,coslat,coslatsq,latitude,longitude,sin_phi_l,latid_l,sin_u,cos_u,sin_v,cos_v,lum,gridGeom,elevin,aspin,slopein,civiltime,linkein,albedo,latin,coefbh,coefdh,incidout,longin,horizon,beam_rad,insol_time,diff_rad,refl_rad,glob_rad,mapset,per,decimals,str_step)
{
#pragma omp for schedule(dynamic) \
firstprivate(sunGeom,sunVarGeom,sunSlopeGeom,sunRadVar) \
Expand All @@ -1862,7 +1862,7 @@ void calculate(double singleSlope, double singleAspect, double singleAlbedo,
coslatsq = coslat * coslat;
}

func = NULL;
/* func = NULL; */

sunVarGeom.z_orig = z1 = sunVarGeom.zp = z[arrayOffset][i];

Expand Down
2 changes: 1 addition & 1 deletion raster/r.sun/rsunglobals.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ extern struct pj_info iproj;
extern struct pj_info oproj;


extern void (*func) (int, int);
/* extern void (*func) (int, int); */
6 changes: 3 additions & 3 deletions raster/r.sun/rsunlib.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,11 +300,11 @@ int searching(double *length, struct SunGeometryVarDay *sunVarGeom,

if (succes == 1) {
where_is_point(length, sunVarGeom, gridGeom);
if (func == NULL) {
/*if (func == NULL) {
gridGeom->xx0 = gridGeom->xg0;
gridGeom->yy0 = gridGeom->yg0;
return (3);
}
}*/
curvature_diff = EARTHRADIUS * (1. - cos(*length / EARTHRADIUS));

z2 = sunVarGeom->z_orig + curvature_diff +
Expand Down Expand Up @@ -338,7 +338,7 @@ double lumcline2(struct SunGeometryConstDay *sungeom,
double timeoffset, horizPos;
double horizonHeight;

func = cube;
/* func = cube; */
sunVarGeom->isShadow = 0;

if (useShadow()) {
Expand Down

0 comments on commit 664581a

Please sign in to comment.