-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enables binary+execution for ADA (#1971)
* enables binary+execution for ADA * generic bandaid for missing executables * -eS commands are not errors * support error annotations * restore original default but add exec example * re-enable rpath * add tools
- Loading branch information
Showing
5 changed files
with
125 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
with Ada.Command_Line; | ||
with Ada.Text_IO; | ||
|
||
function Example return Integer is | ||
|
||
function Square(num : Integer) return Integer is | ||
begin | ||
return num**2; | ||
end Square; | ||
|
||
function ReadCmdArgumentOrDefault(default: Integer) return Integer is | ||
begin | ||
if Ada.Command_Line.Argument_Count > 0 then | ||
return Integer'Value(Ada.Command_Line.Argument(1)); | ||
else | ||
return Default; | ||
end if; | ||
end ReadCmdArgumentOrDefault; | ||
|
||
NumberToSquare: Integer; | ||
Answer: Integer; | ||
begin | ||
NumberToSquare := ReadCmdArgumentOrDefault(4); | ||
Ada.Text_IO.Put_Line("Number to square: " & NumberToSquare'Image); | ||
|
||
Answer := Square(NumberToSquare); | ||
Ada.Text_IO.Put_Line("Square answer: " & Answer'Image); | ||
|
||
return Answer; | ||
end Example; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
-- This pragma will remove the warning produced by the default | ||
-- CE filename and the procedure name differing, | ||
-- see : https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gnat_rm/Pragma-Source_005fFile_005fName.html#Pragma-Source_005fFile_005fName | ||
pragma Source_File_Name (Square, Body_File_Name => "example.adb"); | ||
|
||
-- Type your code here, or load an example. | ||
function Square(num : Integer) return Integer is | ||
begin | ||
return num**2; | ||
end Square; | ||
|
||
-- Ada 2012 also provides Expression Functions | ||
-- (http://www.ada-auth.org/standards/12rm/html/RM-6-8.html) | ||
-- as a short hand for functions whose body consists of a | ||
-- single return statement. However they cannot be used as a | ||
-- complication unit. | ||
-- function Square(num : Integer) return Integer is (num**2); | ||
-- This pragma will remove the warning produced by the default | ||
-- CE filename and the procedure name differing, | ||
-- see : https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gnat_rm/Pragma-Source_005fFile_005fName.html#Pragma-Source_005fFile_005fName | ||
pragma Source_File_Name (Square, Body_File_Name => "example.adb"); | ||
|
||
-- Type your code here, or load an example. | ||
function Square(num : Integer) return Integer is | ||
begin | ||
return num**2; | ||
end Square; | ||
|
||
-- Ada 2012 also provides Expression Functions | ||
-- (http://www.ada-auth.org/standards/12rm/html/RM-6-8.html) | ||
-- as a short hand for functions whose body consists of a | ||
-- single return statement. However they cannot be used as a | ||
-- complication unit. | ||
-- function Square(num : Integer) return Integer is (num**2); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters