Skip to content

Commit

Permalink
Prioritize new gnatcheck over old prefixed ones
Browse files Browse the repository at this point in the history
If we have a new LAL-based gnatcheck that supports the '--target'
option in the PATH, we should prioritize it over older prefixed
versions of gnatcheck (e.g: powerpc-elf-gnatcheck).

We should still use the prefixed GNAT executable though to enable
checks for GNAT warnings.

For eng/ide/gnatstudio#37
  • Loading branch information
AnthonyLeonardoGracio committed May 10, 2023
1 parent 593f296 commit 1336797
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions share/support/core/gnatcheck.py
Expand Up @@ -128,23 +128,28 @@ def updateGnatCmd(self):
if target == "":
self.gnatCmd = "gnat"
self.checkCmd = "gnatcheck"
elif locate_exec_on_path('{}-gnatcheck'.format(target)):
self.gnatCmd = '{}-gnat'.format(target)
self.checkCmd = '{}-gnatcheck'.format(target)
else:
runtime = GPS.get_runtime()
self.gnatCmd = "gnat"
self.checkCmd = "gnatcheck"
self.gnatArgs = ["--target=%s" % target]

if runtime != "":
self.gnatArgs.append("--RTS=%s" % runtime)
# If a target is specified in the GPR project file, check if we have
# a non-prefixed gnatcheck in the PATH, which supports the '--target'
# option. Fallback to the old prefixed gnatcheck if not.
if locate_exec_on_path('gnatcheck') and \
'--target' in GPS.Process('gnatcheck --help').get_result():
runtime = GPS.get_runtime()
self.gnatCmd = '{}-gnat'.format(target)
self.checkCmd = "gnatcheck"
self.gnatArgs = ["--target=%s" % target]

if runtime != "":
self.gnatArgs.append("--RTS=%s" % runtime)
else:
self.gnatCmd = '{}-gnat'.format(target)
self.checkCmd = '{}-gnatcheck'.format(target)

if not locate_exec_on_path(self.checkCmd):
self.gnatCmd = ""
self.checkCmd = ""
GPS.Console("Messages").write(
"Error: 'gnatcheck' is not in the path.\n")
"Error: '%s' is not in the path.\n" % self.checkCmd)
GPS.Console("Messages").write(
"Error: Could not initialize the gnatcheck module.\n")
elif not locate_exec_on_path(self.gnatCmd):
Expand Down

0 comments on commit 1336797

Please sign in to comment.