Commits

Jed Brown  committed 59c614d

Fix non-compliant C89

Test --with-64-bit-indices 'CFLAGS=-std=c89 -pedantic -Wno-long-long'

  • Participants
  • Parent commits 93bbec4

Comments (0)

Files changed (7)

File src/ksp/pc/impls/gamg/gamg.c

         }
         
         if( stokes ) {
-          IS is_row[2] = {kktMatsArr[level].prim_is,kktMatsArr[level].constr_is};
-          Mat a[4] = {Prol11, PETSC_NULL, PETSC_NULL, Prol22 };
+          IS is_row[2];
+          Mat a[4];
+          is_row[0] = kktMatsArr[level].prim_is;
+          is_row[1] = kktMatsArr[level].constr_is;
+          a[0] = Prol11;     a[1] = PETSC_NULL;
+          a[2] = PETSC_NULL; a[3] = Prol22;
           ierr = MatCreateNest(wcomm,2,is_row, 2, is_row, a, &Parr[level1] ); CHKERRQ(ierr);
         }
         else {

File src/ksp/pc/impls/gamg/tools.c

                   100.*(double)nnz1/(double)nnz0,vfilter,(double)nnz0/(double)nloc,MM);
     }
     else {
-      PetscInt nnz[2] = {nnz0,nnz1},out[2];
+      PetscInt nnz[2],out[2];
+      nnz[0] = nnz0;
+      nnz[1] = nnz1;
       ierr = MPI_Allreduce( nnz, out, 2, MPIU_INT, MPI_SUM, wcomm );  CHKERRQ(ierr);
       PetscPrintf(wcomm,"\t[%d]%s %g%% nnz after filtering, with threshold %g, %g nnz ave. (N=%d)\n",mype,__FUNCT__,
                   100.*(double)out[1]/(double)out[0],vfilter,(double)out[0]/(double)MM,MM);

File src/mat/impls/dense/seq/dense.c

   PetscErrorCode ierr;
   PetscScalar    *b,*x;
   PetscInt       n;
-  PetscBLASInt   nrhs,info,m=PetscBLASIntCast(A->rmap->n);
+  PetscBLASInt   nrhs,info,m;
   PetscBool      flg;
 
   PetscFunctionBegin;
+  m = PetscBLASIntCast(A->rmap->n);
   ierr = PetscObjectTypeCompareAny((PetscObject)B,&flg,MATSEQDENSE,MATMPIDENSE,PETSC_NULL);CHKERRQ(ierr);
   if (!flg) SETERRQ(((PetscObject)A)->comm,PETSC_ERR_ARG_WRONG,"Matrix B must be MATDENSE matrix");
   ierr = PetscObjectTypeCompareAny((PetscObject)X,&flg,MATSEQDENSE,MATMPIDENSE,PETSC_NULL);CHKERRQ(ierr);

File src/sys/error/err.c

     ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
     ierr = PetscViewerASCIISynchronizedAllow(viewer,PETSC_FALSE);CHKERRQ(ierr);
   } else if (isbinary) {
-    PetscMPIInt rank,size,*sizes,Ntotal,*displs, NN = PetscMPIIntCast(N);
+    PetscMPIInt rank,size,*sizes,Ntotal,*displs,NN;
     PetscInt    *array;
+
+    NN = PetscMPIIntCast(N);
     ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
     ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
 
     ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
     ierr = PetscViewerASCIISynchronizedAllow(viewer,PETSC_FALSE);CHKERRQ(ierr);
   } else if (isbinary) {
-    PetscMPIInt rank,size,*sizes,*displs, Ntotal,NN = PetscMPIIntCast(N);
+    PetscMPIInt rank,size,*sizes,*displs, Ntotal,NN;
     PetscReal   *array;
 
+    NN = PetscMPIIntCast(N);
     ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
     ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
 
     ierr = PetscViewerFlush(viewer);CHKERRQ(ierr);
     ierr = PetscViewerASCIISynchronizedAllow(viewer,PETSC_FALSE);CHKERRQ(ierr);
   } else if (isbinary) {
-    PetscMPIInt size,rank,*sizes,Ntotal,*displs,NN = PetscMPIIntCast(N);
+    PetscMPIInt size,rank,*sizes,Ntotal,*displs,NN;
     PetscScalar *array;
 
+    NN = PetscMPIIntCast(N);
     ierr = MPI_Comm_rank(comm,&rank);CHKERRQ(ierr);
     ierr = MPI_Comm_size(comm,&size);CHKERRQ(ierr);
 

File src/sys/fileio/mpiuopen.c

-
+#define PETSC_DESIRE_FEATURE_TEST_MACROS /* for popen */
 /*
       Some PETSc utilites routines to add simple parallel IO capability
 */

File src/sys/viewer/impls/binary/binv.c

   PetscViewer_Binary *vbinary = (PetscViewer_Binary*)viewer->data;
   PetscErrorCode     ierr;
   MPI_Datatype       mdtype;
-  PetscMPIInt        cnt = PetscMPIIntCast(count);
+  PetscMPIInt        cnt;
   MPI_Status         status;
   MPI_Aint           ul,dsize;
 
   PetscFunctionBegin;
+  cnt = PetscMPIIntCast(count);
   ierr = PetscDataTypeToMPIDataType(dtype,&mdtype);CHKERRQ(ierr);
   ierr = MPI_File_set_view(vbinary->mfdes,vbinary->moff,mdtype,mdtype,(char *)"native",MPI_INFO_NULL);CHKERRQ(ierr);
   if (write) {

File src/vec/vec/impls/seq/bvec1.c

 PetscErrorCode VecDot_Seq(Vec xin,Vec yin,PetscScalar *z)
 {
   const PetscScalar *ya,*xa;
-  PetscBLASInt      one = 1,bn = PetscBLASIntCast(xin->map->n);
+  PetscBLASInt      one = 1,bn;
   PetscErrorCode    ierr;
 
   PetscFunctionBegin;
+  bn = PetscBLASIntCast(xin->map->n);
   ierr = VecGetArrayRead(xin,&xa);CHKERRQ(ierr);
   ierr = VecGetArrayRead(yin,&ya);CHKERRQ(ierr);
   /* arguments ya, xa are reversed because BLAS complex conjugates the first argument, PETSc the second */
 PetscErrorCode VecTDot_Seq(Vec xin,Vec yin,PetscScalar *z)
 {
   const PetscScalar *ya,*xa;
-  PetscBLASInt      one = 1, bn = PetscBLASIntCast(xin->map->n);
+  PetscBLASInt      one = 1,bn;
   PetscErrorCode    ierr;
 
   PetscFunctionBegin;
+  bn = PetscBLASIntCast(xin->map->n);
   ierr = VecGetArrayRead(xin,&xa);CHKERRQ(ierr);
   ierr = VecGetArrayRead(yin,&ya);CHKERRQ(ierr);
   *z = BLASdotu_(&bn,xa,&one,ya,&one);