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
16
votes
1 answer

Ada Function vs Procedure

Can anyone explain me the difference between the Ada "procedure" and "function"?
PeakGen
  • 21,894
  • 86
  • 261
  • 463
13
votes
2 answers

how to get Ada exception message when catching from C++ handler?

Using GNAT Ada and Gnu C++, I'm interfacing an Ada piece of code with a c++ wrapper and I'd like to catch Ada exceptions properly when running this (stupid) code: with ada.text_io; package body ada_throw is procedure ada_throw is begin …
Jean-François Fabre
  • 137,073
  • 23
  • 153
  • 219
10
votes
3 answers

Gnat for Mac Ada programming

I'm learning Ada 95 in my programming class, and I would like to install the gnat compiler on my MacBook. I have no clue as to where to get a good gnat to compile my code, and how to install it. I currently have gedit as my text editor, because…
Derpboom
  • 211
  • 2
  • 3
  • 6
10
votes
4 answers

Get Ada (compiled with GNAT) to import files from outside current directory?

I'm doing an intro to programming course at university, and the language of choice is Ada. I'm coding in Kate and compiling with GNAT 4.6.3. We have to use teacher-provided libraries for our programs, like so: with foo; use foo; Of course, then…
Jack M
  • 4,769
  • 6
  • 43
  • 67
9
votes
1 answer

Building GNATCOLL in an Alpine Linux Docker Container

I can't seem to get GNATCOLL to compile in an Alpine Linux based Docker Container. My container so far is: FROM alpine:edge # Add extra repositories RUN echo 'http://dl-cdn.alpinelinux.org/alpine/edge/testing' >> /etc/apk/repositories; \ echo…
LambdaBeta
  • 1,479
  • 1
  • 13
  • 25
8
votes
1 answer

How to create an ada lib.a and link to C

I am trying to create an ada library and have tried a few different things. I have tried compiling the project using makefiles and trying to create a library from all the .o files This seemed to not work as expected. I then asked adacore support…
crychair
  • 337
  • 3
  • 20
7
votes
2 answers

Ada suppress unreachable code or missing return

I have a tagged type that implements a number of functions. In one case I need one of these functions to instead enter an infinite loop. Unfortunately as far as I can tell there is no way for me to compile this such that it doesn't raise a warning.…
LambdaBeta
  • 1,479
  • 1
  • 13
  • 25
7
votes
2 answers

Setting the --create-missing-dirs option in a gprbuild file

It's useful to have a separate directory to store object files in. However, gprbuild will complain if the directory doesn't already exist. I use hg for version control, which doesn't allow you to track empty directories (AFAIK this is true of git as…
junius
  • 570
  • 3
  • 14
7
votes
1 answer

What is the difference between the Adacore Gnat version and the "standard" one

I am trying to understand the fundamental differences between the Gnat compiler that is delivered with the Adacore Libre version and the one that comes standard with the gcc say in a Linux distribution or MinGw. I assume the main difference may be…
Rick
  • 680
  • 1
  • 7
  • 20
6
votes
3 answers

Constraint_Error raised when using modular types not divisble by 8

I've encountered an issue where using modular types in Ada that are not divisible by the system's Storage_Unit ( as defined in the runtime's system.ads ) will raise a Constraint_Error at runtime when accessed. I originally encountered this issue…
ajxs
  • 3,347
  • 2
  • 18
  • 33
6
votes
1 answer

How do you implement Generic_Sorting in Ada for a vector?

I'm trying to do some basic translations of old C++ code from many moons ago to learn Ada, and I have been absolutely stumped on how to sort a vector using the built-in Generic_Sorting. I haven't been able to find any concrete examples of it in…
ZSwat
  • 85
  • 6
6
votes
1 answer

Same Base Package in Multiple Linked GPRBuild Projects

With GPRBuild, I have created a library project called Lib. All packages in Lib reside within the package Base, which I use as a base package: to have a base package Base. For instance, if I were to create package Apple in any library or application…
D. Ataro
  • 1,711
  • 17
  • 38
6
votes
2 answers

Command line for Ada version?

I am looking for a command line to check for the version of my Ada installation. Any help ?
Arkapravo
  • 4,084
  • 9
  • 37
  • 46
6
votes
1 answer

Comparing Tagged Types

In Java, one would use the instanceof in order to check if an object is of the same type (or class-wide type) as another object. For instance, if we have the class Peach and an object peach, it would through the following: if (peach instanceof…
D. Ataro
  • 1,711
  • 17
  • 38
6
votes
1 answer

Access to volatile register in Ada

I want to write a very simple driver to initialize, write to/read from some peripherals on a microcontroller, the same way I have done it in C. I am using as an example a GPIO peripheral to initialize, write and read. GPIOA : GPIO_Register with …
Elisabeth
  • 111
  • 6
1
2 3
28 29