Skip to content

Instantly share code, notes, and snippets.

@rtyler
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtyler/10197343 to your computer and use it in GitHub Desktop.
Save rtyler/10197343 to your computer and use it in GitHub Desktop.
[14:42:43] tyler:fosdem-ada $ ./precondition
burp
PING!
done
with Ada.Text_IO;
package body Fosdem is
function Is_Valid return Boolean is
begin
return False;
end Is_Valid;
procedure Ping is
begin
Ada.Text_IO.Put_Line ("PING!");
end Ping;
end Fosdem;
package Fosdem is
function Is_Valid return Boolean;
procedure Ping
with Pre => (Is_Valid = True);
end Fosdem;
project Fosdem is
for Source_Dirs use (".");
for Object_Dir use "obj";
for Main use ("precondition.adb");
package Compiler is
for Switches ("Ada") use ("-g", "-gnata", "-gnat2012");
end Compiler;
end Fosdem;
with Ada.Text_IO;
with Fosdem;
procedure Precondition is
use Ada.Text_IO;
begin
Put_Line ("burp");
Fosdem.Ping;
Put_Line("done");
end Precondition;
@sparre
Copy link

sparre commented Apr 9, 2014

You should include the "-fstack-check" and "-gnato" flags for the compiler to get proper Ada behaviour out of GNAT.

@sparre
Copy link

sparre commented Apr 9, 2014

With GNATMAKE GPL 2013 (20130314) your example works as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment