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
4
votes
4 answers

Ada program doesn't print any runtime errors

I'm developing a large project using the Ada language (around 10000 lines of only-code). During the use of the contract-base programming (Ada-2012 features like pre, post conditions, type invariants etc.) I find that when an Assertion or a condition…
4
votes
2 answers

Ada: gnat gprbuild How to link in libraries?

In this multi-language GPRBuild project I'm working on, I have some c++ library files (*.a) I need to link into my executable. Is there an gpr attribute to tell it what to link in or anyway to pass -l -L switches to the linker?
Daniel Ogburn
  • 551
  • 1
  • 6
  • 16
4
votes
3 answers

List of target architectures supported by GNAT?

I'd like to know which CPU architectures, espescially in the embedded sector, are supported by GNAT. Is every target supported by the gnu C compiler automatically also supported for Ada?
Kim Stebel
  • 41,826
  • 12
  • 125
  • 142
3
votes
1 answer

Using .net commands in Ada

I know, it's a noob question but..... I don't know :( I am using dotnet-gnat, I'm having trouble using the commands of the platform. Net in Ada ... I can use the WriteLine, but the ReadLine command, I can not .... How to know the correct way to use…
Alexandre
  • 1,985
  • 5
  • 30
  • 55
3
votes
1 answer

Is there a way to disable arithmetic operators on a specific type in Ada?

I would like to define HTML response status code numbers as a type but disallow arithmetic operators because it wouldn't make sense for them. type Status_Code is range 100 .. 599; function "+" (Left, Right : Status_Code) return Status_Code…
Guber
  • 89
  • 6
3
votes
0 answers

How do I get useful data from a UDP socket using GNAT.Sockets in Ada?

Summary: I am writing a server in Ada that should listen and reply to messages received over UDP. I am using the GNAT.Sockets library and have created a socket and bound it to a port. However, I am not sure how to listen for and receive messages on…
Mark Gardner
  • 442
  • 1
  • 6
  • 18
3
votes
0 answers

Purpose of Pragma Inline in specification files

Many subprogram declarations of GNAT Standard Library uses Pragma Inline in their specification files and I want to know how it work because other modules use only this specification during compilation and not body?
3
votes
1 answer

How to make GPR accept multiple sources in the same project having the same file name?

I set out to rewrite an OSS project in C piece by piece to Ada. First stop being to replace the build system with GPR. On doing so I stumbled upon a problem: it does not allow for multiple sources in the repository with the same name: duplicate…
Andreas
  • 5,086
  • 3
  • 16
  • 36
3
votes
1 answer

GNAT GPL Ada fails will linkage error when cross-compiling for the Raspberry pi

I am trying to build a simple "hello_there" Ada app to run on a Raspberry Pi 2/Raspbian machine but have come across a linkage issue. So far, I've done the following and had the following issues: Downloaded the "Raspberry Pi 2 Linux" GNAT GPL Ada…
Sidisyom
  • 163
  • 5
3
votes
2 answers

separate procedure in ada

I have a very big project, and I'm trying to start using GPS (Gnat Programming Studio) instead of what I have. The naming conventions of the proj are as following: something.1.ada for a spec something.2.ada for a body parents.son.2.ada for separate…
itay
  • 41
  • 3
3
votes
1 answer

Ada/SPARK: should I be using GNATprove? Where can I find it?

On chapter 22.1 of this Learning Ada, trying to build the examples. It expects GNATprove to be installed. I am using Ubuntu 18.04 LTS, and I don't see any package that provides it. When I tried to find the main repo, all I found was something at…
Jeff
  • 105
  • 7
3
votes
1 answer

Where is this Ada character literal format defined and what was changed in Ada 2005?

I've recently stumbled upon code similar to this, which compiled in Ada 95 mode and not in Ada 2005 mode: with Ada.Text_IO; procedure Test is Printable_Char : constant Character := '["20"]'; Non_printable_Char : constant Character :=…
Gneuromante
  • 560
  • 3
  • 12
3
votes
1 answer

Gpr file, do not include all directory in source

There is my project.gpr file : project Test is Project_Source_Dirs := ("Dir1") & ("src") & ("../../lib_all"); for Object_Dir is "lib"; for Main use ("Main_file.adb"); for Languages use ("Ada"); for Source_Dirs use…
A.Pissicat
  • 3,023
  • 4
  • 38
  • 93
3
votes
2 answers

Issue with freezing points in (Ada) SPARK

I have the following packages: ------------------- -- File: father.ads ------------------- package Father with SPARK_Mode => On is pragma Elaborate_Body; type Father_T is abstract tagged private; function Get_Field_1 (Self :…
F. Edwards
  • 31
  • 3
3
votes
1 answer

GNAT CE 2020 doesn't recognize -gnatt switch

see question in No GNATtest in GNAT Community Edition? On Windows 10, using GNAT CE 2020, when I build gnattest following the guidance in the ASIS package mentioned in the link, I still get an error when trying to generate a test harness (gnattest…
Rob
  • 31
  • 1