diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-18 11:59:53 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-07-18 11:59:53 +0200 |
commit | c45e5332cc03dc81591dfc409fdc224e4e1643c0 (patch) | |
tree | c3d124c2a5e2ba528889791ed31cd09ef593f7e8 | |
parent | adc1de25276100ea46ca23002c889f8b45fa22a0 (diff) | |
download | gcc-c45e5332cc03dc81591dfc409fdc224e4e1643c0.zip gcc-c45e5332cc03dc81591dfc409fdc224e4e1643c0.tar.gz gcc-c45e5332cc03dc81591dfc409fdc224e4e1643c0.tar.bz2 |
[multiple changes]
2014-07-18 Robert Dewar <dewar@adacore.com>
* a-witeio.adb: Minor code reorganization.
* i-cstrea.ads: Add comment.
2014-07-18 Thomas Quinot <quinot@adacore.com>
* s-oscons-tmplt.c (NAME_MAX): Minor cleaup and comment
clarifications.
From-SVN: r212801
-rw-r--r-- | gcc/ada/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/ada/a-witeio.adb | 18 | ||||
-rw-r--r-- | gcc/ada/i-cstrea.ads | 9 | ||||
-rw-r--r-- | gcc/ada/s-oscons-tmplt.c | 22 |
4 files changed, 44 insertions, 15 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 59ad09f..fc5a3be 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,15 @@ 2014-07-18 Robert Dewar <dewar@adacore.com> + * a-witeio.adb: Minor code reorganization. + * i-cstrea.ads: Add comment. + +2014-07-18 Thomas Quinot <quinot@adacore.com> + + * s-oscons-tmplt.c (NAME_MAX): Minor cleaup and comment + clarifications. + +2014-07-18 Robert Dewar <dewar@adacore.com> + * g-memdum.adb, g-memdum.ads, exp_strm.adb: Minor reformatting. 2014-07-18 Pascal Obry <obry@adacore.com> diff --git a/gcc/ada/a-witeio.adb b/gcc/ada/a-witeio.adb index b1d2bef..1f5e462 100644 --- a/gcc/ada/a-witeio.adb +++ b/gcc/ada/a-witeio.adb @@ -1082,13 +1082,20 @@ package body Ada.Wide_Text_IO is FIO.Check_Write_Status (AP (File)); for K in 1 .. Spacing loop + + -- We use Put here (rather than Putc) so that we get the proper + -- behavior on windows for output of Wide_String to the console. + Put (File, Wide_Character'Val (LM)); + File.Line := File.Line + 1; - if File.Page_Length /= 0 - and then File.Line > File.Page_Length - then + if File.Page_Length /= 0 and then File.Line > File.Page_Length then + + -- Same situation as above, use Put instead of Putc + Put (File, Wide_Character'Val (PM)); + File.Line := 1; File.Page := File.Page + 1; end if; @@ -1242,8 +1249,7 @@ package body Ada.Wide_Text_IO is Putc (Character'Pos (C), File); end Out_Char; - R : int; - pragma Unreferenced (R); + Discard : int; -- Start of processing for Put @@ -1252,7 +1258,7 @@ package body Ada.Wide_Text_IO is if text_translation_required then set_wide_text_mode (fileno (File.Stream)); - R := fputwc (Wide_Character'Pos (Item), File.Stream); + Discard := fputwc (Wide_Character'Pos (Item), File.Stream); else WC_Out (Item, File.WC_Method); end if; diff --git a/gcc/ada/i-cstrea.ads b/gcc/ada/i-cstrea.ads index a2d6ab0..020701e 100644 --- a/gcc/ada/i-cstrea.ads +++ b/gcc/ada/i-cstrea.ads @@ -221,13 +221,18 @@ package Interfaces.C_Streams is -- Control of Text/Binary Mode -- --------------------------------- + -- Is the above section title good enough, given the new addition??? + -- If text_translation_required is true, then the following functions may -- be used to dynamically switch a file from binary to text mode or vice -- versa. These functions have no effect if text_translation_required is -- false (i.e. in normal unix mode). Use fileno to get a stream handle. - procedure set_binary_mode (handle : int); - procedure set_text_mode (handle : int); + procedure set_binary_mode (handle : int); + procedure set_text_mode (handle : int); + + -- The following needs documentation ??? + procedure set_wide_text_mode (handle : int); ---------------------------- diff --git a/gcc/ada/s-oscons-tmplt.c b/gcc/ada/s-oscons-tmplt.c index 2b16448..7fef245 100644 --- a/gcc/ada/s-oscons-tmplt.c +++ b/gcc/ada/s-oscons-tmplt.c @@ -80,8 +80,11 @@ pragma Style_Checks ("M32766"); /* Feature macro definitions */ -/* Define _POSIX_SOURCE to get NAME_MAX, PATH_MAX */ -#define _POSIX_SOURCE +/** + ** Note: we deliberately do not define _POSIX_SOURCE / _POSIX_C_SOURCE + ** unconditionally, as on many platforms these macros actually disable + ** a number of non-POSIX but useful/required features. + **/ #if defined (__linux__) && !defined (_XOPEN_SOURCE) /* For Linux, define _XOPEN_SOURCE to get IOV_MAX */ @@ -319,17 +322,22 @@ CND(IOV_MAX, "Maximum writev iovcnt") /* NAME_MAX is used to compute the allocation size for a struct dirent * passed to readdir() / readdir_r(). However on some systems it is not * defined, as it is technically a filesystem dependent property that - * we should retrieve through pathconf(). + * we should retrieve through pathconf(). In any case, we do not need a + * precise value but only an upper limit. */ #ifndef NAME_MAX # ifdef MAXNAMELEN /* Solaris has no NAME_MAX but defines MAXNAMELEN */ # define NAME_MAX MAXNAMELEN -# else - /* PATH_MAX (maximum length of a full path name) is a safe last - * chance fall back. - */ +# elif defined(PATH_MAX) + /* PATH_MAX (maximum length of a full path name) is a safe fall back */ # define NAME_MAX PATH_MAX +# elif defined(FILENAME_MAX) + /* Similarly FILENAME_MAX can provide a safe fall back */ +# define NAME_MAX FILENAME_MAX +# else + /* Hardcode a reasonably large value as a last chance fallback */ +# define NAME_MAX 1024 # endif #endif CND(NAME_MAX, "Maximum file name length") |