Debian Codegraph @

gcc/testsuite/gnat.dg/system_info1.adb

raw
1 -- A basic test initially intended to check that
2 -- System.Task_Info.Number_Of_Processors yields sensible results on
3 -- both 32bit and 64bit Windows. Additional configurations where the
4 -- feature was verified to work can opt-in.
5
6 -- { dg-do run { target *-*-linux* *-*-mingw* *-*-solaris2.* } }
7
8 with System.Multiprocessors;
9 with System.Task_Info;
10
11 procedure System_Info1 is
12 Ncpus : constant System.Multiprocessors.CPU :=
13 System.Multiprocessors.Number_Of_CPUS;
14 Nprocs : constant Integer :=
15 System.Task_Info.Number_Of_Processors;
16
17 use type System.Multiprocessors.CPU;
18 begin
19 if Nprocs <= 0 or else Nprocs > 1024 then
20 raise Program_Error;
21 end if;
22 if Ncpus <= 0 or else Ncpus > 1024 then
23 raise Program_Error;
24 end if;
25 if Nprocs /= Integer (Ncpus) then
26 raise Program_Error;
27 end if;
28 end;