* sem_ch6.adb: Minor reformatting.
2010-06-23 Doug Rupp <rupp@adacore.com>
* bindusg.adb (Display): Write -Hnn line.
* bindgen.adb (Gen_Adainit_Ada): Write Heap_Size to binder file as
necessary.
* init.c (__gl_heap_size): Rename from __gl_no_malloc_64 and change
valid values to 32 and 64.
(GNAT$NO_MALLOC_64): Recognize TRUE, 1, FALSE, and 0 in addition to
ENABLE, DISABLE as valid settings.
* switch-b.adb (Scan_Binder_Switches): Process -Hnn switch.
* opt.ads (Heap_Size): New global variable.
* gcc-interface/utils2.c (maybe_wrap_malloc): Remove mostly redundant
TARGET_MALLOC64 check. Fix comment.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161243
138bc75d-0d04-0410-961f-
82ee72b054a4
2010-06-23 Robert Dewar <dewar@adacore.com>
+ * sem_ch6.adb: Minor reformatting.
+
+2010-06-23 Doug Rupp <rupp@adacore.com>
+
+ * bindusg.adb (Display): Write -Hnn line.
+ * bindgen.adb (Gen_Adainit_Ada): Write Heap_Size to binder file as
+ necessary.
+ * init.c (__gl_heap_size): Rename from __gl_no_malloc_64 and change
+ valid values to 32 and 64.
+ (GNAT$NO_MALLOC_64): Recognize TRUE, 1, FALSE, and 0 in addition to
+ ENABLE, DISABLE as valid settings.
+ * switch-b.adb (Scan_Binder_Switches): Process -Hnn switch.
+ * opt.ads (Heap_Size): New global variable.
+ * gcc-interface/utils2.c (maybe_wrap_malloc): Remove mostly redundant
+ TARGET_MALLOC64 check. Fix comment.
+
+2010-06-23 Robert Dewar <dewar@adacore.com>
+
* sem_ch6.adb, exp_ch4.adb, s-rannum.ads, sem.adb, sem_ch12.adb: Minor
reformatting. Add comments.
* errout.adb (Finalize): Properly adjust warning count when deleting
-- Main_Priority : Integer;
-- Time_Slice_Value : Integer;
+ -- Heap_Size : Natural;
-- WC_Encoding : Character;
-- Locking_Policy : Character;
-- Queuing_Policy : Character;
-- A value of zero indicates that time slicing should be suppressed. If no
-- pragma is present, and no -T switch was used, the value is -1.
+ -- Heap_Size is the heap to use for memory allocations set by use of a
+ -- -Hnn parameter for the binder or by the GNAT$NO_MALLOC_64 logical.
+ -- Valid values are 32 and 64. This switch is only available on VMS.
+
-- WC_Encoding shows the wide character encoding method used for the main
-- program. This is one of the encoding letters defined in
-- System.WCh_Con.WC_Encoding_Letters.
WBI (" Features_Set : Integer;");
WBI (" pragma Import (C, Features_Set, " &
"""__gnat_features_set"");");
+
+ if Opt.Heap_Size /= 0 then
+ WBI ("");
+ WBI (" Heap_Size : Integer;");
+ WBI (" pragma Import (C, Heap_Size, " &
+ """__gl_heap_size"");");
+
+ Write_Statement_Buffer;
+ end if;
end if;
-- Initialize stack limit variable of the environment task if the
WBI (" if Features_Set = 0 then");
WBI (" Set_Features;");
WBI (" end if;");
+
+ -- Features_Set may twiddle the heap size according to a logical
+ -- name, but the binder switch must override.
+
+ if Opt.Heap_Size /= 0 then
+ Set_String (" Heap_Size := ");
+ Set_Int (Opt.Heap_Size);
+ Set_Char (';');
+ Write_Statement_Buffer;
+ end if;
end if;
+
end if;
-- Generate call to set Initialize_Scalar values if active
Write_Line (" -h Output this usage (help) information");
+ -- Line for -H switch
+
+ Write_Line (" -Hnn Use nn bit heap where nn is 32 or 64 " &
+ "(VMS Only)");
+
-- Lines for -I switch
Write_Line (" -Idir Specify library and source files search path");
tree malloc_ptr;
- /* On VMS, if 64-bit memory is disabled or pointers are 64-bit and the
- allocator size is 32-bit or Convention C, allocate 32-bit memory. */
+ /* On VMS, if pointers are 64-bit and the allocator size is 32-bit or
+ Convention C, allocate 32-bit memory. */
if (TARGET_ABI_OPEN_VMS
- && (!TARGET_MALLOC64
- || (POINTER_SIZE == 64
- && (UI_To_Int (Esize (Etype (gnat_node))) == 32
- || Convention (Etype (gnat_node)) == Convention_C))))
+ && (POINTER_SIZE == 64
+ && (UI_To_Int (Esize (Etype (gnat_node))) == 32
+ || Convention (Etype (gnat_node)) == Convention_C)))
malloc_ptr = build_call_1_expr (malloc32_decl, size_to_malloc);
else
malloc_ptr = build_call_1_expr (malloc_decl, size_to_malloc);
#endif
-/* Feature logical name and global variable address pair */
+/* Feature logical name and global variable address pair.
+ If we ever add another feature logical to this list, the
+ feature struct will need to be enhanced to take into account
+ possible values for *gl_addr. */
struct feature {char *name; int* gl_addr;};
/* Default values for GNAT features set by environment. */
-int __gl_no_malloc_64 = 0;
+int __gl_heap_size = 64;
/* Array feature logical names and global variable addresses */
static struct feature features[] = {
- {"GNAT$NO_MALLOC_64", &__gl_no_malloc_64},
+ {"GNAT$NO_MALLOC_64", &__gl_heap_size},
{0, 0}
};
else
strcpy (buff, "");
- if (strcmp (buff, "ENABLE") == 0)
- *features [i].gl_addr = 1;
- else if (strcmp (buff, "DISABLE") == 0)
- *features [i].gl_addr = 0;
+ if ((strcmp (buff, "ENABLE") == 0) ||
+ (strcmp (buff, "TRUE") == 0) ||
+ (strcmp (buff, "1") == 0))
+ *features [i].gl_addr = 32;
+ else if ((strcmp (buff, "DISABLE") == 0) ||
+ (strcmp (buff, "FALSE") == 0) ||
+ (strcmp (buff, "0") == 0))
+ *features [i].gl_addr = 64;
}
__gnat_features_set = 1;
-- GNAT
-- True if compiling in GNAT system mode (-gnatg switch)
+ Heap_Size : Nat := 0;
+ -- GNATBIND
+ -- Heap size for memory allocations. Valid values are 32 and 64. Only
+ -- available on VMS.
+
HLO_Active : Boolean := False;
-- GNAT
-- True if High Level Optimizer is activated (-gnatH switch)
-----------------------
procedure Analyze_Return_Statement (N : Node_Id);
- -- Common processing for simple_ and extended_return_statements
+ -- Common processing for simple and extended return statements
procedure Analyze_Function_Return (N : Node_Id);
-- Subsidiary to Analyze_Return_Statement. Called when the return statement
procedure Analyze_Return_Type (N : Node_Id);
-- Subsidiary to Process_Formals: analyze subtype mark in function
- -- specification, in a context where the formals are visible and hide
+ -- specification in a context where the formals are visible and hide
-- outer homographs.
procedure Analyze_Subprogram_Body_Helper (N : Node_Id);
Ptr := Ptr + 1;
Usage_Requested := True;
+ -- Processing for H switch
+
+ when 'H' =>
+ if Ptr = Max then
+ Bad_Switch (Switch_Chars);
+ end if;
+
+ Ptr := Ptr + 1;
+ Scan_Nat (Switch_Chars, Max, Ptr, Heap_Size, C);
+ if Heap_Size /= 32 and then Heap_Size /= 64 then
+ Bad_Switch (Switch_Chars);
+ end if;
+
-- Processing for i switch
when 'i' =>