28 Commits

Author SHA1 Message Date
Piotr Trojanek
5fdae93f53 Remove excessive constant qualifier on overlayed slice
The constant qualifiers on overlays, while perfectly safe and reasonable here,
cause spurious warnings from GNAT.
2025-11-26 12:42:00 +01:00
Piotr Trojanek
ce3007c68b Remove redundant parentheses inside unary operators
GNAT already emits a style warning when redundant parentheses appear inside
logical and short-circuit operators; this warning will be soon emitted for
unary operators as well.
2025-01-08 11:48:34 +01:00
Piotr Trojanek
8cce0dfff2 Simplify conversion to POSIX_String with array overlay
Code cleanup; semantics is unaffected.
2024-01-18 11:21:45 +01:00
Piotr Trojanek
3b96faf3a5 Use overlay to avoid copying values of the environment variables
Use overlays as documented in GNAT RM 9.15, Address Clauses. This is
a tiny performance improvement.
2024-01-11 16:59:51 +01:00
Piotr Trojanek
b6f9c2c2c6 Adjust parameter of For_Every_Environment_Variable to start at 1
There are two similar generic procedures in POSIX.Process_Environment:
* For_Every_Environment_Variable (Env : Environment)
* For_Every_Current_Environment_Variable

The one with explicit parameter adjusted the bounds of the Value string
that is passed to generic actual subprogram; now the one with implicit
parameter does the same adjustment.
2024-01-11 15:36:51 +01:00
Marc Poulhiès
8ab2d57e98 Fix (again) warning about redundant parenthesis
Previous fix was incorrect, 'not' expression must keep its parentheses.
And fix extra paren in "<" function.

no-precommit-check (to avoid complains about copyright headers)

TN: W203-029
Change-Id: I8102f1c086d35c984eca7e50e1570a05a5f33f65
2023-03-02 17:00:46 +01:00
Marc Poulhiès
c90a5bd7a3 Fix warning about redundant parenthesis
New warning has been enabled in the frontend. This change fixes one
new occurence of this new warning in debug build.

no-precommit-check (to avoid complains about copyright headers)

TN: W203-029
Change-Id: I0c5be7b9bebc2a6cd11c027831a5317c722ded19
2023-03-01 17:17:34 +01:00
Marc Poulhiès
83bd20756c Fix warning about redundant parenthesis
New warning has been enabled in the frontend. This change fixes the 4
new occurences of this new warning.

no-precommit-check (to avoid complains about copyright headers)

TN: W203-029
Change-Id: I5d36920109557a6337e8db7d6eaacc6a70bccc3a
2023-02-28 16:22:48 +01:00
Piotr Trojanek
dacffa1db0 Reorder WITH clauses alphabetically after removing Ada 83 renamings
Style cleanup missing from recent commits.

no-precommit-check (to avoid complains about copyright headers)

TN: V209-051
Change-Id: Id614483a4a69f1b430860cb6101fdad249bcb3ef
2022-06-13 19:59:56 +02:00
Piotr Trojanek
a058a7b3b9 Remove obsolete uses of renamed Ada 83 packages in debug build
Change uses of Unchecked_Conversion (which is obsolete since Ada 95) to
Ada.Unchecked_Conversion to avoid warnings recently enabled in GNAT. Same
for Unchecked_Deallocation.

Previous patch only changed files used for production build; this patch
changes files used for debug builds (and also for gnatsocks, for
completeness).

no-precommit-check (to avoid complains about copyright headers)

Change-Id: I0a753b06a46ce56778b8de9c96607515bea7cf84
2022-06-13 17:13:51 +00:00
Piotr Trojanek
728da9edd7 Remove obsolete uses of renamed Ada 83 packages
Change uses of Unchecked_Conversion (which is obsolete since Ada 95) to
Ada.Unchecked_Conversion to avoid warnings recently enabled in GNAT.

no-precommit-check (to avoid complains about copyright headers)

TN: V209-051
Change-Id: I62d8385a92eb200c0434d440df02712c28554d2b
2022-06-10 11:19:35 +02:00
Dmitriy Anisimkov
1b1137e5c5 Restore Ada 95 compatibility
TN: R822-029
Change-Id: If1d6c7bbc98984c1f7cb6d344dc295f445fe12da
2022-03-20 17:23:13 +06:00
Dmitriy Anisimkov
713e241cfe Expose new flags to API
Expose O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags to API.
O_EXEC, O_SEARCH, and O_TTY_INIT are not exposed because not supported
on Linux.

