Questions tagged [gnat]

the GNU Ada compiler that comes as part of GCC (the GNU Compiler Collection including the GNU C Compiler). This tag includes all the various versions of GNAT: • GNAT Community Edition as released by AdaCore under GPL, • FSF as available with gcc distributions under GPL with Runtime Library Exception, and • GNAT Pro under proprietary license from AdaCore.

When under development through a USA Department of Defense contract, GNAT was originally an acronym for The GNU NYU Ada 9X Translator. GNAT is a Ada-language front end in the GNU Compiler Collection (GCC) that adorns the GCC C/C++ GIMPL semantic tree with Ada semantics. This GIMPLE semantic tree is then fed into the Register Transfer Language (RTL) backend of GCC to produce assembly language and/or machine code. Modern GNAT also has an LLVM backend as well.

424 questions
6
votes
3 answers

Ada: package does not allow a body

Using the GNAT compiler, when I try to compile or check semantic on the following files, I get some variation of the error package "Foo" does not allow a body. I'm new to the language and can't find an answer to this seemingly basic problem anywhere…
weberc2
  • 7,423
  • 4
  • 41
  • 57
5
votes
1 answer

How integrate gnatmake/gnatbind/gnatlink in CMake files for C/Ada code?

I wrote a code in a few languages (C, C++, Fortran77, Fortran90) and I can compile it without any sort of problem by using CMake. It works out perfectly. Now, I would like to add in the main(), which is written in C, some Ada function and I want to…
Matteo
  • 51
  • 5
5
votes
1 answer

What should I do to solve the GNAT GPS "library not found" problem and build my first "Hello World" program on my Mac?

I downloaded the GNAT Community 2019 and have installed on my Mac in my home folder "/Users/leon/opt/GNAT" I run the command "gps" in the directory "/Users/leon/opt/GNAT/2019/bin". And GPS showed up, then I created a project, typed the "Hello World"…
Leon R. Wood
  • 193
  • 1
  • 6
5
votes
1 answer

Dynamic linking a library in Ada introduces extra dependencies

I am having trouble with dynamic and static linking a library in Ada. I have prepared a minimum working example. These three files define a library that outputs "Hello world": helloworld_lib.gpr: project Helloworld_Lib is for Library_Name use…
5
votes
1 answer

How can I specify functions or procedures GNATTest should auomatically generate a test case for

I'm working on a huge code package (written dominantly in ada), which is an extreme mess. No Unit Tests are applied so far and for all the existing code, Unit tests must not be implemented. But our Team decided, that all the new code should be…
5
votes
2 answers

Check initialization of variable

In the following code example the variable Time_Two is not initialized. This results into a random output like: Time one: 2019-06-27 16:18:21 Time two: 2150-01-02 16:01:18 Does Ada offers a function to check during runtime if a variable of the type…
Marcello90
  • 1,313
  • 4
  • 18
  • 33
5
votes
5 answers

Extracting record from big endian data

I have the following code for network protocol implementation. As the protocol is big endian, I wanted to use the Bit_Order attribute and High_Order_First value but it seems I made a mistake. With Ada.Unchecked_Conversion; with Ada.Text_IO; use…
Frédéric Praca
  • 1,620
  • 15
  • 29
5
votes
3 answers

GUI in Ada programming language

How to make/create a GUI (Graphical User Interface) in Ada programming language? It is possible? In Python, you can use tkinter to make a window form.
5
votes
1 answer

How do you add a second test for a function when using GNAT test?

The documentation for Gnat test shows how to generate a harness and skeleton unit tests. It creates one unit test for each public function in the target project, but if I add another this gets overwritten when I regenerate the harness and skeleton…
TamaMcGlinn
  • 2,840
  • 23
  • 34
5
votes
2 answers

Binding vs Linking in Ada

I wonder what is the fundamental difference between binding and linking when working with Ada code? I couldn't find a good explanation on google and this is why I ask the question. For the binding process what is the input and what is the…
user3523954
  • 307
  • 1
  • 2
  • 12
5
votes
1 answer

In only ISO standard Ada, how can Record Representation Clause + any other language feature(s) be portable to little-endian and big-endian processors?

Without utilizing the nonstandard‡ Scalar_Storage_Order clause in recent releases of GNAT, how can, say, the IPv4 header be portably represented via Record Representation Clause(s) in conjunction with any combination of any other language features,…
Andreas ZUERCHER
  • 862
  • 1
  • 7
  • 20
5
votes
1 answer

Ada compiler GNAT on Mac OS

I'm trying to compile ada using the terminal on my mac but I always get this error "error: invalid value 'ada' in '-x ada' " anyone knows how can I fix this?
Nor
  • 51
  • 1
  • 2
5
votes
3 answers

running Ada program in linux terminal

I use Linux mint. Installed gnat to work with Ada programs, using "sudo apt-get install gnat". created a simple hello world program: with Ada.Text_IO; procedure Hello is begin Ada.Text_IO.Put_Line("Hello, world!"); end Hello; and saved it as…
jithhtharan
  • 53
  • 1
  • 4
5
votes
1 answer

Ada CONSTRAINT_ERROR not being raised when it "should"

I've been looking through this Ada 95 tutorial. I was reading that it is possible to define a type that has a range that is different than the standard range, and if the program tries to go outside this range it will throw an error. While working on…
chew socks
  • 1,406
  • 2
  • 17
  • 37
5
votes
1 answer

Operation can be dispatching in only one type

I have a record and wanted some accessor function for it. package Some_Package is type A is tagged record First_Field :…
user1333261
1
2
3
28 29