2008-08-05 15:26:24 +02:00
|
|
|
------------------------------------------------------------------------------
|
|
|
|
-- --
|
|
|
|
-- GNAT SYSTEM UTILITIES --
|
|
|
|
-- --
|
|
|
|
-- X O S C O N S --
|
|
|
|
-- --
|
|
|
|
-- B o d y --
|
|
|
|
-- --
|
2015-01-06 10:53:40 +01:00
|
|
|
-- Copyright (C) 2008-2014, Free Software Foundation, Inc. --
|
2008-08-05 15:26:24 +02:00
|
|
|
-- --
|
|
|
|
-- GNAT is free software; you can redistribute it and/or modify it under --
|
|
|
|
-- terms of the GNU General Public License as published by the Free Soft- --
|
|
|
|
-- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
|
|
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
|
|
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
|
|
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
|
|
|
|
-- for more details. You should have received a copy of the GNU General --
|
|
|
|
-- Public License distributed with GNAT; see file COPYING3. If not, go to --
|
|
|
|
-- http://www.gnu.org/licenses for a complete copy of the license. --
|
|
|
|
-- --
|
|
|
|
-- GNAT was originally developed by the GNAT team at New York University. --
|
|
|
|
-- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
|
|
-- --
|
|
|
|
------------------------------------------------------------------------------
|
|
|
|
|
2012-10-29 12:56:46 +01:00
|
|
|
-- The base name of the template file is given by Argument (1). This program
|
|
|
|
-- generates the spec for this specified unit (let's call it UNIT_NAME).
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
-- It works in conjunction with a C template file which must be pre-processed
|
|
|
|
-- and compiled using the cross compiler. Two input files are used:
|
2012-10-29 12:56:46 +01:00
|
|
|
-- - the preprocessed C file: UNIT_NAME-tmplt.i
|
|
|
|
-- - the generated assembly file: UNIT_NAME-tmplt.s
|
2008-08-05 15:26:24 +02:00
|
|
|
|
2012-10-29 12:56:46 +01:00
|
|
|
-- The generated files are UNIT_NAME.ads and UNIT_NAME.h
|
2008-08-05 15:26:24 +02:00
|
|
|
|
2012-11-06 11:03:08 +01:00
|
|
|
with Ada.Characters.Handling; use Ada.Characters.Handling;
|
|
|
|
with Ada.Command_Line; use Ada.Command_Line;
|
|
|
|
with Ada.Exceptions; use Ada.Exceptions;
|
|
|
|
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
|
|
|
|
with Ada.Strings.Fixed; use Ada.Strings.Fixed;
|
|
|
|
with Ada.Strings.Maps; use Ada.Strings.Maps;
|
|
|
|
with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants;
|
|
|
|
with Ada.Text_IO; use Ada.Text_IO;
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
pragma Warnings (Off);
|
|
|
|
-- System.Unsigned_Types is an internal GNAT unit
|
|
|
|
with System.Unsigned_Types; use System.Unsigned_Types;
|
|
|
|
pragma Warnings (On);
|
|
|
|
|
2015-01-06 10:53:40 +01:00
|
|
|
with GNAT.OS_Lib;
|
2012-11-06 11:03:08 +01:00
|
|
|
with GNAT.String_Split; use GNAT.String_Split;
|
2008-08-05 15:26:24 +02:00
|
|
|
with GNAT.Table;
|
|
|
|
|
2012-08-06 10:41:41 +02:00
|
|
|
with XUtil; use XUtil;
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
procedure XOSCons is
|
|
|
|
|
|
|
|
use Ada.Strings;
|
|
|
|
|
2012-10-29 12:56:46 +01:00
|
|
|
Unit_Name : constant String := Argument (1);
|
2008-08-05 15:26:24 +02:00
|
|
|
Tmpl_Name : constant String := Unit_Name & "-tmplt";
|
|
|
|
|
|
|
|
-------------------------------------------------
|
|
|
|
-- Information retrieved from assembly listing --
|
|
|
|
-------------------------------------------------
|
|
|
|
|
|
|
|
type String_Access is access all String;
|
|
|
|
-- Note: we can't use GNAT.Strings for this definition, since that unit
|
|
|
|
-- is not available in older base compilers.
|
|
|
|
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
-- We need to deal with integer values that can be signed or unsigned, so
|
Fix typos in gcc/ada.
gcc/ada/:
* projects.texi: Fix typos.
* gnat_rm.texi: Likewise.
* gnat_ugn.texi: Likewise.
* sem_util.adb: Fix typo in variable, typos in comments.
* a-btgbso.adb: Fix typos in comments.
* a-cbdlli.adb, a-cbhase.ads, a-cdlili.adb, a-cobove.adb,
a-coinve.adb, a-convec.adb, a-direct.ads, a-strunb-shared.adb,
a-strunb-shared.ads, a-stuten.ads, a-stwiun-shared.adb,
a-stwiun-shared.ads, a-stzunb-shared.adb, a-stzunb-shared.ads,
a-suenco.adb, a-suenst.adb, a-suewst.adb, a-suezst.adb, ali.ads,
aspects.ads, atree.ads, binde.adb, bindgen.adb, checks.adb,
checks.ads, einfo.ads, err_vars.ads, errout.adb, errout.ads,
exp_aggr.adb, exp_attr.adb, exp_cg.adb, exp_ch3.adb,
exp_ch4.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb,
exp_dbug.ads, exp_disp.adb, exp_fixd.ads, freeze.adb,
g-altive.ads, g-comlin.ads, g-excact.ads, g-mbdira.adb,
g-sechas.ads, g-sehash.ads, g-sha1.ads, g-sha224.ads,
g-sha256.ads, g-sha384.ads, g-sha512.ads, g-shsh32.ads,
g-shsh64.ads, g-socket.adb, g-socket.ads, g-sothco.ads,
gcc-interface/decl.c, gcc-interface/trans.c,
gcc-interface/utils2.c, gnat1drv.adb, init.c, inline.adb,
link.c, locales.c, make.adb, mingw32.h, namet.ads, osint.adb,
par-ch12.adb, par-ch13.adb, par-ch3.adb, par-ch4.adb,
par-prag.adb, par.adb, par_sco.adb, prepcomp.adb,
prj-conf.ads, prj-dect.adb, prj-env.adb, prj-env.ads,
prj-nmsc.adb, prj-tree.ads, prj-util.ads, prj.adb, prj.ads,
s-auxdec-vms-alpha.adb, s-auxdec-vms_64.ads, s-oscons-tmplt.c,
s-osinte-vxworks.ads, s-osprim-mingw.adb, s-regexp.adb,
s-stusta.adb, s-taprop-mingw.adb, s-taprop-solaris.adb,
scn.adb, scos.ads, sem.adb, sem_aggr.adb, sem_attr.adb,
sem_aux.adb, sem_aux.ads, sem_ch12.adb, sem_ch12.ads,
sem_ch13.adb, sem_ch13.ads, sem_ch3.adb, sem_ch4.adb,
sem_ch6.adb, sem_ch7.adb, sem_ch8.adb, sem_disp.adb,
sem_disp.ads, sem_eval.adb, sem_intr.adb, sem_prag.adb,
sem_res.adb, sem_scil.adb, sem_util.ads, sem_warn.adb,
sem_warn.ads, sinfo.ads, socket.c, styleg.adb, switch.ads,
sysdep.c, tb-alvxw.c, xoscons.adb: Likewise.
From-SVN: r168082
2010-12-20 08:26:57 +01:00
|
|
|
-- we need to accommodate the maximum range of both cases.
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
type Int_Value_Type is record
|
|
|
|
Positive : Boolean;
|
|
|
|
Abs_Value : Long_Unsigned := 0;
|
|
|
|
end record;
|
|
|
|
|
2012-11-06 11:03:08 +01:00
|
|
|
function ">" (V1, V2 : Int_Value_Type) return Boolean;
|
|
|
|
function "<" (V1, V2 : Int_Value_Type) return Boolean;
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
type Asm_Info_Kind is
|
2009-11-30 10:35:30 +01:00
|
|
|
(CND, -- Named number (decimal)
|
2012-08-06 10:35:47 +02:00
|
|
|
CNU, -- Named number (decimal, unsigned)
|
2009-11-30 10:35:30 +01:00
|
|
|
CNS, -- Named number (freeform text)
|
|
|
|
C, -- Constant object
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
SUB, -- Subtype
|
2008-08-05 15:26:24 +02:00
|
|
|
TXT); -- Literal text
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
-- Recognized markers found in assembly file. These markers are produced by
|
|
|
|
-- the same-named macros from the C template.
|
2008-08-05 15:26:24 +02:00
|
|
|
|
2012-08-06 10:35:47 +02:00
|
|
|
subtype Asm_Int_Kind is Asm_Info_Kind range CND .. CNU;
|
|
|
|
-- Asm_Info_Kind values with int values in input
|
|
|
|
|
2009-11-30 10:35:30 +01:00
|
|
|
subtype Named_Number is Asm_Info_Kind range CND .. CNS;
|
2012-08-06 10:35:47 +02:00
|
|
|
-- Asm_Info_Kind values with named numbers in output
|
2009-11-30 10:35:30 +01:00
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
type Asm_Info (Kind : Asm_Info_Kind := TXT) is record
|
|
|
|
Line_Number : Integer;
|
|
|
|
-- Line number in C source file
|
|
|
|
|
|
|
|
Constant_Name : String_Access;
|
|
|
|
-- Name of constant to be defined
|
|
|
|
|
2009-11-30 10:35:30 +01:00
|
|
|
Constant_Type : String_Access;
|
|
|
|
-- Type of constant (case of Kind = C)
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
Value_Len : Natural := 0;
|
|
|
|
-- Length of text representation of constant's value
|
|
|
|
|
|
|
|
Text_Value : String_Access;
|
2009-11-30 10:35:30 +01:00
|
|
|
-- Value for CNS / C constant
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
Int_Value : Int_Value_Type;
|
2012-08-06 10:35:47 +02:00
|
|
|
-- Value for CND / CNU constant
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
Comment : String_Access;
|
|
|
|
-- Additional descriptive comment for constant, or free-form text (TXT)
|
|
|
|
end record;
|
|
|
|
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
package Asm_Infos is new GNAT.Table
|
|
|
|
(Table_Component_Type => Asm_Info,
|
2008-08-05 15:26:24 +02:00
|
|
|
Table_Index_Type => Integer,
|
|
|
|
Table_Low_Bound => 1,
|
|
|
|
Table_Initial => 100,
|
|
|
|
Table_Increment => 10);
|
|
|
|
|
2009-11-30 10:35:30 +01:00
|
|
|
Max_Constant_Name_Len : Natural := 0;
|
2008-08-05 15:26:24 +02:00
|
|
|
Max_Constant_Value_Len : Natural := 0;
|
2009-11-30 10:35:30 +01:00
|
|
|
Max_Constant_Type_Len : Natural := 0;
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
-- Lengths of longest name and longest value
|
2008-08-05 15:26:24 +02:00
|
|
|
|
2012-08-06 10:35:47 +02:00
|
|
|
Size_Of_Unsigned_Int : Integer := 0;
|
|
|
|
-- Size of unsigned int on target
|
|
|
|
|
2009-04-20 14:17:42 +02:00
|
|
|
type Language is (Lang_Ada, Lang_C);
|
|
|
|
|
2012-11-06 11:03:08 +01:00
|
|
|
function Parse_Int (S : String; K : Asm_Int_Kind) return Int_Value_Type;
|
|
|
|
-- Parse a decimal number, preceded by an optional '$' or '#' character,
|
|
|
|
-- and return its value.
|
|
|
|
|
2009-04-20 14:17:42 +02:00
|
|
|
procedure Output_Info
|
|
|
|
(Lang : Language;
|
|
|
|
OFile : Sfile;
|
|
|
|
Info_Index : Integer);
|
2008-08-05 15:26:24 +02:00
|
|
|
-- Output information from the indicated asm info line
|
|
|
|
|
|
|
|
procedure Parse_Asm_Line (Line : String);
|
|
|
|
-- Parse one information line from the assembly source
|
|
|
|
|
|
|
|
function Contains_Template_Name (S : String) return Boolean;
|
|
|
|
-- True if S contains Tmpl_Name, possibly with different casing
|
|
|
|
|
|
|
|
function Spaces (Count : Integer) return String;
|
|
|
|
-- If Count is positive, return a string of Count spaces, else return an
|
|
|
|
-- empty string.
|
|
|
|
|
2012-11-06 11:03:08 +01:00
|
|
|
---------
|
|
|
|
-- ">" --
|
|
|
|
---------
|
|
|
|
|
|
|
|
function ">" (V1, V2 : Int_Value_Type) return Boolean is
|
|
|
|
P1 : Boolean renames V1.Positive;
|
|
|
|
P2 : Boolean renames V2.Positive;
|
|
|
|
A1 : Long_Unsigned renames V1.Abs_Value;
|
|
|
|
A2 : Long_Unsigned renames V2.Abs_Value;
|
|
|
|
begin
|
|
|
|
return (P1 and then not P2)
|
|
|
|
or else (P1 and then P2 and then A1 > A2)
|
|
|
|
or else (not P1 and then not P2 and then A1 < A2);
|
|
|
|
end ">";
|
|
|
|
|
|
|
|
---------
|
|
|
|
-- "<" --
|
|
|
|
---------
|
|
|
|
|
|
|
|
function "<" (V1, V2 : Int_Value_Type) return Boolean is
|
|
|
|
begin
|
|
|
|
return not (V1 > V2) and then not (V1 = V2);
|
|
|
|
end "<";
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
----------------------------
|
|
|
|
-- Contains_Template_Name --
|
|
|
|
----------------------------
|
|
|
|
|
|
|
|
function Contains_Template_Name (S : String) return Boolean is
|
|
|
|
begin
|
2009-04-20 14:17:42 +02:00
|
|
|
if Index (Source => To_Lower (S), Pattern => Tmpl_Name) > 0 then
|
|
|
|
return True;
|
|
|
|
else
|
|
|
|
return False;
|
|
|
|
end if;
|
2008-08-05 15:26:24 +02:00
|
|
|
end Contains_Template_Name;
|
|
|
|
|
|
|
|
-----------------
|
|
|
|
-- Output_Info --
|
|
|
|
-----------------
|
|
|
|
|
2009-04-20 14:17:42 +02:00
|
|
|
procedure Output_Info
|
|
|
|
(Lang : Language;
|
|
|
|
OFile : Sfile;
|
|
|
|
Info_Index : Integer)
|
|
|
|
is
|
2008-08-05 15:26:24 +02:00
|
|
|
Info : Asm_Info renames Asm_Infos.Table (Info_Index);
|
|
|
|
|
|
|
|
procedure Put (S : String);
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
-- Write S to OFile
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
---------
|
|
|
|
-- Put --
|
|
|
|
---------
|
|
|
|
|
|
|
|
procedure Put (S : String) is
|
|
|
|
begin
|
|
|
|
Put (OFile, S);
|
|
|
|
end Put;
|
|
|
|
|
2012-08-06 10:41:41 +02:00
|
|
|
-- Start of processing for Output_Info
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
begin
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
case Info.Kind is
|
|
|
|
when TXT =>
|
2009-04-20 14:17:42 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
-- Handled in the common code for comments below
|
2008-08-05 15:26:24 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
null;
|
2012-08-06 10:41:41 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
when SUB =>
|
|
|
|
case Lang is
|
|
|
|
when Lang_Ada =>
|
|
|
|
Put (" subtype " & Info.Constant_Name.all
|
|
|
|
& " is Interfaces.C."
|
|
|
|
& Info.Text_Value.all & ";");
|
|
|
|
when Lang_C =>
|
|
|
|
Put ("#define " & Info.Constant_Name.all & " "
|
|
|
|
& Info.Text_Value.all);
|
|
|
|
end case;
|
2012-08-06 10:35:47 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
when others =>
|
|
|
|
|
|
|
|
-- All named number cases
|
|
|
|
|
|
|
|
case Lang is
|
|
|
|
when Lang_Ada =>
|
|
|
|
Put (" " & Info.Constant_Name.all);
|
|
|
|
Put (Spaces (Max_Constant_Name_Len
|
|
|
|
- Info.Constant_Name'Length));
|
|
|
|
|
|
|
|
if Info.Kind in Named_Number then
|
|
|
|
Put (" : constant := ");
|
|
|
|
else
|
|
|
|
Put (" : constant " & Info.Constant_Type.all);
|
|
|
|
Put (Spaces (Max_Constant_Type_Len
|
|
|
|
- Info.Constant_Type'Length));
|
|
|
|
Put (" := ");
|
|
|
|
end if;
|
|
|
|
|
|
|
|
when Lang_C =>
|
|
|
|
Put ("#define " & Info.Constant_Name.all & " ");
|
|
|
|
Put (Spaces (Max_Constant_Name_Len
|
|
|
|
- Info.Constant_Name'Length));
|
|
|
|
end case;
|
|
|
|
|
|
|
|
if Info.Kind in Asm_Int_Kind then
|
|
|
|
if not Info.Int_Value.Positive then
|
|
|
|
Put ("-");
|
2009-11-30 10:35:30 +01:00
|
|
|
end if;
|
2012-08-06 10:41:41 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
Put (Trim (Info.Int_Value.Abs_Value'Img, Side => Left));
|
2012-08-06 10:41:41 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
else
|
|
|
|
declare
|
|
|
|
Is_String : constant Boolean :=
|
|
|
|
Info.Kind = C
|
|
|
|
and then Info.Constant_Type.all = "String";
|
2008-08-05 15:26:24 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
begin
|
|
|
|
if Is_String then
|
|
|
|
Put ("""");
|
|
|
|
end if;
|
2008-08-05 15:26:24 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
Put (Info.Text_Value.all);
|
|
|
|
|
|
|
|
if Is_String then
|
|
|
|
Put ("""");
|
|
|
|
end if;
|
|
|
|
end;
|
2009-04-20 14:17:42 +02:00
|
|
|
end if;
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
|
|
|
|
if Lang = Lang_Ada then
|
|
|
|
Put (";");
|
|
|
|
|
|
|
|
if Info.Comment'Length > 0 then
|
|
|
|
Put (Spaces (Max_Constant_Value_Len - Info.Value_Len));
|
|
|
|
Put (" -- ");
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
end case;
|
2008-08-05 15:26:24 +02:00
|
|
|
|
2009-04-20 14:17:42 +02:00
|
|
|
if Lang = Lang_Ada then
|
|
|
|
Put (Info.Comment.all);
|
|
|
|
end if;
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
New_Line (OFile);
|
|
|
|
end Output_Info;
|
|
|
|
|
|
|
|
--------------------
|
|
|
|
-- Parse_Asm_Line --
|
|
|
|
--------------------
|
|
|
|
|
|
|
|
procedure Parse_Asm_Line (Line : String) is
|
|
|
|
Index1, Index2 : Integer := Line'First;
|
|
|
|
|
|
|
|
function Field_Alloc return String_Access;
|
|
|
|
-- Allocate and return a copy of Line (Index1 .. Index2 - 1)
|
|
|
|
|
|
|
|
procedure Find_Colon (Index : in out Integer);
|
|
|
|
-- Increment Index until the next colon in Line
|
|
|
|
|
|
|
|
-----------------
|
|
|
|
-- Field_Alloc --
|
|
|
|
-----------------
|
|
|
|
|
|
|
|
function Field_Alloc return String_Access is
|
|
|
|
begin
|
|
|
|
return new String'(Line (Index1 .. Index2 - 1));
|
|
|
|
end Field_Alloc;
|
|
|
|
|
|
|
|
----------------
|
|
|
|
-- Find_Colon --
|
|
|
|
----------------
|
|
|
|
|
|
|
|
procedure Find_Colon (Index : in out Integer) is
|
|
|
|
begin
|
|
|
|
loop
|
|
|
|
Index := Index + 1;
|
|
|
|
exit when Index > Line'Last or else Line (Index) = ':';
|
|
|
|
end loop;
|
|
|
|
end Find_Colon;
|
|
|
|
|
|
|
|
-- Start of processing for Parse_Asm_Line
|
|
|
|
|
|
|
|
begin
|
|
|
|
Find_Colon (Index2);
|
|
|
|
|
|
|
|
declare
|
|
|
|
Info : Asm_Info (Kind => Asm_Info_Kind'Value
|
|
|
|
(Line (Line'First .. Index2 - 1)));
|
|
|
|
begin
|
|
|
|
Index1 := Index2 + 1;
|
|
|
|
Find_Colon (Index2);
|
|
|
|
|
|
|
|
Info.Line_Number :=
|
2012-08-06 10:35:47 +02:00
|
|
|
Integer (Parse_Int (Line (Index1 .. Index2 - 1), CNU).Abs_Value);
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
case Info.Kind is
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
when CND | CNU | CNS | C | SUB =>
|
2008-08-05 15:26:24 +02:00
|
|
|
Index1 := Index2 + 1;
|
|
|
|
Find_Colon (Index2);
|
|
|
|
|
|
|
|
Info.Constant_Name := Field_Alloc;
|
2012-08-06 10:41:41 +02:00
|
|
|
|
[multiple changes]
2012-10-29 Robert Dewar <dewar@adacore.com>
* gnat_rm.texi: Document that pragma Optimize_Alignment (Space) is
ignored with a warning for packed variable length records.
2012-10-29 Thomas Quinot <quinot@adacore.com>
* socket.c, g-socthi-dummy.adb, g-socthi-dummy.ads, g-socthi-vms.adb,
g-socthi-vms.ads, g-socthi-vxworks.adb, g-socthi-vxworks.ads,
s-oscons-tmplt.c, g-socthi-mingw.adb, g-socthi-mingw.ads, g-socthi.adb,
g-socthi.ads, xoscons.adb, g-socket.adb, g-sothco.ads: Introduce an
appropriate subtype for IOCTL requests, since these may be signed or
unsigned.
From-SVN: r192939
2012-10-29 12:41:01 +01:00
|
|
|
if Info.Kind /= SUB
|
|
|
|
and then
|
|
|
|
Info.Constant_Name'Length > Max_Constant_Name_Len
|
|
|
|
then
|
2009-11-30 10:35:30 +01:00
|
|
|
Max_Constant_Name_Len := Info.Constant_Name'Length;
|
2008-08-05 15:26:24 +02:00
|
|
|
end if;
|
|
|
|
|
|
|
|
Index1 := Index2 + 1;
|
|
|
|
Find_Colon (Index2);
|
|
|
|
|
2009-11-30 10:35:30 +01:00
|
|
|
if Info.Kind = C then
|
|
|
|
Info.Constant_Type := Field_Alloc;
|
2012-08-06 10:41:41 +02:00
|
|
|
|
2009-11-30 10:35:30 +01:00
|
|
|
if Info.Constant_Type'Length > Max_Constant_Type_Len then
|
|
|
|
Max_Constant_Type_Len := Info.Constant_Type'Length;
|
|
|
|
end if;
|
|
|
|
|
|
|
|
Index1 := Index2 + 1;
|
|
|
|
Find_Colon (Index2);
|
|
|
|
end if;
|
|
|
|
|
2012-08-06 10:35:47 +02:00
|
|
|
if Info.Kind = CND or else Info.Kind = CNU then
|
|
|
|
Info.Int_Value :=
|
|
|
|
Parse_Int (Line (Index1 .. Index2 - 1), Info.Kind);
|
|
|
|
Info.Value_Len := Info.Int_Value.Abs_Value'Img'Length - 1;
|
2012-08-06 10:41:41 +02:00
|
|
|
|
2012-08-06 10:35:47 +02:00
|
|
|
if not Info.Int_Value.Positive then
|
|
|
|
Info.Value_Len := Info.Value_Len + 1;
|
|
|
|
end if;
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
else
|
|
|
|
Info.Text_Value := Field_Alloc;
|
|
|
|
Info.Value_Len := Info.Text_Value'Length;
|
|
|
|
end if;
|
|
|
|
|
2012-10-01 10:49:03 +02:00
|
|
|
if Info.Constant_Name.all = "SIZEOF_unsigned_int" then
|
2012-08-06 10:35:47 +02:00
|
|
|
Size_Of_Unsigned_Int :=
|
|
|
|
8 * Integer (Info.Int_Value.Abs_Value);
|
|
|
|
end if;
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
when others =>
|
|
|
|
null;
|
|
|
|
end case;
|
|
|
|
|
|
|
|
Index1 := Index2 + 1;
|
|
|
|
Index2 := Line'Last + 1;
|
|
|
|
Info.Comment := Field_Alloc;
|
|
|
|
|
|
|
|
if Info.Kind = TXT then
|
|
|
|
Info.Text_Value := Info.Comment;
|
|
|
|
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
-- Update Max_Constant_Value_Len, but only if this constant has a
|
|
|
|
-- comment (else the value is allowed to be longer).
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
elsif Info.Comment'Length > 0 then
|
|
|
|
if Info.Value_Len > Max_Constant_Value_Len then
|
|
|
|
Max_Constant_Value_Len := Info.Value_Len;
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
|
|
|
|
Asm_Infos.Append (Info);
|
|
|
|
end;
|
2012-08-06 10:41:41 +02:00
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
exception
|
|
|
|
when E : others =>
|
2012-08-06 10:41:41 +02:00
|
|
|
Put_Line
|
|
|
|
(Standard_Error, "can't parse " & Line);
|
|
|
|
Put_Line
|
|
|
|
(Standard_Error, "exception raised: " & Exception_Information (E));
|
2008-08-05 15:26:24 +02:00
|
|
|
end Parse_Asm_Line;
|
|
|
|
|
2012-11-06 11:03:08 +01:00
|
|
|
----------------
|
|
|
|
-- Parse_Cond --
|
|
|
|
----------------
|
|
|
|
|
|
|
|
procedure Parse_Cond
|
|
|
|
(If_Line : String;
|
|
|
|
Cond : Boolean;
|
|
|
|
Tmpl_File : Ada.Text_IO.File_Type;
|
|
|
|
Ada_Ofile, C_Ofile : Sfile;
|
|
|
|
Current_Line : in out Integer)
|
|
|
|
is
|
|
|
|
function Get_Value (Name : String) return Int_Value_Type;
|
|
|
|
-- Returns the value of the variable Name
|
|
|
|
|
|
|
|
---------------
|
|
|
|
-- Get_Value --
|
|
|
|
---------------
|
|
|
|
|
|
|
|
function Get_Value (Name : String) return Int_Value_Type is
|
|
|
|
begin
|
|
|
|
if Is_Subset (To_Set (Name), Decimal_Digit_Set) then
|
|
|
|
return Parse_Int (Name, CND);
|
|
|
|
|
|
|
|
else
|
|
|
|
for K in 1 .. Asm_Infos.Last loop
|
|
|
|
if Asm_Infos.Table (K).Constant_Name /= null then
|
|
|
|
if Name = Asm_Infos.Table (K).Constant_Name.all then
|
|
|
|
return Asm_Infos.Table (K).Int_Value;
|
|
|
|
end if;
|
|
|
|
end if;
|
|
|
|
end loop;
|
|
|
|
|
|
|
|
-- Not found returns 0
|
2012-11-06 11:09:01 +01:00
|
|
|
|
2012-11-06 11:03:08 +01:00
|
|
|
return (True, 0);
|
|
|
|
end if;
|
|
|
|
end Get_Value;
|
|
|
|
|
2012-11-06 11:09:01 +01:00
|
|
|
-- Local variables
|
2012-11-06 11:03:08 +01:00
|
|
|
|
2012-11-06 11:09:01 +01:00
|
|
|
Sline : Slice_Set;
|
2012-11-06 11:03:08 +01:00
|
|
|
Line : String (1 .. 256);
|
|
|
|
Last : Integer;
|
|
|
|
Value1 : Int_Value_Type;
|
|
|
|
Value2 : Int_Value_Type;
|
|
|
|
Res : Boolean;
|
|
|
|
|
|
|
|
-- Start of processing for Parse_Cond
|
|
|
|
|
|
|
|
begin
|
|
|
|
Create (Sline, If_Line, " ");
|
|
|
|
|
|
|
|
if Slice_Count (Sline) /= 4 then
|
|
|
|
Put_Line (Standard_Error, "can't parse " & If_Line);
|
|
|
|
end if;
|
|
|
|
|
|
|
|
Value1 := Get_Value (Slice (Sline, 2));
|
|
|
|
Value2 := Get_Value (Slice (Sline, 4));
|
|
|
|
|
|
|
|
if Slice (Sline, 3) = ">" then
|
|
|
|
Res := Cond and (Value1 > Value2);
|
|
|
|
|
|
|
|
elsif Slice (Sline, 3) = "<" then
|
|
|
|
Res := Cond and (Value1 < Value2);
|
|
|
|
|
|
|
|
elsif Slice (Sline, 3) = "=" then
|
|
|
|
Res := Cond and (Value1 = Value2);
|
|
|
|
|
|
|
|
elsif Slice (Sline, 3) = "/=" then
|
|
|
|
Res := Cond and (Value1 /= Value2);
|
|
|
|
|
|
|
|
else
|
|
|
|
-- No other operator can be used
|
|
|
|
|
|
|
|
Put_Line (Standard_Error, "unknown operator in " & If_Line);
|
|
|
|
Res := False;
|
|
|
|
end if;
|
|
|
|
|
|
|
|
Current_Line := Current_Line + 1;
|
|
|
|
|
|
|
|
loop
|
|
|
|
Get_Line (Tmpl_File, Line, Last);
|
|
|
|
Current_Line := Current_Line + 1;
|
|
|
|
exit when Line (1 .. Last) = "@END_IF";
|
|
|
|
|
2013-04-23 11:47:13 +02:00
|
|
|
if Last > 4 and then Line (1 .. 4) = "@IF " then
|
2012-11-06 11:03:08 +01:00
|
|
|
Parse_Cond
|
|
|
|
(Line (1 .. Last), Res,
|
|
|
|
Tmpl_File, Ada_Ofile, C_Ofile, Current_Line);
|
|
|
|
|
|
|
|
elsif Line (1 .. Last) = "@ELSE" then
|
|
|
|
Res := Cond and not Res;
|
|
|
|
|
|
|
|
elsif Res then
|
|
|
|
Put_Line (Ada_OFile, Line (1 .. Last));
|
|
|
|
Put_Line (C_OFile, Line (1 .. Last));
|
|
|
|
end if;
|
|
|
|
end loop;
|
|
|
|
end Parse_Cond;
|
|
|
|
|
|
|
|
---------------
|
|
|
|
-- Parse_Int --
|
|
|
|
---------------
|
|
|
|
|
|
|
|
function Parse_Int
|
|
|
|
(S : String;
|
|
|
|
K : Asm_Int_Kind) return Int_Value_Type
|
|
|
|
is
|
|
|
|
First : Integer := S'First;
|
|
|
|
Result : Int_Value_Type;
|
|
|
|
|
|
|
|
begin
|
|
|
|
-- On some platforms, immediate integer values are prefixed with
|
|
|
|
-- a $ or # character in assembly output.
|
|
|
|
|
|
|
|
if S (First) = '$' or else S (First) = '#' then
|
|
|
|
First := First + 1;
|
|
|
|
end if;
|
|
|
|
|
|
|
|
if S (First) = '-' then
|
|
|
|
Result.Positive := False;
|
|
|
|
First := First + 1;
|
|
|
|
else
|
|
|
|
Result.Positive := True;
|
|
|
|
end if;
|
|
|
|
|
|
|
|
Result.Abs_Value := Long_Unsigned'Value (S (First .. S'Last));
|
|
|
|
|
|
|
|
if not Result.Positive and then K = CNU then
|
|
|
|
|
|
|
|
-- Negative value, but unsigned expected: take 2's complement
|
|
|
|
-- reciprocical value.
|
|
|
|
|
|
|
|
Result.Abs_Value := ((not Result.Abs_Value) + 1)
|
|
|
|
and
|
|
|
|
(Shift_Left (1, Size_Of_Unsigned_Int) - 1);
|
|
|
|
Result.Positive := True;
|
|
|
|
end if;
|
|
|
|
|
|
|
|
return Result;
|
|
|
|
|
|
|
|
exception
|
|
|
|
when others =>
|
|
|
|
Put_Line (Standard_Error, "can't parse decimal value: " & S);
|
|
|
|
raise;
|
|
|
|
end Parse_Int;
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
------------
|
|
|
|
-- Spaces --
|
|
|
|
------------
|
|
|
|
|
|
|
|
function Spaces (Count : Integer) return String is
|
|
|
|
begin
|
|
|
|
if Count <= 0 then
|
|
|
|
return "";
|
|
|
|
else
|
|
|
|
return (1 .. Count => ' ');
|
|
|
|
end if;
|
|
|
|
end Spaces;
|
|
|
|
|
|
|
|
-- Local declarations
|
|
|
|
|
2009-04-20 14:17:42 +02:00
|
|
|
-- Input files
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
Tmpl_File_Name : constant String := Tmpl_Name & ".i";
|
2009-04-20 14:17:42 +02:00
|
|
|
Asm_File_Name : constant String := Tmpl_Name & ".s";
|
|
|
|
|
|
|
|
-- Output files
|
|
|
|
|
2012-08-06 10:41:41 +02:00
|
|
|
Ada_File_Name : constant String := Unit_Name & ".ads";
|
|
|
|
C_File_Name : constant String := Unit_Name & ".h";
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
Asm_File : Ada.Text_IO.File_Type;
|
|
|
|
Tmpl_File : Ada.Text_IO.File_Type;
|
2009-04-20 14:17:42 +02:00
|
|
|
Ada_OFile : Sfile;
|
|
|
|
C_OFile : Sfile;
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
Line : String (1 .. 256);
|
|
|
|
Last : Integer;
|
|
|
|
-- Line being processed
|
|
|
|
|
|
|
|
Current_Line : Integer;
|
|
|
|
Current_Info : Integer;
|
|
|
|
In_Comment : Boolean;
|
|
|
|
In_Template : Boolean;
|
|
|
|
|
|
|
|
-- Start of processing for XOSCons
|
|
|
|
|
|
|
|
begin
|
|
|
|
-- Load values from assembly file
|
|
|
|
|
|
|
|
Open (Asm_File, In_File, Asm_File_Name);
|
|
|
|
while not End_Of_File (Asm_File) loop
|
|
|
|
Get_Line (Asm_File, Line, Last);
|
|
|
|
if Last > 2 and then Line (1 .. 2) = "->" then
|
|
|
|
Parse_Asm_Line (Line (3 .. Last));
|
|
|
|
end if;
|
|
|
|
end loop;
|
|
|
|
|
|
|
|
Close (Asm_File);
|
|
|
|
|
|
|
|
-- Load C template and output definitions
|
|
|
|
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
Open (Tmpl_File, In_File, Tmpl_File_Name);
|
2009-04-20 14:17:42 +02:00
|
|
|
Create (Ada_OFile, Out_File, Ada_File_Name);
|
|
|
|
Create (C_OFile, Out_File, C_File_Name);
|
2008-08-05 15:26:24 +02:00
|
|
|
|
|
|
|
Current_Line := 0;
|
|
|
|
Current_Info := Asm_Infos.First;
|
|
|
|
In_Comment := False;
|
|
|
|
|
|
|
|
while not End_Of_File (Tmpl_File) loop
|
|
|
|
<<Get_One_Line>>
|
|
|
|
Get_Line (Tmpl_File, Line, Last);
|
|
|
|
|
|
|
|
if Last >= 2 and then Line (1 .. 2) = "# " then
|
|
|
|
declare
|
2012-08-06 10:41:41 +02:00
|
|
|
Index : Integer;
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
begin
|
2012-08-06 10:41:41 +02:00
|
|
|
Index := 3;
|
2008-08-05 15:26:24 +02:00
|
|
|
while Index <= Last and then Line (Index) in '0' .. '9' loop
|
|
|
|
Index := Index + 1;
|
|
|
|
end loop;
|
|
|
|
|
|
|
|
if Contains_Template_Name (Line (Index + 1 .. Last)) then
|
|
|
|
Current_Line := Integer'Value (Line (3 .. Index - 1));
|
|
|
|
In_Template := True;
|
|
|
|
goto Get_One_Line;
|
|
|
|
else
|
|
|
|
In_Template := False;
|
|
|
|
end if;
|
|
|
|
end;
|
|
|
|
|
|
|
|
elsif In_Template then
|
|
|
|
if In_Comment then
|
|
|
|
if Line (1 .. Last) = "*/" then
|
2009-04-20 14:17:42 +02:00
|
|
|
Put_Line (C_OFile, Line (1 .. Last));
|
2008-08-05 15:26:24 +02:00
|
|
|
In_Comment := False;
|
2012-11-06 11:03:08 +01:00
|
|
|
|
|
|
|
elsif Last > 4 and then Line (1 .. 4) = "@IF " then
|
|
|
|
Parse_Cond
|
|
|
|
(Line (1 .. Last), True,
|
|
|
|
Tmpl_File, Ada_Ofile, C_Ofile, Current_Line);
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
else
|
2009-04-20 14:17:42 +02:00
|
|
|
Put_Line (Ada_OFile, Line (1 .. Last));
|
|
|
|
Put_Line (C_OFile, Line (1 .. Last));
|
2008-08-05 15:26:24 +02:00
|
|
|
end if;
|
|
|
|
|
|
|
|
elsif Line (1 .. Last) = "/*" then
|
2009-04-20 14:17:42 +02:00
|
|
|
Put_Line (C_OFile, Line (1 .. Last));
|
2008-08-05 15:26:24 +02:00
|
|
|
In_Comment := True;
|
|
|
|
|
|
|
|
elsif Asm_Infos.Table (Current_Info).Line_Number = Current_Line then
|
2012-11-06 11:03:08 +01:00
|
|
|
if Fixed.Index (Line, "/*NOGEN*/") = 0 then
|
|
|
|
Output_Info (Lang_Ada, Ada_OFile, Current_Info);
|
|
|
|
Output_Info (Lang_C, C_OFile, Current_Info);
|
|
|
|
end if;
|
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
Current_Info := Current_Info + 1;
|
|
|
|
end if;
|
[multiple changes]
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_ch8.adb (Analyze_Subprogram_Renaming): Improve error message on
box-defaulted operator in an instantiation, when the type of the
operands is not directly visible.
2009-04-29 Gary Dismukes <dismukes@adacore.com>
* sem_aggr.adb (Valid_Limited_Ancestor): Undo previous change.
(Resolve_Extension_Aggregate): Call Check_Parameterless_Call after the
analysis of the ancestor part. Remove prohibition against limited
interpretations of the ancestor expression in the case of Ada 2005.
Revise error message in overloaded case, adding a message to cover
the Ada 2005 case.
2009-04-29 Thomas Quinot <quinot@adacore.com>
* xoscons.adb: Minor reformatting
2009-04-29 Bob Duff <duff@adacore.com>
* sem_ch13.adb (Analyze_Attribute_Definition_Clause): Do not ignore
attribute_definition_clauses for the following attributes when the
-gnatI switch is used: External_Tag, Input, Output, Read, Storage_Pool,
Storage_Size, Write. Otherwise, we get spurious errors (for example,
missing Read attribute on remote types).
* gnat_ugn.texi: Document the change, and add a stern warning.
2009-04-29 Ed Schonberg <schonberg@adacore.com>
* sem_attr.adb (Check_Local_Access): Indicate that value tracing is
disabled not just for the current scope, but for the innermost dynamic
scope as well.
From-SVN: r146979
2009-04-29 17:36:48 +02:00
|
|
|
|
2008-08-05 15:26:24 +02:00
|
|
|
Current_Line := Current_Line + 1;
|
|
|
|
end if;
|
|
|
|
end loop;
|
|
|
|
|
|
|
|
Close (Tmpl_File);
|
|
|
|
|
2012-10-29 12:56:46 +01:00
|
|
|
exception
|
2015-01-06 10:53:40 +01:00
|
|
|
when E : others =>
|
|
|
|
Put_Line ("raised " & Ada.Exceptions.Exception_Information (E));
|
|
|
|
GNAT.OS_Lib.OS_Exit (1);
|
2008-08-05 15:26:24 +02:00
|
|
|
end XOSCons;
|