[petsc-dev] Fortran source format

Satish Balay balay at mcs.anl.gov
Mon Apr 19 14:15:32 CDT 2010


On Mon, 19 Apr 2010, Jed Brown wrote:

> On Mon, 19 Apr 2010 13:38:37 -0500 (CDT), Satish Balay <balay at mcs.anl.gov> wrote:
> > One way is attempt a compile using sample code with '&' in 73rd column
> > - and if a warning is obtained - try using -Wno-line-truncation. But
> > then this test should be done after -Wall flag is accepted..
> > 
> > A simpler code could be:
> > 
> > if isGfortran450(): add '-Wno-line-truncation'
> 
> This doesn't particularly offend me because I really think (hope) that
> this is a single-release bug that will be fixed in the next release (the
> Right Test could be created later if this ends up being incorrect).

The following patch appears to work - so I'll push to petsc31

satish

-----------

[petsc at petsc-mini BuildSystem]$ hg diff
diff -r 6e51c85213a3 config/compilerOptions.py
--- a/config/compilerOptions.py Mon Apr 05 00:44:44 2010 -0500
+++ b/config/compilerOptions.py Mon Apr 19 14:13:59 2010 -0500
@@ -178,6 +178,8 @@
     if config.setCompilers.Configure.isGNU(compiler):
       if bopt == '':
         flags.extend(['-Wall', '-Wno-unused-variable'])
+        if config.setCompilers.Configure.isGfortran450(compiler):
+          flags.extend(['-Wno-line-truncation'])
       elif bopt == 'g':
         if self.framework.argDB['with-gcov']:
           flags.extend(['-fprofile-arcs', '-ftest-coverage'])
diff -r 6e51c85213a3 config/setCompilers.py
--- a/config/setCompilers.py    Mon Apr 05 00:44:44 2010 -0500
+++ b/config/setCompilers.py    Mon Apr 19 14:13:59 2010 -0500
@@ -120,6 +120,19 @@
     return 0
   isGNU = staticmethod(isGNU)
 
+  def isGfortran450(compiler):
+    '''returns true if the compiler is gfortran450'''
+    try:
+      (output, error, status) = config.base.Configure.executeShellCommand(compiler+' --version')
+      output = output +  error
+      if output.find('GNU Fortran (GCC) 4.5.0') >=0:
+        return 1
+    except RuntimeError:
+      pass
+    return 0
+  isGfortran450 = staticmethod(isGfortran450)
+
+
   def isG95(compiler):
     '''Returns true if the compiler is g95'''
     try:
[petsc at petsc-mini BuildSystem]$



More information about the petsc-dev mailing list