Skip to content

Commit

Permalink
remove all warnings raised by gcc 8 and 9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
fangq committed Apr 2, 2020
1 parent d7becea commit c8884a4
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 50 deletions.
2 changes: 1 addition & 1 deletion commons/Makefile_common.mk
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ DLLFLAG=-fPIC
PLATFORM = $(shell uname -s)
ifeq ($(findstring MINGW64,$(PLATFORM)), MINGW64)
MW_MINGW64_LOC=/c/msys64/usr/
MKMEX :=cmd //c mex.bat -v
MKMEX :=cmd //c mex.bat
INCLUDEDIRS+=-I"./mingw64/include"
LIBOPENCL ="c:\Windows\System32\OpenCL.dll"
MKMEXOPT =-f mexopts_msys2_gcc.xml COMPFLAGS='$$COMPFLAGS $(CCFLAGS) $(USERCCFLAGS)' LDFLAGS='$$LDFLAGS -static $(OPENMPLIB) $(LIBOPENCL) $(MEXLINKOPT)' $(FASTMATH) -outdir ../mmclab
Expand Down
14 changes: 7 additions & 7 deletions src/mcx_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
** \section sref Reference:
** \li \c (\b Fang2010) Qianqian Fang, <a href="http://www.opticsinfobase.org/abstract.cfm?uri=boe-1-1-165">
** "Mesh-based Monte Carlo Method Using Fast Ray-Tracing
** in Plücker Coordinates,"</a> Biomed. Opt. Express, 1(1) 165-175 (2010).
** in Pl¨¹cker Coordinates,"</a> Biomed. Opt. Express, 1(1) 165-175 (2010).
** \li \c (\b Fang2012) Qianqian Fang and David R. Kaeli,
** <a href="https://www.osapublishing.org/boe/abstract.cfm?uri=boe-3-12-3223">
** "Accelerating mesh-based Monte Carlo method on modern CPU architectures,"</a>
Expand Down Expand Up @@ -438,7 +438,7 @@ void mcx_savenii(OutputType *dat, size_t len, char* name, int type32bit, int out
void mcx_savedata(OutputType *dat, size_t len, mcconfig *cfg,int isref){
FILE *fp;
char name[MAX_FULL_PATH];
char fname[MAX_FULL_PATH];
char fname[MAX_FULL_PATH+20];
unsigned int glformat=GL_RGBA32F;

if(cfg->rootpath[0])
Expand Down Expand Up @@ -573,7 +573,7 @@ void mcx_readconfig(char *fname, mcconfig *cfg){
}
fclose(fp);
if(cfg->session[0]=='\0'){
strncpy(cfg->session,fname,MAX_SESSION_LENGTH);
strncpy(cfg->session,fname,MAX_SESSION_LENGTH-1);
}
}
}
Expand Down Expand Up @@ -630,7 +630,7 @@ int mcx_loadjson(cJSON *root, mcconfig *cfg){
Forward = cJSON_GetObjectItem(root,"Forward");

if(Mesh){
strncpy(cfg->meshtag, FIND_JSON_KEY("MeshID","Mesh.MeshID",Mesh,(MMC_ERROR(-1,"You must specify mesh files"),""),valuestring), MAX_PATH_LENGTH);
strncpy(cfg->meshtag, FIND_JSON_KEY("MeshID","Mesh.MeshID",Mesh,(MMC_ERROR(-1,"You must specify mesh files"),""),valuestring), MAX_SESSION_LENGTH-1);
cfg->e0=FIND_JSON_KEY("InitElem","Mesh.InitElem",Mesh,(MMC_ERROR(-1,"InitElem must be given"),0.0),valueint);
if(!flagset['u'])
cfg->unitinmm=FIND_JSON_KEY("LengthUnit","Mesh.LengthUnit",Mesh,1.0,valuedouble);
Expand Down Expand Up @@ -711,7 +711,7 @@ int mcx_loadjson(cJSON *root, mcconfig *cfg){
}
}
if(Session){
char val[1];
char val[2]={'\0','\0'};
cJSON *ck;
if(!flagset['E']) cfg->seed=FIND_JSON_KEY("RNGSeed","Session.RNGSeed",Session,-1,valueint);
if(!flagset['n']) cfg->nphoton=FIND_JSON_KEY("Photons","Session.Photons",Session,0,valueint);
Expand Down Expand Up @@ -858,7 +858,7 @@ void mcx_loadconfig(FILE *in, mcconfig *cfg){
#else
sprintf(comment,"%s/%s",cfg->rootpath,cfg->meshtag);
#endif
strncpy(cfg->meshtag,comment,MAX_PATH_LENGTH);
memcpy(cfg->meshtag,comment,MAX_SESSION_LENGTH);
}
comm=fgets(comment,MAX_PATH_LENGTH,in);

Expand Down Expand Up @@ -1440,7 +1440,7 @@ void mcx_parsecmd(int argc, char* argv[], mcconfig *cfg){
i=mcx_readarg(argc,argv,i,&(cfg->optlevel),"int");
break;
case 'D':
if(i+1<argc && isalpha(argv[i+1][0]) )
if(i+1<argc && isalpha((int)argv[i+1][0]) )
cfg->debuglevel=mcx_parsedebugopt(argv[++i]);
else
i=mcx_readarg(argc,argv,i,&(cfg->debuglevel),"int");
Expand Down
4 changes: 2 additions & 2 deletions src/mcx_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

#define MAX_FULL_PATH 2048 /**< max characters in a full file name string */
#define MAX_PATH_LENGTH 1024 /**< max characters in a full file name string */
#define MAX_SESSION_LENGTH 256 /**< max session name length */
#define MAX_SESSION_LENGTH 64 /**< max session name length */
#define MAX_CHECKPOINT 16 /**< max number of photon save points */
#define DET_PHOTON_BUF 100000 /**< initialize number of detected photons */
#define SEED_FROM_FILE -999 /**< special flag indicating to load seeds from history file */
Expand Down Expand Up @@ -206,7 +206,7 @@ typedef struct MMC_config{
0 for wide-field detection pattern*/
unsigned char *vol; /**<pointer to the volume*/
char session[MAX_SESSION_LENGTH];/**<session id, a string*/
char meshtag[MAX_PATH_LENGTH]; /**<a string to tag all input mesh files*/
char meshtag[MAX_SESSION_LENGTH];/**<a string to tag all input mesh files*/
char isrowmajor; /**<1 for C-styled array in vol, 0 for matlab-styled array*/
char isreflect; /**<1 for reflecting photons at boundary,0 for exiting*/
char isref3; /**<1 considering maximum 3 ref. interfaces; 0 max 2 ref*/
Expand Down
2 changes: 0 additions & 2 deletions src/mmc_host.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ int mmc_run_mp(mcconfig *cfg, tetmesh *mesh, raytracer *tracer){

if((cfg->debuglevel & dlProgress) && threadid==0)
mcx_progressbar(ncomplete,cfg);
if(cfg->issave2pt && cfg->checkpt[0])
mesh_saveweightat(mesh,cfg,id+1);
}

for(j=0;j<cfg->srcnum;j++){
Expand Down
6 changes: 3 additions & 3 deletions src/mmclab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
** \section sref Reference:
** \li \c (\b Fang2010) Qianqian Fang, <a href="http://www.opticsinfobase.org/abstract.cfm?uri=boe-1-1-165">
** "Mesh-based Monte Carlo Method Using Fast Ray-Tracing
** in Plücker Coordinates,"</a> Biomed. Opt. Express, 1(1) 165-175 (2010).
** in Pl¨¹cker Coordinates,"</a> Biomed. Opt. Express, 1(1) 165-175 (2010).
** \li \c (\b Fang2012) Qianqian Fang and David R. Kaeli,
** <a href="https://www.osapublishing.org/boe/abstract.cfm?uri=boe-3-12-3223">
** "Accelerating mesh-based Monte Carlo method on modern CPU architectures,"</a>
Expand Down Expand Up @@ -447,7 +447,7 @@ void mmc_set_field(const mxArray *root,const mxArray *item,int idx, mcconfig *cf
mesh->elemlen=arraydim[1];
if(mesh->facenb) free(mesh->facenb);
mesh->facenb=(int *)malloc(sizeof(int)*arraydim[1]*mesh->ne);
for(j=0;j<arraydim[1];j++)
for(dimtype j=0;j<arraydim[1];j++)
for(i=0;i<mesh->ne;i++)
mesh->facenb[i*arraydim[1]+j]=val[j*mesh->ne+i];
printf("mmc.facenb=[%d,%d];\n",mesh->ne,mesh->elemlen);
Expand Down Expand Up @@ -643,7 +643,7 @@ void mmc_set_field(const mxArray *root,const mxArray *item,int idx, mcconfig *cf
arraydim=mxGetDimensions(item);
if(arraydim[0]*arraydim[1]>MAX_DEVICE)
mexErrMsgTxt("the workload list can not be longer than 256");
for(i=0;i<arraydim[0]*arraydim[1];i++)
for(dimtype i=0;i<arraydim[0]*arraydim[1];i++)
cfg->workload[i]=val[i];
printf("mmc.workload=<<%d>>;\n",arraydim[0]*arraydim[1]);
}else if(strcmp(name,"isreoriented")==0){
Expand Down
34 changes: 2 additions & 32 deletions src/simpmesh.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ void mesh_error(const char *msg,const char *file,const int linenum){
* @param[in] cfg: the simulation configuration structure
*/

void mesh_filenames(const char *format,char *foutput,mcconfig *cfg){
char filename[MAX_FULL_PATH];
void mesh_filenames(const char format[64],char *foutput,mcconfig *cfg){
char filename[MAX_PATH_LENGTH];
sprintf(filename,format,cfg->meshtag);

if(cfg->rootpath[0])
Expand Down Expand Up @@ -871,36 +871,6 @@ float mc_next_scatter(float g, float3 *dir,RandType *ran, RandType *ran0, mcconf
return nextslen;
}

/**
* @brief Save a snapshot of the simulation output
*
* save snapshot of the simulation output during a lengthy simulation
* the snapshots are specified by a set of "check-points", i.e. the index
* of the photons that being completed.
*
* @param[in] mesh: the mesh object
* @param[in] cfg: the simulation configuration
* @param[in] id: the index of the current photon
*/

void mesh_saveweightat(tetmesh *mesh,mcconfig *cfg,int id){
char sess[MAX_SESSION_LENGTH];
int i,found=0;
for(i=0;i<MAX_CHECKPOINT;i++){
if(cfg->checkpt[i]==0) return;
if(id==cfg->checkpt[i]) {
found=1;
break;
}
}
if(!found) return;
memcpy(sess,cfg->session,MAX_SESSION_LENGTH);
sprintf(cfg->session,"%s_%d",sess,id);
mesh_saveweight(mesh,cfg,0);
memcpy(cfg->session,sess,MAX_SESSION_LENGTH);
}


/**
* @brief Save the fluence output to a file
*
Expand Down
3 changes: 1 addition & 2 deletions src/simpmesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
** \section sref Reference:
** \li \c (\b Fang2010) Qianqian Fang, <a href="http://www.opticsinfobase.org/abstract.cfm?uri=boe-1-1-165">
** "Mesh-based Monte Carlo Method Using Fast Ray-Tracing
** in Plücker Coordinates,"</a> Biomed. Opt. Express, 1(1) 165-175 (2010).
** in Pl¨¹cker Coordinates,"</a> Biomed. Opt. Express, 1(1) 165-175 (2010).
** \li \c (\b Fang2012) Qianqian Fang and David R. Kaeli,
** <a href="https://www.osapublishing.org/boe/abstract.cfm?uri=boe-3-12-3223">
** "Accelerating mesh-based Monte Carlo method on modern CPU architectures,"</a>
Expand Down Expand Up @@ -140,7 +140,6 @@ float mesh_normalize(tetmesh *mesh, mcconfig *cfg, float Eabsorb, float Etotal,
void mesh_build(tetmesh *mesh);
void mesh_error(const char *msg, const char *file,const int linenum);
void mesh_filenames(const char *format,char *foutput,mcconfig *cfg);
void mesh_saveweightat(tetmesh *mesh,mcconfig *cfg,int id);
void mesh_saveweight(tetmesh *mesh,mcconfig *cfg,int isref);
void mesh_savedetphoton(float *ppath, void *seeds, int count, int seedbyte, mcconfig *cfg);
void mesh_getdetimage(float *detmap, float *ppath, int count, mcconfig *cfg, tetmesh *mesh);
Expand Down
2 changes: 1 addition & 1 deletion src/sse_math/sse_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ _PS_CONST_TYPE(min_norm_pos, int, 0x00800000);
_PS_CONST_TYPE(mant_mask, int, 0x7f800000);
_PS_CONST_TYPE(inv_mant_mask, int, ~0x7f800000);

_PS_CONST_TYPE(sign_mask, int, 0x80000000);
_PS_CONST_TYPE(sign_mask, unsigned int, 0x80000000);
_PS_CONST_TYPE(inv_sign_mask, int, ~0x80000000);

_PI32_CONST(1, 1);
Expand Down

0 comments on commit c8884a4

Please sign in to comment.