[PATCH] Windows support for std::filesystem

2017-02-12 Thread niXman


Hi,

Tested on i686/x86_64-MinGW-W64

Please test possible regressions on posix platform.



--
Regards, niXman
___
Dual-target(32 & 64-bit) MinGW-W64 compilers for 32 and 64-bit Windows:
https://sf.net/p/mingw-w64/
Index: libstdc++-v3/src/filesystem/dir.cc
===
--- libstdc++-v3/src/filesystem/dir.cc	(revision 245367)
+++ libstdc++-v3/src/filesystem/dir.cc	(working copy)
@@ -41,9 +41,10 @@
 #endif
 
 #ifdef _GLIBCXX_FILESYSTEM_IS_WINDOWS
-# undef opendir
-# define opendir _wopendir
-#endif
+# include "fs-win32.h"
+#else
+# include "fs-posix.h"
+#endif // _GLIBCXX_FILESYSTEM_IS_WINDOWS
 
 namespace fs = std::experimental::filesystem;
 
@@ -51,7 +52,7 @@
 {
   _Dir() : dirp(nullptr) { }
 
-  _Dir(DIR* dirp, const fs::path& path) : dirp(dirp), path(path) { }
+  _Dir(os_DIR_t* dirp, const fs::path& path) : dirp(dirp), path(path) { }
 
   _Dir(_Dir&& d)
   : dirp(std::exchange(d.dirp, nullptr)), path(std::move(d.path)),
@@ -60,11 +61,11 @@
 
   _Dir& operator=(_Dir&&) = delete;
 
-  ~_Dir() { if (dirp) ::closedir(dirp); }
+  ~_Dir() { if (dirp) ::os_closedir(dirp); }
 
   bool advance(std::error_code*, directory_options = directory_options::none);
 
-  DIR*			dirp;
+  os_DIR_t*			dirp;
   fs::path		path;
   directory_entry	entry;
   file_type		type = file_type::none;
@@ -87,7 +88,7 @@
 if (ec)
   ec->clear();
 
-if (DIR* dirp = ::opendir(p.c_str()))
+if (os_DIR_t* dirp = ::os_opendir(p.c_str()))
   return {dirp, p};
 
 const int err = errno;
@@ -105,7 +106,7 @@
   }
 
   inline fs::file_type