TN: SC04-017

Change-Id: I43ee1270640294049bc96877117bc6372c63c5e4
2022-03-17 15:36:49 +06:00
Dmitriy Anisimkov
e9113eecce Error callback on load executable at child process space
* c-posix.c
(Print_Error_Message): New routine.
(strerror): New routine support.
(strerror_r): New routine support.
(perror): New routine support.

* libsrc/posix.adb (Print_Error_Message): New routine.

* configure.in, confsrc/config.h.in
(strerror): New routine support.
(strerror_r): New routine support.
(perror): New routine support.

* configure: Regenerated.

* libsrc/threads/posix-process_primitives.ads,
  libsrc/threads/posix-process_primitives.adb
(Start_Process): Add On_Child_Failure parameter.
(Start_Process_Search): Add On_Child_Failure parameter.

TN: R822-029
Change-Id: I370d58ab3c866318bdb84e39112650edbec25229
2022-03-16 15:02:34 +00:00
Frederic Konrad
1e630b4c02 fix some unnecessary with of ancestor
This fixes the following warnings:
  warning: unnecessary with of ancestor [-gnatwr]
  _gprbuild: *** compilation phase failed

no-precommit-check

TN: S506-002
Change-Id: I206849c43821380eed71a32688335a993ee5d76a
2022-01-19 16:43:13 +01:00
Bob Duff
aa0d4933cf libsrc/posix-unsafe_process_primitives.ads: fix warning
Remove unnecessary "with POSIX", which the compiler now
warns about.

no-precommit-check

TN: UB17-024
Change-Id: I8f4ac3f629519fe5bb7222c8dcbe0a1bb2e3db7c
2021-12-11 08:18:38 -05:00
Bob Duff
77ed0d3d59 posix-signals: fix warning
Remove unnecessary "with POSIX", which the compiler now
warns about.

no-precommit-check

TN: UB17-024
Change-Id: I117c0f72947b5bfbf72f58c212d1da9a3abc4be7
2021-12-10 14:51:35 -05:00
Frederic Konrad
06379e2eb6 posix.adb: fix useless use clause warning
While compiling with --with-build-type=Debug:
    posix.adb:454:07: warning: use clause for package "Bogus_Error_Codes"
                      has no effect
    gprbuild: *** compilation phase failed

TN: S503-023
2019-05-13 09:39:55 +00:00
Frederic Konrad
2dcf1b0428 [S217-004] posix-macros: don't use SIGRTMIN under Darwin
SIGRTMIN macro is not defined under Darwin and __gnat_florist_sigrtmin is
not used either on this platform so don't try to compile it in
posix-macros.c.

Tested under Darwin and Linux.

TN: S217-004
2019-02-27 17:10:07 +00:00
Frederic Konrad
0dd57470d3 posix-signals: fix SIGRTMIN
The SIGRTMIN constant was hardcoded to the SIGRTMIN C macro value at
compilation time. Unfortunately this is wrong as it can change at
runtime according to the manual.

Excerpt from bits/signum.h:

"#define SIGRTMIN        (__libc_current_sigrtmin ())"

So drop the SIGRTMIN constant for a C function wrapper
(__gnat_florist_sigrtmin) which calls the SIGRTMIN macro in the C land.

no-precommit-check
TN: S217-004
2019-02-25 16:49:41 +00:00
Bob Duff
7a17c911c3 * c-posix.c:
Change POSIX_Character so it's a subtype,
so that type conversions between String
and POSIX_String work. Such conversions are
a lot more efficient than calls to the
conversion functions.
R426-014
2018-04-30 13:41:23 +00:00
Thomas Quinot
53147c4a6a Remove unneeded USE clauses
followup on PA07-083
2017-11-09 16:57:08 +00:00
Patrick Bernardi
0bfc4970a7 (fork): Update secondary stack references to reflect the new secondary stack
implementation in the GNAT run-time.

For P715-005
2017-09-27 19:33:30 +00:00
Justin Squirek
ee787cbb1c Remove ineffective use clause as per PA07-083 2017-08-29 15:09:45 +00:00
Thomas Quinot
08ffd6c09c Allow building with --disable-threads with new build system
Fixes NC11-035
2014-12-12 09:05:56 +00:00