12 Revize 67666b1acb ... 9b29185d2a

Autor SHA1 Zpráva Datum
  Yifeng Li 9b29185d2a Makefile: enable LTO. před 1 rokem
  Yifeng Li 78f993dcc9 nmmtl_shape.cpp: remove deprecated "register" keyword. před 1 rokem
  Yifeng Li 2d017f4b38 nmmtl_genel.cpp: remove deprecated "register" keyword. před 1 rokem
  Yifeng Li 33c775a530 nmmtl_output_headers.cpp: mark userName as const. před 1 rokem
  Yifeng Li 5fa5a4889c units.cpp: fix deletion of uninitialized pointer. před 1 rokem
  Yifeng Li c559a7f392 nmmtl_retrieve.cpp: fix incorrect format string. před 1 rokem
  Yifeng Li 8845e1a5f7 nmmtl_parse_xsctn.cpp: fix incorrect printf argument. před 1 rokem
  Yifeng Li e7f1663c3d nmmtl.cpp: fix missing argument in printf. před 1 rokem
  Yifeng Li 69cb9d49bb nmmtl.cpp: fix incorrect format string. před 1 rokem
  Yifeng Li abcc383295 math_library.cpp: fix incorrect format strings. před 1 rokem
  Yifeng Li 17040cddc9 nmmtl_spout_off.cpp: fix incorrect format strings. před 1 rokem
  Yifeng Li 45c4c3adf0 Makefile: enable most -Wall and -Wextra warnings. před 1 rokem

+ 4 - 2
bem/build-wasm/build-cpp/Makefile

@@ -1,7 +1,9 @@
 CXX=em++
 
+CUSTOM_CXXFLAGS = -std=c++11 -O3 -flto -Wall -Wextra -Wno-unused-variable -Wno-unused-parameter -Wno-unused-but-set-variable -Wno-unused-function
+
 # list of CXXFLAGS extracted from autotools output
-CXXFLAGS=$(shell echo '-std=c++11 -O3 -DPACKAGE_NAME=\"BEM\" -DPACKAGE_TARNAME=\"bem\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"BEM\ 1.0\" -DPACKAGE_BUGREPORT=\"zahn.sharon@mayo.edu\" -DPACKAGE_URL=\"\" -DPACKAGE=\"bem\" -DVERSION=\"1.0\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_FLOAT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PWD_H=1 -DF77_FUNC\(name,NAME\)=name\ ##\ _ -DF77_FUNC_\(name,NAME\)=name\ ##\ _ -DGETGROUPS_T=gid_t -DHAVE_GETGROUPS=1 -DHAVE_MALLOC=1 -DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 -DHAVE_STRFTIME=1 -DHAVE_VPRINTF=1 -DHAVE_GETCWD=1 -DHAVE_GETLOGIN=1 -DHAVE_RMDIR=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRRCHR=1 -DHAVE_STRSTR=1 -I.    -DFORTRAN_UNDERBARS')
+CXXFLAGS=$(CUSTOM_CXXFLAGS) $(shell echo '-DPACKAGE_NAME=\"BEM\" -DPACKAGE_TARNAME=\"bem\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"BEM\ 1.0\" -DPACKAGE_BUGREPORT=\"zahn.sharon@mayo.edu\" -DPACKAGE_URL=\"\" -DPACKAGE=\"bem\" -DVERSION=\"1.0\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_FCNTL_H=1 -DHAVE_FLOAT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_MALLOC_H=1 -DHAVE_STDDEF_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_UNISTD_H=1 -DHAVE_PWD_H=1 -DF77_FUNC\(name,NAME\)=name\ ##\ _ -DF77_FUNC_\(name,NAME\)=name\ ##\ _ -DGETGROUPS_T=gid_t -DHAVE_GETGROUPS=1 -DHAVE_MALLOC=1 -DLSTAT_FOLLOWS_SLASHED_SYMLINK=1 -DHAVE_STRFTIME=1 -DHAVE_VPRINTF=1 -DHAVE_GETCWD=1 -DHAVE_GETLOGIN=1 -DHAVE_RMDIR=1 -DHAVE_STRCHR=1 -DHAVE_STRDUP=1 -DHAVE_STRRCHR=1 -DHAVE_STRSTR=1 -I.    -DFORTRAN_UNDERBARS')
 
 SRC_DIR ?= ../../src
 
@@ -33,7 +35,7 @@ SRC_DIR ?= ../../src
 .cpp_obj = $(.cpp_src_noprefix:.cpp=.o)
 
 bem.js: $(.cpp_obj)