-  get_file_type(const ::dirent& d __attribute__((__unused__)))
+  get_file_type(const ::os_dirent_t& d __attribute__((__unused__)))
   {
 #ifdef _GLIBCXX_HAVE_STRUCT_DIRENT_D_TYPE
 switch (d.d_type)
@@ -145,13 +146,14 @@
 ec->clear();
 
   int err = std::exchange(errno, 0);
-  const auto entp = readdir(dirp);
+  const auto entp = ::os_readdir(dirp);
   std::swap(errno, err);
 
   if (entp)
 {
   // skip past dot and dot-dot
-  if (!strcmp(entp->d_name, ".") || !strcmp(entp->d_name, ".."))
+  if (!std::char_traits::compare(entp->d_name, _WS("."), 1) ||
+	!std::char_traits::compare(entp->d_name, _WS(".."), 2))
 	return advance(ec, options);
   entry = fs::directory_entry{path / entp->d_name};
   type = get_file_type(*entp);
@@ -239,7 +241,7 @@
  error_code* ec)
 : _M_options(options), _M_pending(true)
 {
-  if (DIR* dirp = ::opendir(p.c_str()))
+  if (os_DIR_t* dirp = ::os_opendir(p.c_str()))
 {
   auto sp = std::make_shared<_Dir_stack>();
   sp->push(_Dir{ dirp, p });
Index: libstdc++-v3/src/filesystem/fs-posix.h
===
--- libstdc++-v3/src/filesystem/fs-posix.h	(nonexistent)
+++ libstdc++-v3/src/filesystem/fs-posix.h	(working copy)
@@ -0,0 +1,49 @@
+
+// Copyright (C) 2014-2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+#ifndef _GLIBCXX_EXPERIMENTAL_FS_POSIX_H
+#define _GLIBCXX_EXPERIMENTAL_FS_POSIX_H 1
+
+#define os_DIR_t DIR
+#define os_dirent_t dirent
+#define os_open open
+#define os_opendir opendir
+#define os_closedir closedir
+#define os_readdir readdir_r
+#define os_stat stat
+#define os_stat_t stat
+#define os_chmod chmod
+#define os_mkdir mkdir
+#define os_getcwd getcwd
+#define os_chdir chdir
+#define os_utimbuf_t utimbuf
+#define os_utime utime
+#define os_remove remove
+#define os_rename rename
+#define os_truncate truncate
+
+#define os_utime utime
+
+#define _WS(x) x
+
+#endif // _GLIBCXX_EXPERIMENTAL_FS_POSIX_H
Index: libstdc++-v3/src/filesystem/fs-win32.h
===
--- libstdc++-v3/src/filesystem/fs-win32.h	(nonexistent)
+++ libstdc++-v3/src/filesystem/fs-win32.h	(working copy)
@@ -0,0 +1,64 @@
+
+// Copyright (C) 2014-2017 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library. 

Re: [Fortran, Patch, CAF] Failed Images patch (TS 18508)

2017-02-12 Thread Jerry DeLisle

On 02/11/2017 03:02 PM, Alessandro Fanfarillo wrote:

Dear all,
please find in attachment a new patch following the discussion at
https://gcc.gnu.org/ml/fortran/2017-01/msg00054.html.

Suggestions on how to fix potential issues are more than welcome.

Regards,
Alessandro



On the failed images test:

program test_image_status
+  implicit none
+
+  write(*,*) image_status(1)
+

Write to a string and test the results.

I assume you have regression tested this again as stated in the earlier 
discussion.

I think this is OK to go in.

Jerry




Re: [PING] Re: [PATCH] Fix assembler arguments for -m16

2017-02-12 Thread Uros Bizjak
On Sun, Feb 12, 2017 at 4:27 PM, Gerald Pfeifer  wrote:
> I'd like to ping this patch for GCC 6 (and GCC 5).
>
> Gerald
>
> On Sun, 11 Dec 2016, Gerald Pfeifer wrote:
>> Uros, okay to also push to the GCC 6 branch for the coming release
>> and later the GCC 5 branch as well?  For reference, the committed
>> patch below.

OK.

Thanks,
Uros.

>> Gerald
>>
>>
>> 2016-12-11  Roger Pau Monné  
>>
>>   * config/i386/x86-64.h: Append --32 to the assembler options when
>>   -m16 is used on non-glibc systems as well.
>>
>> Index: config/i386/x86-64.h
>> ===
>> --- config/i386/x86-64.h  (revision 243527)
>> +++ config/i386/x86-64.h  (working copy)
>> @@ -49,7 +49,7 @@
>>  #define WCHAR_TYPE_SIZE 32
>>
>>  #undef ASM_SPEC
>> -#define ASM_SPEC "%{m32:--32} %{m64:--64} %{mx32:--x32}"
>> +#define ASM_SPEC "%{m16|m32:--32} %{m64:--64} %{mx32:--x32}"
>>
>>  #undef ASM_OUTPUT_ALIGNED_BSS
>>  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \


[PING] Re: [PATCH] Fix assembler arguments for -m16

2017-02-12 Thread Gerald Pfeifer
I'd like to ping this patch for GCC 6 (and GCC 5).

Gerald

On Sun, 11 Dec 2016, Gerald Pfeifer wrote:
> Uros, okay to also push to the GCC 6 branch for the coming release
> and later the GCC 5 branch as well?  For reference, the committed
> patch below.
> 
> Gerald
> 
> 
> 2016-12-11  Roger Pau Monné  
> 
>   * config/i386/x86-64.h: Append --32 to the assembler options when
>   -m16 is used on non-glibc systems as well.
> 
> Index: config/i386/x86-64.h
> ===
> --- config/i386/x86-64.h  (revision 243527)
> +++ config/i386/x86-64.h  (working copy)
> @@ -49,7 +49,7 @@
>  #define WCHAR_TYPE_SIZE 32
>  
>  #undef ASM_SPEC
> -#define ASM_SPEC "%{m32:--32} %{m64:--64} %{mx32:--x32}"
> +#define ASM_SPEC "%{m16|m32:--32} %{m64:--64} %{mx32:--x32}"
>  
>  #undef ASM_OUTPUT_ALIGNED_BSS
>  #define ASM_OUTPUT_ALIGNED_BSS(FILE, DECL, NAME, SIZE, ALIGN) \

[libstdc++,doc] Standardize references to Boost documentation

2017-02-12 Thread Gerald Pfeifer
It appears we have been using various ways to refer to bits of Boost
documentation, and I suggest to standardize this a bit per the patch
below.

http://www.boost.org/libs/ seems to be the shortest and
simplest form doing to.

Thoughts?

Gerald

2017-02-10  Gerald Pfeifer  

* doc/xml/manual/policy_data_structures.xml: Simplify and
standardize references to boost.org.
* doc/xml/manual/policy_data_structures_biblio.xml: Ditto.
* doc/xml/manual/shared_ptr.xml: Ditto.

Index: doc/xml/manual/policy_data_structures.xml
===
--- doc/xml/manual/policy_data_structures.xml   (revision 245374)
+++ doc/xml/manual/policy_data_structures.xml   (working copy)
@@ -5090,7 +5090,8 @@
 
 
   Some test utilities borrow ideas from
-  http://www.w3.org/1999/xlink; 
xlink:href="http://www.boost.org/doc/libs/release/libs/timer/index.html;>boost::timer.
+  http://www.w3.org/1999/xlink;
+   xlink:href="http://www.boost.org/libs/timer/;>boost::timer.
 
 
 
Index: doc/xml/manual/policy_data_structures_biblio.xml
===
--- doc/xml/manual/policy_data_structures_biblio.xml(revision 245374)
+++ doc/xml/manual/policy_data_structures_biblio.xml(working copy)
@@ -1,4 +1,3 @@
-
 
 http://docbook.org/ns/docbook; version="5.0"
  xml:id="pbds.biblio" xreflabel="Bibliography">
@@ -181,7 +180,7 @@
 
   
http://www.w3.org/1999/xlink;
- xlink:href="http://www.boost.org/doc/libs/release/libs/timer/;>
+ xlink:href="http://www.boost.org/libs/timer/;>
  Boost Timer Library

   
@@ -208,7 +207,7 @@
 
   
http://www.w3.org/1999/xlink;
- xlink:href="http://www.boost.org/doc/libs/release/libs/pool/;>
+ xlink:href="http://www.boost.org/libs/pool/;>
  Boost Pool Library

   
@@ -236,7 +235,7 @@
 
   
http://www.w3.org/1999/xlink;
- 
xlink:href="http://www.boost.org/doc/libs/release/libs/type_traits/;>
+ xlink:href="http://www.boost.org/libs/type_traits/;>
  Boost Type Traits Library

   
Index: doc/xml/manual/shared_ptr.xml
===
--- doc/xml/manual/shared_ptr.xml   (revision 245374)
+++ doc/xml/manual/shared_ptr.xml   (working copy)
@@ -461,7 +461,7 @@
   
   
http://www.w3.org/1999/xlink;
- xlink:href="http://boost.org/libs/smart_ptr/shared_ptr.htm;>
+ xlink:href="http://www.boost.org/libs/smart_ptr/shared_ptr.htm;>
   Boost C++ Libraries documentation, shared_ptr

   


[doc] Update link to Objective-C 2.0 manual

2017-02-12 Thread Gerald Pfeifer
Applied (revision 245375).

Gerald

2017-02-12  Gerald Pfeifer  
 
* doc/standards.texi (Standards): Update reference to
Objective-C 2.0.

Index: doc/standards.texi
===
--- doc/standards.texi  (revision 245374)
+++ doc/standards.texi  (working copy)
@@ -290,7 +290,7 @@
 The authoritative manual on Objective-C 2.0 is available from Apple:
 @itemize
 @item
-@uref{https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html}
+@uref{https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/Introduction/Introduction.html}
 @end itemize
 
 For more information concerning the history of Objective-C that is


Re: C++ Modules branch

2017-02-12 Thread Gerald Pfeifer

On Mon, 6 Feb 2017, Nathan Sidwell wrote:

Are you planning to add this to svn.html

Ah, thanks for the reminder.

First, here's a patch to collate the existing list, ok?


Oh, definitely.  This makes sense, and I trust your sorting
skills. :-)


(It seems quite a few may be dead now, time for some pruning?)


You mean, moving them to "Inactive Development Branches"?  Yes,
that makes sense.  

(In fact, it might make sense to differentiate between "Merged 
Branches" and "Inactive Development Branches", but that may be

too much effort.)

Gerald


New Swedish PO file for 'gcc' (version 7.1-b20170101)

2017-02-12 Thread Translation Project Robot
Hello, gentle maintainer.

This is a message from the Translation Project robot.

A revised PO file for textual domain 'gcc' has been submitted
by the Swedish team of translators.  The file is available at:

http://translationproject.org/latest/gcc/sv.po

(This file, 'gcc-7.1-b20170101.sv.po', has just now been sent to you in
a separate email.)

All other PO files for your package are available in:

http://translationproject.org/latest/gcc/

Please consider including all of these in your next release, whether
official or a pretest.

Whenever you have a new distribution with a new version number ready,
containing a newer POT file, please send the URL of that distribution
tarball to the address below.  The tarball may be just a pretest or a
snapshot, it does not even have to compile.  It is just used by the
translators when they need some extra translation context.

The following HTML page has been updated:

http://translationproject.org/domain/gcc.html

If any question arises, please contact the translation coordinator.

Thank you for all your work,

The Translation Project robot, in the
name of your translation coordinator.




Re: [PATCH doc] update -dM to mention excluded macros (PR 41540)

2017-02-12 Thread Gerald Pfeifer
On Tue, 7 Feb 2017, Martin Sebor wrote:
> The attached documentation-only patch clarifies the description
> of the -dM option to mention that  __FILE__ (and other predefined
> macros) do no appear on the list generated by the option.

+The predefined macros @code{__FILE__}, @code{__LINE__}, @code{__DATE__},
+and @code{__TIME__} are excluded from this list because their replacements
+may change from one line of output to the next.

Is this ("their replacements may change") truefor __FILE__ as well?

In any case, this may be too nit-picking, and the patch looks fine
to me.

Thanks,
Gerald


[doc] sourceware.org now defaults to https

2017-02-12 Thread Gerald Pfeifer
Committed (revision 245374).

Gerald

2017-02-12  Gerald Pfeifer  

* doc/extend.texi (Named Address Spaces): sourceware.org now
defaults to https.
* doc/install.texi (Binaries): Ditto.
(Specific): Ditto.

Index: doc/extend.texi
===
--- doc/extend.texi (revision 245373)
+++ doc/extend.texi (working copy)
@@ -1446,7 +1446,7 @@
 
 @noindent
 Such code requires at least binutils 2.23, see
-@w{@uref{http://sourceware.org/PR13503,PR13503}}.
+@w{@uref{https://sourceware.org/PR13503,PR13503}}.
 
 @item
 On the reduced Tiny devices like ATtiny40, no address spaces are supported.
Index: doc/install.texi
===
--- doc/install.texi(revision 245373)
+++ doc/install.texi(working copy)
@@ -3075,7 +3075,7 @@
 Microsoft Windows:
 @itemize
 @item
-The @uref{http://sourceware.org/cygwin/,,Cygwin} project;
+The @uref{https://sourceware.org/cygwin/,,Cygwin} project;
 @item
 The @uref{http://www.mingw.org/,,MinGW} and
 @uref{http://mingw-w64.org/doku.php,,mingw-w64} projects.
@@ -4786,7 +4786,7 @@
 
 For some systems, old versions of GNU binutils may also be useful,
 and are available from @file{pub/binutils/old-releases} on
-@uref{http://sourceware.org/mirrors.html,,sourceware.org mirror sites}.
+@uref{https://sourceware.org/mirrors.html,,sourceware.org mirror sites}.
 
 Some of the information on specific systems above relates to
 such older systems, but much of the information


[wwwdocs] readings.html - remove ftp.uu.net reference

2017-02-12 Thread Gerald Pfeifer
The document itself is still available in the link following the
one removed.

Applied.

Gerald

Index: readings.html
===
RCS file: /cvs/gcc/wwwdocs/htdocs/readings.html,v
retrieving revision 1.259
diff -u -r1.259 readings.html
--- readings.html   8 Feb 2017 18:44:56 -   1.259
+++ readings.html   12 Feb 2017 08:09:17 -
@@ -326,9 +326,6 @@
 http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm;>C99
 Defect Reports
 
-ftp://ftp.uu.net/doc/standards/ansi/X3.159-1989/;>C89
-Rationale (sources)
-
 http://www.lysator.liu.se/c/rat/title.html;>C89
 Rationale (HTML)
 


Re: [wwwdocs] Add a case to porting_to + a question wrt validity of another one

2017-02-12 Thread Gerald Pfeifer
On Wed, 8 Feb 2017, Marek Polacek wrote:
> Like this?

 As a consequence, the following examples are invalid and G++ will no longer
-compile them:
+compile them, because, in the following examples, G++ used to treat
+this->member where member has a non-dependent type, as
+type-dependent, and now it doesn't.

This has two instances of "the following examples".  Perhaps omit
the second instance and break the sentence, putting "G++ used to
treat..." in parenthesis after the first sentence, or adding this
explanation after the examples?

Also you'll need to write "-" instead of "->", and member
the second time as well (or member which we use in other places
in changes.html for this kind of usage).

This is fine with those changes, thanks.

Gerald