-	$(CXX) $(.cpp_obj) nswc.a -o bem.js -sEXPORTED_RUNTIME_METHODS=callMain,FS
+	$(CXX) $(CXXFLAGS) $(.cpp_obj) nswc.a -o bem.js -sEXPORTED_RUNTIME_METHODS=callMain,FS
 
 %.o: $(SRC_DIR)/%.cpp
 	$(CXX) -c $(CXXFLAGS) $(SRC_DIR)/$*.cpp -o $*.o

+ 12 - 12
bem/src/math_library.cpp

@@ -155,7 +155,7 @@ void c_fft(int *n,COMPLEX *a,COMPLEX *c,int *status)
    if (ierr != 0)
      {
        (*status) = FAIL;
-       fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %ld.\n",ierr);
+       fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %d.\n",ierr);
        return;
      }
    (*status) = SUCCESS;
@@ -225,7 +225,7 @@ void c_fft_inv(int *n,COMPLEX *a,COMPLEX *c,int *status)
   if (ierr != 0)
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %ld.\n",ierr);
+      fprintf(stderr,"ELECTRO-F-FFTINT Fast Fourier Transform Faileds with code %d.\n",ierr);
       return;
     }
   (*status) = SUCCESS;
@@ -447,7 +447,7 @@ void c_init_calc_eigenvalues(int *status)
 //    if (ierr != 0)
 //      {
 //        (*status) = FAIL;
-//        fprintf(stderr,"ELECTRO-F-EIGENINT Error on computing eigenvalues, NSWC code %ld\n",ierr);
+//        fprintf(stderr,"ELECTRO-F-EIGENINT Error on computing eigenvalues, NSWC code %d\n",ierr);
 //        return;
 //      }
 
@@ -768,7 +768,7 @@ void c_invert_matrix(int *n,COMPLEX *a,COMPLEX *b,
   if (ierr != 0) 
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
     }
 
@@ -962,7 +962,7 @@ void invert_matrix(int *n,float *a,float *b,
   if (ierr != 0) 
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
     }
 
@@ -1049,7 +1049,7 @@ void invert_matrix_cond(int *n,float *a,float *b,
   if (ierr != 0) 
     {
       (*status) = FAIL ;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
     }
 
@@ -1246,7 +1246,7 @@ void d_invert_matrix(int *n,double *a,double *b,
   if (ierr != 0) 
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-INVRSINT Error in matrix inversion, NSWC code %d\n",ierr);
       return;
     }
 
@@ -1408,7 +1408,7 @@ void c_solve_linear(int *n, COMPLEX *a, COMPLEX *b,
   if (ierr != 0) 
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %ld\n",ierr);
+      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %d\n",ierr);
       return;
     }
 
@@ -1623,7 +1623,7 @@ void d_c_solve_linear(int *n,DOUBLE_COMPLEX *a,DOUBLE_COMPLEX *b,
   if (ierr != 0) 
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %ld",ierr);
+      fprintf(stderr,"ELECTRO-F-LININT Error in solution of linear system, NSWC code %d",ierr);
       return;
     }
 
@@ -1865,7 +1865,7 @@ void d_c_solve_linear(int *n,DOUBLE_COMPLEX *a,DOUBLE_COMPLEX *b,
 // 
 // 	{
 // 	  (*status) = FAIL;
-//	  fprintf(stderr,"ELECTRO-F-NONLININT Error in solution of nonlinear system, NSWC code %ld\n",info);
+//	  fprintf(stderr,"ELECTRO-F-NONLININT Error in solution of nonlinear system, NSWC code %d\n",info);
 // 	  return;
 // 	}
 //     }
@@ -1941,7 +1941,7 @@ void lu_factor(int *n, float *a, float *lu, int *lda,
     if (info != 0)   
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %ld\n",info);
+      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %d\n",info);
       return;
     }
 
@@ -2103,7 +2103,7 @@ void dlu_factor(int *n, double *a, double *lu, int *lda,
     if (info != 0)   
     {
       (*status) = FAIL;
-      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %ld\n",status);
+      fprintf(stderr,"ELECTRO-F-LUFACT Error in LU factorization of matrix, NSWC code %d\n",*status);
       return;
     }
 

+ 2 - 2
bem/src/nmmtl.cpp

@@ -315,7 +315,7 @@ int main (int argc, char **argv)
 	    filename, cntr_seg, pln_seg, coupling);
     printf ("risetime: %g  conductivity: %g  frequency: %g\n",
 	    risetime, conductivity, frequency);
-    printf ("half_min_dim: %g  grnd_planes: %d  top_grnd_thck: %d\n",
+    printf ("half_min_dim: %g  grnd_planes: %d  top_grnd_thck: %f\n",
 	    half_minimum_dimension, gnd_planes, top_ground_plane_thickness);
     printf ("bot_grnd_thck: %g  num_sig: %d  num_grounds: %d\n",
 	    bottom_ground_plane_thickness, num_signals, num_grounds);
@@ -357,7 +357,7 @@ int main (int argc, char **argv)
     sprintf (filespec, "%s.result", filename); 
     if( (output_file1 = fopen(filespec,"w")) == NULL )
     {
-      printf ("*** Could not open %s for output ***\n");
+      printf ("*** Could not open %s for output ***\n", filespec);
       return 0;  /* Fatal error; could not open output file */
     }
     

+ 1 - 1
bem/src/nmmtl_genel.cpp

@@ -137,7 +137,7 @@ int nmmtl_generate_elements(int conductor_counter,
   CIRCLE_SEGMENTS_P ccs;
   CELEMENTS_P head,tail,gnd_list,gnd_list_head = NULL;
   CELEMENTS_P gnd_plane_list_head = NULL;  
-  register unsigned int node_point_counter_start;
+  unsigned int node_point_counter_start;
   int number_elements = 0;  
   char infostring[256];
   

+ 2 - 2
bem/src/nmmtl_output_headers.cpp

@@ -75,7 +75,7 @@
 */
 #ifndef HAVE_GETLOGIN
 #include <stdlib.h>
-char *getlogin() {
+const char *getlogin() {
   char *name ;
   name = getenv("USERNAME");
   if ( name == NULL ) {
@@ -131,7 +131,7 @@ void nmmtl_output_headers(FILE *output_file,
   time_t tm ;
 
   struct passwd *user_entry;
-  char *userName;
+  const char *userName;
   static char nullString[] = "";
 
   // look up the user name 

+ 1 - 1
bem/src/nmmtl_parse_xsctn.cpp

@@ -395,7 +395,7 @@ int nmmtl_parse_graphic(char *filename,
 	      /* count ground planes */
 	      printf ("**************************************************************\n");
 	      printf ("* Warning: There are %d groundplanes in the design...reset to 2\n",
-		      gnd_planes);
+		      *gnd_planes);
 	      printf ("***************************************************************\n");
 	      *gnd_planes = 2;	/* keep it at 2 */
 	    } 

+ 2 - 2
bem/src/nmmtl_retrieve.cpp

@@ -233,7 +233,7 @@ int nmmtl_retrieve(FILE *retrieve_file,
       }
       for(i = 0; i < 3; i++)
       {
-	if(fscanf(retrieve_file,"%d %f %f\n",&ce->node[i],
+	if(fscanf(retrieve_file,"%d %lf %lf\n",&ce->node[i],
 		  &ce->xpts[i],&ce->ypts[i]) != 3) return(FAIL);
 	
       }
@@ -264,7 +264,7 @@ int nmmtl_retrieve(FILE *retrieve_file,
     
     for(i = 0; i < 3; i++)
     {
-      fscanf(retrieve_file,"%d %f %f\n",&die_elements->node[i],
+      fscanf(retrieve_file,"%d %lf %lf\n",&die_elements->node[i],
 	     &die_elements->xpts[i],&die_elements->ypts[i]);
     }
     if(fgets(line,255,retrieve_file) == NULL) return(FAIL);

+ 5 - 5
bem/src/nmmtl_shape.cpp

@@ -112,10 +112,10 @@ COMPILATION ERROR ERROR ---      INTERP_PTS != 3       --- ERROR ERROR
 			  float nu0,
 			  float nu1)
 {
-  register int i;
-  register double X,Y; /* interpolated points */
-  register double numerator,denominator;
-  register double deltax,deltay,factor;
+  int i;
+  double X,Y; /* interpolated points */
+  double numerator,denominator;
+  double deltax,deltay,factor;
   
   
   /* first get the ordinary shape function */
@@ -415,7 +415,7 @@ void nmmtl_shape(double point,
 		 double *shape)
 {
   
-	register double L1,L2;
+	double L1,L2;
   
   
   /* shortcuts for the L1 and L2 used in Lagrangian polynomials evaluated at

+ 2 - 2
bem/src/nmmtl_spout_off.cpp

@@ -66,8 +66,8 @@ void nmmtl_spout_off(float the_conductivity,
   minfreq = (long) (minimumFrequency/1e6 + 1.0) ;
   printf ("%ld MHz is the minimum frequency for the surface current assumptions for this cross section\n", minfreq);
   if(output_file1 != NULL)
-    fprintf(output_file1,"Note: minimum frequency for surface current assumptions is %d MHz.", minfreq);
+    fprintf(output_file1,"Note: minimum frequency for surface current assumptions is %ld MHz.", minfreq);
   if(output_file2 != NULL)
-    fprintf(output_file2,"Note: minimum frequency for surface current assumptions is %d MHz.", minfreq);
+    fprintf(output_file2,"Note: minimum frequency for surface current assumptions is %ld MHz.", minfreq);
 }
 

+ 0 - 0
bem/src/units.cpp


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů