Re: Mirror

2012-04-22 Thread Gerald Pfeifer
Installed now, after an exchange with Igor and monitoring the mirror
for ten days.

Thanks, Igor!

Gerald

On Mon, 9 Apr 2012, Gerald Pfeifer wrote:
> I was just going to add your server by means of the patch below,
> alas all attempts to rach the server time out.  What's going on?
> 
> Gerald
> 
> Index: mirrors.html
> ===
> RCS file: /cvs/gcc/wwwdocs/htdocs/mirrors.html,v
> retrieving revision 1.217
> diff -u -3 -p -r1.217 mirrors.html
> --- mirrors.html  4 Feb 2012 23:11:59 -   1.217
> +++ mirrors.html  9 Apr 2012 18:08:16 -
> @@ -29,6 +29,7 @@ mirrors.  The following sites mirror
>  Hungary, Budapest:  href="http://robotlab.itk.ppke.hu/gcc/";>robotlab.itk.ppke.hu, thanks to 
> Adam Rak (neurhlp at gmail.com)
>  Japan: ftp://ftp.dti.ad.jp/pub/lang/gcc/";>ftp.dti.ad.jp, 
> thanks to IWAIZAKO Takahiro (ftp-admin at dti.ad.jp)
>  Japan:  href="http://ftp.tsukuba.wide.ad.jp/software/gcc/";>ftp.tsukuba.wide.ad.jp,
>  thanks to Kohei Takahashi (tsukuba-ftp-servers at tsukuba.wide.ad.jp)
> +Latvia, Riga:  href="http://mirrors.webhostinggeeks.com/gcc/";>mirrors.webhostinggeeks.com/gcc/,
>  thanks to Igor (whg.igp at gmail.com)
>  The Netherlands, Nijmegen:  href="ftp://ftp.nluug.nl/mirror/languages/gcc";>ftp.nluug.nl, thanks to 
> Jan Cristiaan van Winkel (jc at ATComputing.nl)
>  Slovakia, Bratislava: http://gcc.fyxm.net/";>gcc.fyxm.net, 
> thanks to Jan Teluch (admin at 2600.sk)
>  UK:  href="ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/";>ftp://ftp.mirrorservice.org/sites/sourceware.org/pub/gcc/,
>  thanks to mirror at mirrorservice.org


Re: [v3] Add missing forward_list<>::splice_after and merge overloads fix splice_after taking a range

2012-04-22 Thread Jonathan Wakely
On 16 April 2012 21:28, Jonathan Wakely wrote:
> I have a patch to add the checks to 

And here it is, only checking in debug mode because noone objected to
that suggestion.

* include/debug/forward_list (forward_list::splice_after): Check
allocators are equal.
* src/c++11/debug.cc: Fix spelling.
* testsuite/23_containers/forward_list/debug/splice_after5_neg.cc:
New.
* testsuite/23_containers/forward_list/debug/splice_after6_neg.cc:
Likewise.
* testsuite/23_containers/forward_list/debug/splice_after7_neg.cc:
Likewise.

Tested x86_64-linux, committed to trunk.
commit 9b07baf113d864170679189e5269ccaad2992cc8
Author: Jonathan Wakely 
Date:   Tue Apr 17 00:10:50 2012 +0100

* include/debug/forward_list (forward_list::splice_after): Check
allocators are equal.
* src/c++11/debug.cc: Fix spelling.
* testsuite/23_containers/forward_list/debug/splice_after5_neg.cc:
New.
* testsuite/23_containers/forward_list/debug/splice_after6_neg.cc:
Likewise.
* testsuite/23_containers/forward_list/debug/splice_after7_neg.cc:
Likewise.

diff --git a/libstdc++-v3/include/debug/forward_list 
b/libstdc++-v3/include/debug/forward_list
index f4a7ee9..8ad4336 100644
--- a/libstdc++-v3/include/debug/forward_list
+++ b/libstdc++-v3/include/debug/forward_list
@@ -409,6 +409,10 @@ namespace __debug
_GLIBCXX_DEBUG_VERIFY(&__list != this,
  _M_message(__gnu_debug::__msg_self_splice)
  ._M_sequence(*this, "this"));
+   _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
+ _M_message(__gnu_debug::__msg_splice_alloc)
+ ._M_sequence(*this)
+ ._M_sequence(__list, "__list"));
this->_M_transfer_from_if(__list, [&__list](_Base_const_iterator __it)
  {
return __it != __list._M_base().cbefore_begin()
@@ -433,6 +437,10 @@ namespace __debug
  _M_message(__gnu_debug::__msg_splice_other)
  ._M_iterator(__i, "__i")
  ._M_sequence(__list, "__list"));
+   _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
+ _M_message(__gnu_debug::__msg_splice_alloc)
+ ._M_sequence(*this)
+ ._M_sequence(__list, "__list"));
 
// _GLIBCXX_RESOLVE_LIB_DEFECTS
// 250. splicing invalidates iterators
@@ -469,6 +477,10 @@ namespace __debug
  ._M_sequence(__list, "list")
  ._M_iterator(__before, "before")
  ._M_iterator(__last, "last"));
+   _GLIBCXX_DEBUG_VERIFY(__list.get_allocator() == this->get_allocator(),
+ _M_message(__gnu_debug::__msg_splice_alloc)
+ ._M_sequence(*this)
+ ._M_sequence(__list, "__list"));
 
for (_Base_const_iterator __tmp = std::next(__before.base());
 __tmp != __last.base(); ++__tmp)
diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc
index 0c746c1..f0ab4bc 100644
--- a/libstdc++-v3/src/c++11/debug.cc
+++ b/libstdc++-v3/src/c++11/debug.cc
@@ -131,7 +131,7 @@ namespace __gnu_debug
 "attempt to flip a singular bitset reference",
 // std::list checks
 "attempt to splice a list into itself",
-"attempt to splice lists with inequal allocators",
+"attempt to splice lists with unequal allocators",
 "attempt to splice elements referenced by a %1.state; iterator",
 "attempt to splice an iterator from a different container",
 "splice destination %1.name;"
diff --git 
a/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after5_neg.cc 
b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after5_neg.cc
new file mode 100644
index 000..6b7d0da
--- /dev/null
+++ 
b/libstdc++-v3/testsuite/23_containers/forward_list/debug/splice_after5_neg.cc
@@ -0,0 +1,41 @@
+// { dg-options "-std=gnu++0x" }
+// { dg-require-debug-mode "" }
+// { dg-do run { xfail *-*-* } }
+
+// Copyright (C) 2012 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 Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file 

[v3] fix libstdc++/53027

2012-04-22 Thread Jonathan Wakely
* include/bits/ptr_traits.h (pointer_traits::rebind): Make public.
* testsuite/20_util/pointer_traits/requirements/typedefs.cc: Check
rebind works.

Tested x86_64linux, committed to trunk and will commit to 4.7 soon.
commit 6141cdceb14025ef258b8809301558f5962bf7ab
Author: Jonathan Wakely 
Date:   Fri Apr 20 09:13:44 2012 +0100

* include/bits/ptr_traits.h (pointer_traits::rebind): Make public.
* testsuite/20_util/pointer_traits/requirements/typedefs.cc: Check
rebind works.

diff --git a/libstdc++-v3/include/bits/ptr_traits.h 
b/libstdc++-v3/include/bits/ptr_traits.h
index 7f120b1..bba9b49 100644
--- a/libstdc++-v3/include/bits/ptr_traits.h
+++ b/libstdc++-v3/include/bits/ptr_traits.h
@@ -140,14 +140,8 @@ _GLIBCXX_HAS_NESTED_TYPE(difference_type)
   /// Type used to represent the difference between two pointers
   typedef typename __ptrtr_diff_type<_Ptr>::__type  difference_type;
 
-private:
   template
 using rebind = typename __ptrtr_rebind<_Ptr, _Up>::__type;
-
-  // allocator_traits needs to use __rebind
-  template friend struct allocator_traits;
-  template friend struct pointer_traits;
-  template friend class __ptrtr_rebind_helper2;
 };
 
   /**
diff --git 
a/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc 
b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
index c682557..47b5212 100644
--- a/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
+++ b/libstdc++-v3/testsuite/20_util/pointer_traits/requirements/typedefs.cc
@@ -32,6 +32,7 @@ void test01()
   typedef typename test_type::pointer   pointer;
   typedef typename test_type::element_type  element_type;
   typedef typename test_type::difference_type   difference_type;
+  typedef typename test_type::template rebind rebind_type;
 }
 
 int main()


[v3] add difference_type to __gnu_cxx::__alloc_traits

2012-04-22 Thread Jonathan Wakely
The allocator_traits wrapper is missing difference_type, noticed while
making vstring allocator-aware.

   * include/ext/alloc_traits.h (__alloc_traits::difference_type):
   Define.

Tested x86_64-linux, committed to trunk.
commit 7a3e74660df7df20bebb7676cd9142841637ba40
Author: Jonathan Wakely 
Date:   Wed Mar 21 09:40:45 2012 +

* include/ext/alloc_traits.h (__alloc_traits::difference_type):
Define.

diff --git a/libstdc++-v3/include/ext/alloc_traits.h 
b/libstdc++-v3/include/ext/alloc_traits.h
index 4862636..b3e3af6 100644
--- a/libstdc++-v3/include/ext/alloc_traits.h
+++ b/libstdc++-v3/include/ext/alloc_traits.h
@@ -99,6 +99,7 @@ template
 typedef typename _Base_type::pointerpointer;
 typedef typename _Base_type::const_pointer  const_pointer;
 typedef typename _Base_type::size_type  size_type;
+typedef typename _Base_type::difference_typedifference_type;
 // C++0x allocators do not define reference or const_reference
 typedef value_type& reference;
 typedef const value_type&   const_reference;
@@ -170,6 +171,7 @@ template
 typedef typename _Alloc::reference  reference;
 typedef typename _Alloc::const_referenceconst_reference;
 typedef typename _Alloc::size_type  size_type;
+typedef typename _Alloc::difference_typedifference_type;
 
 static pointer
 allocate(_Alloc& __a, size_type __n)


[Fortran-dev] Merge from the trunk

2012-04-22 Thread Tobias Burnus
Thomas: Please write branch changes not in libgfortran/ChangeLog but in 
libgfortran/ChangeLog.fortran-dev; that avoids merge problems when 
updating from the trunk.


The branch (rev. 186674) now matches the trunk (Rev. 185178->186672). 
Unfortunately, there are still about a dozen failures.


Tobias


PR c/53066 Wshadow should not warn for shadowing an extern function

2012-04-22 Thread Manuel López-Ibáñez
As described by Linus here:
http://lkml.indiana.edu/hypermail/linux/kernel/0611.3/1020.html

Wshadow warns whenever any declaration shadows a global function
declaration. This is almost always noise, since most (always?) of the
time one cannot mistakenly replace a function by another variable. The
false positives are too common (Linus mentions using the name 'index'
when including string.h).

Interestingly, the C++ FE does not warn for this case, but it is not
very clear to me where this decision is taken.

Bootstrapped and tested.

OK?

2012-04-22  Manuel López-Ibáñez  

PR c/53066
gcc/
* c-decl.c (warn_if_shadowing): Do not warn for shadowed function
declarations.
testsuite/
* c-c++-common/wshadow.c: New.


wshadow.diff
Description: Binary data


Re: RFC [Patch, Fortran] PR - support "q" for exponents when READing floating-point numbers

2012-04-22 Thread Janne Blomqvist
On Fri, Apr 20, 2012 at 12:18, Tobias Burnus  wrote:
> Dear all,
>
> some compilers support using "q" to indicate quad precision, e.g. "4.0q0".
> Since GCC 4.7, gfortran supports this vendor extension in the source code.
> However, READing the floating-point number "4.0q0" was not supported.
>
> The attached patch adds this support, which some users expect (cf. PR and
> comp.lang.fortran).
>
> Testing other compilers, the result is:
> - 'q' not supported: g95, NAG f95, PGI, PathScale, Crayftn
> - 'q' supported: g77, ifort, sunf95
> (I don't know which of those compilers support quad precision.)
>
> Hence, I am not sure whether one should add support for it. What do you
> think?

I don't particularly like adding extensions, but this seems fairly
widespread (thanks for testing!) and the patch is small, so I don't
think it'll hurt.

> Attached is a lightly tested patch and a test case.
> OK for the trunk after regtesting it?

Ok.



-- 
Janne Blomqvist


Re: [PATCH] Fix PR53031

2012-04-22 Thread H.J. Lu
On Thu, Apr 19, 2012 at 5:47 AM, Richard Guenther  wrote:
>
> This fixes PR53031 and reverts back to using the number of latch
> iterations in VRP when computing ranges for induction variables.
> Now after ira_allocno_object_iter_cond is fixed this no longer
> breaks bootstrap.
>
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>
> Richard.
>
> 2012-04-19  Richard Guenther  
>
>        PR tree-optimization/53031
>        * tree-vrp.c (adjust_range_with_scev): Revert back to
>        using max_loop_iterations.
>

This caused:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53073

-- 
H.J.


Re: [PATCH] Fix PR53031

2012-04-22 Thread H.J. Lu
On Sat, Apr 21, 2012 at 3:43 PM, H.J. Lu  wrote:
> On Thu, Apr 19, 2012 at 5:47 AM, Richard Guenther  wrote:
>>
>> This fixes PR53031 and reverts back to using the number of latch
>> iterations in VRP when computing ranges for induction variables.
>> Now after ira_allocno_object_iter_cond is fixed this no longer
>> breaks bootstrap.
>>
>> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>>
>> Richard.
>>
>> 2012-04-19  Richard Guenther  
>>
>>        PR tree-optimization/53031
>>        * tree-vrp.c (adjust_range_with_scev): Revert back to
>>        using max_loop_iterations.
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53047
>

It isn't the cause for PR 53047.  But it does cause another bug.


-- 
H.J.


Re: [PATCH] Fix PR53031

2012-04-22 Thread H.J. Lu
On Sun, Apr 22, 2012 at 10:14 AM, H.J. Lu  wrote:
> On Thu, Apr 19, 2012 at 5:47 AM, Richard Guenther  wrote:
>>
>> This fixes PR53031 and reverts back to using the number of latch
>> iterations in VRP when computing ranges for induction variables.
>> Now after ira_allocno_object_iter_cond is fixed this no longer
>> breaks bootstrap.
>>
>> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
>>
>> Richard.
>>
>> 2012-04-19  Richard Guenther  
>>
>>        PR tree-optimization/53031
>>        * tree-vrp.c (adjust_range_with_scev): Revert back to
>>        using max_loop_iterations.
>>
>
> This caused:
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53073
>

and also

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53046

-- 
H.J.


Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Gabriel Dos Reis
On Sun, Apr 22, 2012 at 10:50 AM, Manuel López-Ibáñez
 wrote:
> This patch makes Wpedantic the canonical form of -pedantic. This makes
> -Wno-pedantic, -Werror=pedantic, #pragma diagnostics and other parts
> of the diagnostic machinery that expect warning options to start with
> -W, work with -Wpedantic.
>
> I did not touch -pedantic-errors, because it is not exactly equivalent
> to -Werror=pedantic. The fix there may be to have a new -Wpedantic-all
> that controls -Wpedantic + all the uncontrollable pedwarns, then
> -Werror=pedantic-all would be exactly equivalent to -pedantic-errors.
> But apart from consistency, I don't see much benefit, so I am not
> going to work on that.
>
> Bootstrapped + tested with enable-languages=all,objc++,ada.
>
> OK?

OK.

The longer-term fix is to eliminate the distinction between
-pedantic-errors and -Werror=pedantic.
Also, eventually calls to pedwarns should be unconditional and
finer-grained instead of the
current catchall OPT_Wpedantic.


Re: PR c/53066 Wshadow should not warn for shadowing an extern function

2012-04-22 Thread Gabriel Dos Reis
On Sun, Apr 22, 2012 at 11:00 AM, Manuel López-Ibáñez
 wrote:
> As described by Linus here:

> Interestingly, the C++ FE does not warn for this case, but it is not
> very clear to me where this decision is taken.

C++'s type system does not make it very likely to get into the
troubles that -Wshadow was attempting to warn about (shadowing
on extern function by a local variable)  -- thanks god.

This particular behaviour of-Wshadow is entirely up to C folks to
have or not.  I would suspect that it is not as useful in C99 or C11
as it might be in C K&R or even C90.

-- Gaby


[v3] libstdc++/53067

2012-04-22 Thread Paolo Carlini

Hi,

tested x86_64-linux, committed mainline and branch.

Thanks,
Paolo.

///
2012-04-22  Paolo Carlini  

PR libstdc++/53067
* include/bits/hashtable_policy.h: Change inheritances to public.
* testsuite/23_containers/unordered_map/requirements/53067.cc: New.
* testsuite/23_containers/unordered_set/requirements/53067.cc: Likewise.
Index: include/bits/hashtable_policy.h
===
--- include/bits/hashtable_policy.h (revision 186674)
+++ include/bits/hashtable_policy.h (working copy)
@@ -882,7 +882,9 @@
 
   /// Specialization using EBO.
   template
-struct _Hashtable_ebo_helper<_Nm, _Tp, true> : private _Tp
+struct _Hashtable_ebo_helper<_Nm, _Tp, true>
+// See PR53067.
+: public _Tp
 {
   _Hashtable_ebo_helper() = default;
 
@@ -949,8 +951,9 @@
   template
 struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash, false>
-: private _Hashtable_ebo_helper<0, _ExtractKey>,
-  private _Hashtable_ebo_helper<1, _Hash>
+// See PR53067.
+: public  _Hashtable_ebo_helper<0, _ExtractKey>,
+  public  _Hashtable_ebo_helper<1, _Hash>
 {
 private:
   typedef _Hashtable_ebo_helper<0, _ExtractKey>_EboExtractKey;
@@ -1025,9 +1028,10 @@
   typename _H1, typename _H2>
 struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2,
   _Default_ranged_hash, false>
-: private _Hashtable_ebo_helper<0, _ExtractKey>,
-  private _Hashtable_ebo_helper<1, _H1>,
-  private _Hashtable_ebo_helper<2, _H2>
+// See PR53067.
+: public  _Hashtable_ebo_helper<0, _ExtractKey>,
+  public  _Hashtable_ebo_helper<1, _H1>,
+  public  _Hashtable_ebo_helper<2, _H2>
 {
 private:
   typedef _Hashtable_ebo_helper<0, _ExtractKey>_EboExtractKey;
@@ -1108,9 +1112,10 @@
   typename _H1, typename _H2>
 struct _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2,
   _Default_ranged_hash, true>
-: private _Hashtable_ebo_helper<0, _ExtractKey>,
-  private _Hashtable_ebo_helper<1, _H1>,
-  private _Hashtable_ebo_helper<2, _H2>
+// See PR53067.
+: public  _Hashtable_ebo_helper<0, _ExtractKey>,
+  public  _Hashtable_ebo_helper<1, _H1>,
+  public  _Hashtable_ebo_helper<2, _H2>
 {
 private:
   typedef _Hashtable_ebo_helper<0, _ExtractKey>_EboExtractKey;
@@ -1229,7 +1234,8 @@
   typename _H1, typename _H2, typename _Hash>
 struct _Local_iterator_base<_Key, _Value, _ExtractKey,
_H1, _H2, _Hash, true>
-  : private _H2
+// See PR53067.
+: public _H2
 {
   _Local_iterator_base() = default;
   _Local_iterator_base(_Hash_node<_Value, true>* __p,
@@ -1261,8 +1267,9 @@
   typename _H1, typename _H2, typename _Hash>
 struct _Local_iterator_base<_Key, _Value, _ExtractKey,
_H1, _H2, _Hash, false>
-  : private _Hash_code_base<_Key, _Value, _ExtractKey,
-   _H1, _H2, _Hash, false>
+// See PR53067.
+: public _Hash_code_base<_Key, _Value, _ExtractKey,
+_H1, _H2, _Hash, false>
 {
   _Local_iterator_base() = default;
   _Local_iterator_base(_Hash_node<_Value, false>* __p,
@@ -1421,9 +1428,10 @@
   typename _ExtractKey, typename _Equal,
   typename _H1, typename _H2, typename _Hash, typename _Traits>
   struct _Hashtable_base
+  // See PR53067.
   : public  _Hash_code_base<_Key, _Value, _ExtractKey, _H1, _H2, _Hash,
-   _Traits::__hash_cached::value>,
-private _Hashtable_ebo_helper<0, _Equal>
+ _Traits::__hash_cached::value>,
+public _Hashtable_ebo_helper<0, _Equal>
   {
   public:
 typedef _Keykey_type;
Index: testsuite/23_containers/unordered_map/requirements/53067.cc
===
--- testsuite/23_containers/unordered_map/requirements/53067.cc (revision 0)
+++ testsuite/23_containers/unordered_map/requirements/53067.cc (revision 0)
@@ -0,0 +1,28 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++11" }
+
+// Copyright (C) 2012 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 Pred the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this l

[patch][google/integration] Don't force tls-model to initial-exec when building libgomp (issue6107046)

2012-04-22 Thread Paul Pluzhnikov
Greetings,

The patch below is needed for google/integration branch:
we want to be able build libgomp.a with -fPIC, be able to link it into a
shared library, and be able to dlopen that library without running out of
static TLS space (-ftls-model=initial-exec precludes that last part).

Google ref b/6368405
Google ref b/6156799

Tested: make && make check


2012-04-22   Paul Pluzhnikov  

* libgomp/configure.tgt: Don't force initial-exec.

Index: libgomp/configure.tgt
===
--- libgomp/configure.tgt   (revision 186636)
+++ libgomp/configure.tgt   (working copy)
@@ -10,16 +10,6 @@
 #  XCFLAGS Add extra compile flags to use.
 #  XLDFLAGSAdd extra link flags to use.
 
-# Optimize TLS usage by avoiding the overhead of dynamic allocation.
-if test $gcc_cv_have_tls = yes ; then
-  case "${target}" in
-
-*-*-linux*)
-   XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
-   ;;
-  esac
-fi
-
 # Since we require POSIX threads, assume a POSIX system by default.
 config_path="posix"
 

--
This patch is available for review at http://codereview.appspot.com/6107046


Re: [PR debug/47624] improve value tracking in non-VTA locations

2012-04-22 Thread Alexandre Oliva
On Jun  4, 2011, Alexandre Oliva  wrote:

> On Feb 15, 2011, Alexandre Oliva  wrote:
>> VTA only tracks locations of gimple regs, while addressable variables
>> still use the old var tracking strategy.  This means addressable
>> variables, during var-tracking, got locations that were not based on
>> VALUEs, which failed immediately in the presence of auto-inc addresses.
>> The locations also tended to degrade in other ways, when a register
>> holding an address happened to be overwritten at a later point.

>> This patch arranges for us to track addresses of these variables as
>> VALUEs, and to emit new locations for them when a location whose value
>> was used to compute its address changes, fixing the problem.

>> The patch was regstrapped on x86_64-linux-gnu and i686-linux-gnu.  Ok to
>> install?

> Ping?  Retested on both platforms, unchanged except for fixing the typo
> s/deug/debug/ in the ChangeLog entry, that Jakub caught.
> http://gcc.gnu.org/ml/gcc-patches/2011-02/msg00981.html

Ping?  Here's an updated patch that uses some of the recently-added
infrastructure to notify dependent variables and values when their
dependencies change.

It didn't look reasonable to add a field to all variables parts, or even
to all variables, just to hold a chain of loc_deps.  For one-part
variables, we reused cur_loc, but after some measurements I concluded it
was perfectly ok to leave some backlinks behind or dangling, checking
them on activation.

It's not even a significant waste of memory: compare-debug bootstraps on
x86_64- and i686-linux-gnu leave only 1 loc_exp_dep allocated in the
pool I created for NOT_ONEPART loc_exp_deps in 3447 of the 5172
functions that leave any loc_exp_deps dangling off dependent values, at
the end of var-tracking.  Of all these 5172 functions, only 4 ever went
beyond the initial pool allocation of 64 loc_exp_deps, which is less
than 0.05%, with 98 as the highest count on the bootstraps.  A 32
initial allocation would have been enough to cover 99.71% of the
functions that have backlinks left behind at the end of var-tracking
(thus released along with the pool), but since even 64 loc_exp_deps add
up to as little as 512 pointers (half a 4KB page), I decided to leave it
at that.

Regstrapped on x86_64- and i686-linux-gnu.  This ought to fix
gcc.dg/guality/pr43077-1.c -O1 on powerpc (which is what the bug report
is about), but I only verified that by examining a cross compiler
output.

Ok to install?

for  gcc/ChangeLog
from  Alexandre Oliva  

	PR debug/47624
	* var-tracking.c (loc_exp_dep_pool): New.
	(vt_emit_notes): Create and release the pool.
	(compute_bb_dataflow): Use value-based locations in MO_VAL_SET.
	(emit_notes_in_bb): Likewise.
	(loc_exp_dep_insert): Deal with NOT_ONEPART vars.
	(notify_dependents_of_changed_value): Likewise.
	(notify_dependents_of_resolved_value): Check that NOT_ONEPART
	variables don't have a VAR_LOC_DEP_LST.
	(emit_note_insn_var_location): Expand NOT_ONEPART locs that are
	VALUEs or MEMs of VALUEs.

Index: gcc/var-tracking.c
===
--- gcc/var-tracking.c.orig	2012-04-13 12:54:10.0 -0300
+++ gcc/var-tracking.c	2012-04-18 03:47:48.0 -0300
@@ -474,6 +474,9 @@ static alloc_pool loc_chain_pool;
 /* Alloc pool for struct shared_hash_def.  */
 static alloc_pool shared_hash_pool;
 
+/* Alloc pool for struct loc_exp_dep_s for NOT_ONEPART variables.  */
+static alloc_pool loc_exp_dep_pool;
+
 /* Changed variables, notes will be emitted for them.  */
 static htab_t changed_variables;
 
@@ -6284,29 +6287,41 @@ compute_bb_dataflow (basic_block bb)
 	{
 	  rtx loc = mo->u.loc;
 	  rtx val, vloc, uloc;
+	  rtx dstv, srcv;
 
 	  vloc = loc;
 	  uloc = XEXP (vloc, 1);
 	  val = XEXP (vloc, 0);
 	  vloc = uloc;
 
+	  if (GET_CODE (uloc) == SET)
+		{
+		  dstv = SET_DEST (uloc);
+		  srcv = SET_SRC (uloc);
+		}
+	  else
+		{
+		  dstv = uloc;
+		  srcv = NULL;
+		}
+
 	  if (GET_CODE (val) == CONCAT)
 		{
-		  vloc = XEXP (val, 1);
+		  dstv = vloc = XEXP (val, 1);
 		  val = XEXP (val, 0);
 		}
 
 	  if (GET_CODE (vloc) == SET)
 		{
-		  rtx vsrc = SET_SRC (vloc);
+		  srcv = SET_SRC (vloc);
 
-		  gcc_assert (val != vsrc);
+		  gcc_assert (val != srcv);
 		  gcc_assert (vloc == uloc || VAL_NEEDS_RESOLUTION (loc));
 
-		  vloc = SET_DEST (vloc);
+		  dstv = vloc = SET_DEST (vloc);
 
 		  if (VAL_NEEDS_RESOLUTION (loc))
-		val_resolve (out, val, vsrc, insn);
+		val_resolve (out, val, srcv, insn);
 		}
 	  else if (VAL_NEEDS_RESOLUTION (loc))
 		{
@@ -6322,45 +6337,53 @@ compute_bb_dataflow (basic_block bb)
 		  if (REG_P (uloc))
 			var_reg_delete (out, uloc, true);
 		  else if (MEM_P (uloc))
-			var_mem_delete (out, uloc, true);
+			{
+			  gcc_assert (MEM_P (dstv));
+			  gcc_assert (MEM_ATTRS (dstv) == MEM_ATTRS (uloc));
+			  var_mem_delete (out, dstv, true);
+			}
 		}
 		  else
 		{
 		  bool copied_p = VAL_EXPR_

Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Manuel López-Ibáñez
On 22 April 2012 19:25, Gabriel Dos Reis  wrote:
> On Sun, Apr 22, 2012 at 10:50 AM, Manuel López-Ibáñez
>  wrote:
>> This patch makes Wpedantic the canonical form of -pedantic. This makes
>> -Wno-pedantic, -Werror=pedantic, #pragma diagnostics and other parts
>> of the diagnostic machinery that expect warning options to start with
>> -W, work with -Wpedantic.
>>
>> I did not touch -pedantic-errors, because it is not exactly equivalent
>> to -Werror=pedantic. The fix there may be to have a new -Wpedantic-all
>> that controls -Wpedantic + all the uncontrollable pedwarns, then
>> -Werror=pedantic-all would be exactly equivalent to -pedantic-errors.
>> But apart from consistency, I don't see much benefit, so I am not
>> going to work on that.
>>
>> Bootstrapped + tested with enable-languages=all,objc++,ada.
>>
>> OK?
>
> OK.
>
> The longer-term fix is to eliminate the distinction between
> -pedantic-errors and -Werror=pedantic.

I agree on this in principle. However, from the comments of Joseph in
the PR, it is unclear in which direction the implementation should go.
Quoting Joseph:

"pedwarn" is simply a GCC-internal function name for diagnosing
constraint violations and should
not be allowed to influence command-line option names.  -pedantic-errors
means something like -Werror=standard-required-diagnostics and a pedwarn
enabled by default is a standard-required diagnostic enabled by default
(as opposed to a warning enabled by default which is a
non-standard-required diagnostic enabled by default).  There is no
particular reason to allow people to disable standard-required default
diagnostics as a group separately from non-standard-required ones; think
about more useful classifications of the existing enabled-by-default
diagnostics to work out suitable option names for disabling them."

Which seems to suggest that we add an option name for each pedwarn
enabled by default. Is this also what you suggest?

Cheers,

Manuel.


Re: [patch][google/integration] Don't force tls-model to initial-exec when building libgomp (issue 6107046)

2012-04-22 Thread aaw

Okay for google/integration.

http://codereview.appspot.com/6107046/


Go patch committed: Change Sizeof values from var to const

2012-04-22 Thread Ian Lance Taylor
This patch to gcc and libgo changes the Sizeof values in the syscall
package from var to const.  This matches the master Go library, and
makes the names easier to use because the consts are untyped.
Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu.
Committed to mainline and 4.7 branch.

Ian


2012-04-22  Ian Lance Taylor  

* godump.c (go_output_typedef): Dump size of structs.


Index: gcc/godump.c
===
--- gcc/godump.c	(revision 186643)
+++ gcc/godump.c	(working copy)
@@ -1024,12 +1024,25 @@ go_output_typedef (struct godump_contain
   fprintf (go_dump_file, "type _%s ",
 	   IDENTIFIER_POINTER (DECL_NAME (decl)));
   go_output_type (container);
+
+  if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)))
+	{
+	  HOST_WIDE_INT size = int_size_in_bytes (TREE_TYPE (decl));
+
+	  if (size > 0)
+	fprintf (go_dump_file,
+		 "\nconst _sizeof_%s = " HOST_WIDE_INT_PRINT_DEC,
+		 IDENTIFIER_POINTER (DECL_NAME (decl)),
+		 size);
+	}
+
   pointer_set_insert (container->decls_seen, decl);
 }
   else if (RECORD_OR_UNION_TYPE_P (TREE_TYPE (decl)))
 {
void **slot;
const char *type;
+   HOST_WIDE_INT size;
 
type = IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE ((decl;
/* If type defined already, skip.  */
@@ -1047,6 +1060,13 @@ go_output_typedef (struct godump_contain
fprintf (go_dump_file, "type _%s ",
 	   IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl;
go_output_type (container);
+
+   size = int_size_in_bytes (TREE_TYPE (decl));
+   if (size > 0)
+	 fprintf (go_dump_file,
+		  "\nconst _sizeof_%s = " HOST_WIDE_INT_PRINT_DEC,
+		  IDENTIFIER_POINTER (TYPE_NAME (TREE_TYPE (decl))),
+		  size);
 }
   else
 return;
Index: libgo/mksysinfo.sh
===
--- libgo/mksysinfo.sh	(revision 186655)
+++ libgo/mksysinfo.sh	(working copy)
@@ -586,9 +586,6 @@ if test -n "$cmsghdr"; then
 -e 's/cmsg_type/Type/' \
 -e 's/\[\]/[0]/' \
   >> ${OUT}
-
-  # The size of the cmsghdr struct.
-  echo 'var SizeofCmsghdr = int(unsafe.Sizeof(Cmsghdr{}))' >> ${OUT}
 fi
 
 # The SCM_ flags for Cmsghdr.
@@ -603,11 +600,6 @@ grep '^type _ucred ' gen-sysinfo.go | \
   -e 's/gid/Gid/' \
 >> ${OUT}
 
-# The size of the ucred struct.
-if grep 'type Ucred ' ${OUT} >/dev/null 2>&1; then
-  echo 'var SizeofUcred = int(unsafe.Sizeof(Ucred{}))' >> ${OUT}
-fi  
-
 # The ip_mreq struct.
 grep '^type _ip_mreq ' gen-sysinfo.go | \
 sed -e 's/_ip_mreq/IPMreq/' \
@@ -621,9 +613,6 @@ if ! grep 'type IPMreq ' ${OUT} >/dev/nu
   echo 'type IPMreq struct { Multiaddr [4]byte; Interface [4]byte; }' >> ${OUT}
 fi
 
-# The size of the ip_mreq struct.
-echo 'var SizeofIPMreq = int(unsafe.Sizeof(IPMreq{}))' >> ${OUT}
-
 # The ipv6_mreq struct.
 grep '^type _ipv6_mreq ' gen-sysinfo.go | \
 sed -e 's/_ipv6_mreq/IPv6Mreq/' \
@@ -637,9 +626,6 @@ if ! grep 'type IPv6Mreq ' ${OUT} >/dev/
   echo 'type IPv6Mreq struct { Multiaddr [16]byte; Interface uint32; }' >> ${OUT}
 fi
 
-# The size of the ipv6_mreq struct.
-echo 'var SizeofIPv6Mreq = int(unsafe.Sizeof(IPv6Mreq{}))' >> ${OUT}
-
 # The ip_mreqn struct.
 grep '^type _ip_mreqn ' gen-sysinfo.go | \
 sed -e 's/_ip_mreqn/IPMreqn/' \
@@ -654,9 +640,6 @@ if ! grep 'type IPMreqn ' ${OUT} >/dev/n
   echo 'type IPMreqn struct { Multiaddr [4]byte; Interface [4]byte; Ifindex int32 }' >> ${OUT}
 fi
 
-# The size of the ip_mreqn struct.
-echo 'var SizeofIPMreqn = int(unsafe.Sizeof(IPMreqn{}))' >> ${OUT}
-
 # Try to guess the type to use for fd_set.
 fd_set=`grep '^type _fd_set ' gen-sysinfo.go || true`
 fds_bits_type="_C_long"
@@ -722,8 +705,8 @@ grep '^const _NLM' gen-sysinfo.go | \
 
 # NLMSG_HDRLEN is defined as an expression using sizeof.
 if ! grep '^const NLMSG_HDRLEN' ${OUT} > /dev/null 2>&1; then
-  if grep '^type NlMsghdr ' ${OUT} > /dev/null 2>&1; then
-echo 'var NLMSG_HDRLEN = int((unsafe.Sizeof(NlMsghdr{}) + (NLMSG_ALIGNTO-1)) &^ (NLMSG_ALIGNTO-1))' >> ${OUT}
+  if grep '^const _sizeof_nlmsghdr ' ${OUT} > /dev/null 2>&1; then
+echo 'const NLMSG_HDRLEN = (_sizeof_nlmsghdr + (NLMSG_ALIGNTO-1)) &^ (NLMSG_ALIGNTO-1)' >> ${OUT}
   fi
 fi
 
@@ -741,11 +724,6 @@ grep '^type _rtmsg ' gen-sysinfo.go | \
   -e 's/rtm_flags/Flags/' \
 >> ${OUT}
 
-# The size of the rtmsg struct.
-if grep 'type RtMsg ' ${OUT} > /dev/null 2>&1; then
-  echo 'var SizeofRtMsg = int(unsafe.Sizeof(RtMsg{}))' >> ${OUT}
-fi
-
 # The rtgenmsg struct.
 grep '^type _rtgenmsg ' gen-sysinfo.go | \
 sed -e 's/_rtgenmsg/RtGenmsg/' \
@@ -768,11 +746,6 @@ grep '^const _RTN' gen-sysinfo.go | \
 grep '^const _RTPROT' gen-sysinfo.go | \
 sed -e 's/^\(const \)_\(RTPROT[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
 
-# The size of the rtgenmsg struct.
-if grep 'type RtGenmsg ' ${OUT} > /dev/null 2>&1; then
-  echo 'var SizeofRtGenmsg = int(unsafe.Sizeof(RtGenmsg{}))' >> ${OU

Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Jason Merrill

On 04/22/2012 02:42 PM, Manuel López-Ibáñez wrote:

Which seems to suggest that we add an option name for each pedwarn
enabled by default. Is this also what you suggest?


I agree with this, and I think that's also what Gaby was suggesting by 
"finer-grained".


Jason



Re: [C/C++] Do not pretty-print expressions with caret diagnostics for wrong function call

2012-04-22 Thread Jason Merrill
When we aren't printing the expression, please print the type instead; 
in a template it might not be clear what the type of the expression 
we're complaining about works out to be.


Jason


Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Manuel López-Ibáñez
On 22 April 2012 21:15, Jason Merrill  wrote:
> On 04/22/2012 02:42 PM, Manuel López-Ibáńez wrote:
>>
>> Which seems to suggest that we add an option name for each pedwarn
>> enabled by default. Is this also what you suggest?
>
>
> I agree with this, and I think that's also what Gaby was suggesting by
> "finer-grained".

Then, let's say we have one of such options. For example, let's call
it -Wx for this example. If the behaviour is consistent with other
"group" options like -Wall, then:

-Wx is enabled by default (like now)
-Wno-pedantic does not disable -Wx (like now)

But then

-Werror=pedantic implies -Werror=x ? (to mimic -pedantic-errors)

For example, -Wmain is enabled by default but also by -Wall and
-pedantic. However, -Werror=all does not enable -Werror=main. Is this
a bug or the desired behaviour?

And even less clear case is:

-Wno-error=pedantic -Werror implies -Werror=x or -Wno-error=x? The
documentation only says that -Wno-error= does not imply anything.

Cheers,

Manuel.


Re: [C/C++] Do not pretty-print expressions with caret diagnostics for wrong function call

2012-04-22 Thread Manuel López-Ibáñez
On 22 April 2012 21:20, Jason Merrill  wrote:
> When we aren't printing the expression, please print the type instead; in a
> template it might not be clear what the type of the expression we're
> complaining about works out to be.

I can do that. Should I also change it in the C FE?

Cheers,

Manuel.


libgo patch committed: Define more structs in syscall package

2012-04-22 Thread Ian Lance Taylor
This patch to libgo defines more structs in the syscall package,
corresponding to structs defined in the master library.  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to trunk
and 4.7 branch.

Ian

diff -r c7f1cc64c45f -r 8d768cdf12ce libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Sun Apr 22 11:48:26 2012 -0700
+++ b/libgo/mksysinfo.sh	Sun Apr 22 12:25:44 2012 -0700
@@ -785,6 +785,22 @@
   -e 's/rta_type/Type/' \
 >> ${OUT}
 
+# The in_pktinfo struct.
+grep '^type _in_pktinfo ' gen-sysinfo.go | \
+sed -e 's/_in_pktinfo/Inet4Pktinfo/' \
+  -e 's/ipi_ifindex/Ifindex/' \
+  -e 's/ipi_spec_dst/Spec_dst/' \
+  -e 's/ipi_addr/Addr/' \
+>> ${OUT}
+
+# The in6_pktinfo struct.
+grep '^type _in6_pktinfo ' gen-sysinfo.go | \
+sed -e 's/_in6_pktinfo/Inet6Pktinfo/' \
+  -e 's/ipi6_addr/Addr/' \
+  -e 's/ipi6_ifindex/Ifindex/' \
+  -e 's/_in6_addr/[16]byte/' \
+>> ${OUT}
+
 # The termios struct.
 grep '^type _termios ' gen-sysinfo.go | \
 sed -e 's/_termios/Termios/' \
@@ -962,6 +978,29 @@
 grep '^const _BPF_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\(BPF_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
 
+# The GNU/Linux nlattr struct.
+grep '^type _nlattr ' gen-sysinfo.go | \
+sed -e 's/_nlattr/NlAttr/' \
+  -e 's/nla_len/Len/' \
+  -e 's/nla_type/Type/' \
+>> ${OUT}
+
+# The GNU/Linux nlmsgerr struct.
+grep '^type _nlmsgerr ' gen-sysinfo.go | \
+sed -e 's/_nlmsgerr/NlMsgerr/' \
+  -e 's/error/Error/' \
+  -e 's/msg/Msg/' \
+>> ${OUT}
+
+# The GNU/Linux rtnexthop struct.
+grep '^type _rtnexthop ' gen-sysinfo.go | \
+sed -e 's/_rtnexthop/RtNexthop/' \
+  -e 's/rtnh_len/Len/' \
+  -e 's/rtnh_flags/Flags/' \
+  -e 's/rtnh_hops/Hops/' \
+  -e 's/rtnh_ifindex/Ifindex/' \
+>> ${OUT}
+
 # The GNU/Linux netlink flags.
 grep '^const _NETLINK_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\(NETLINK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
@@ -970,6 +1009,17 @@
 grep '^const _PACKET_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\(PACKET_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
 
+# The GNU/Linux inotify_event struct.
+grep '^type _inotify_event ' gen-sysinfo.go | \
+sed -e 's/_inotify_event/InotifyEvent/' \
+  -e 's/wd/Wd/' \
+  -e 's/mask/Mask/' \
+  -e 's/cookie/Cookie/' \
+  -e 's/len/Len/' \
+  -e 's/name/Name/' \
+  -e 's/\[\]/[0]/' \
+>> ${OUT}
+
 # The Solaris 11 Update 1 _zone_net_addr_t struct.
 grep '^type _zone_net_addr_t ' gen-sysinfo.go | \
 sed -e 's/_in6_addr/[16]byte/' \


libgo patch committed: More syscall fixes

2012-04-22 Thread Ian Lance Taylor
This patch to libgo provides more fixes to the syscall package to make
it more like the master Go library.  This is based on running the
procedure described at
http://code.google.com/p/go/issues/detail?id=1790#c12 .  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline
and 4.7 branch.

Ian

diff -r 8d768cdf12ce libgo/configure.ac
--- a/libgo/configure.ac	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/configure.ac	Sun Apr 22 13:05:34 2012 -0700
@@ -453,7 +453,7 @@
   ;;
 esac
 
-AC_CHECK_HEADERS(sys/file.h sys/mman.h syscall.h sys/epoll.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h)
+AC_CHECK_HEADERS(sys/file.h sys/mman.h syscall.h sys/epoll.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h)
 
 AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h linux/netlink.h linux/rtnetlink.h], [], [],
 [#ifdef HAVE_SYS_SOCKET_H
diff -r 8d768cdf12ce libgo/go/os/stat.go
--- a/libgo/go/os/stat.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/os/stat.go	Sun Apr 22 13:05:34 2012 -0700
@@ -19,7 +19,7 @@
 	fs := &fileStat{
 		name:basename(name),
 		size:int64(st.Size),
-		modTime: timespecToTime(st.Mtime),
+		modTime: timespecToTime(st.Mtim),
 		sys: st,
 	}
 	fs.mode = FileMode(st.Mode & 0777)
@@ -52,5 +52,5 @@
 
 // For testing.
 func atime(fi FileInfo) time.Time {
-	return timespecToTime(fi.Sys().(*syscall.Stat_t).Atime)
+	return timespecToTime(fi.Sys().(*syscall.Stat_t).Atim)
 }
diff -r 8d768cdf12ce libgo/go/os/stat_solaris.go
--- a/libgo/go/os/stat_solaris.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/os/stat_solaris.go	Sun Apr 22 13:05:34 2012 -0700
@@ -19,7 +19,7 @@
 	fs := &fileStat{
 		name:basename(name),
 		size:int64(st.Size),
-		modTime: timestrucToTime(st.Mtime),
+		modTime: timestrucToTime(st.Mtim),
 		sys: st,
 	}
 	fs.mode = FileMode(st.Mode & 0777)
@@ -52,5 +52,5 @@
 
 // For testing.
 func atime(fi FileInfo) time.Time {
-	return timestrucToTime(fi.(*fileStat).Sys().(*syscall.Stat_t).Atime)
+	return timestrucToTime(fi.(*fileStat).Sys().(*syscall.Stat_t).Atim)
 }
diff -r 8d768cdf12ce libgo/go/syscall/libcall_linux.go
--- a/libgo/go/syscall/libcall_linux.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/syscall/libcall_linux.go	Sun Apr 22 13:05:34 2012 -0700
@@ -335,7 +335,7 @@
 //sys	Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
 //tee(rfd int, wfd int, len Size_t, flags uint) Ssize_t
 
-func Tgkill(tgid, tid int, sig Signal) error {
+func Tgkill(tgid int, tid int, sig Signal) error {
 	r1, _, errno := Syscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig))
 	if r1 < 0 {
 		return errno
diff -r 8d768cdf12ce libgo/go/syscall/socket.go
--- a/libgo/go/syscall/socket.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/syscall/socket.go	Sun Apr 22 13:05:34 2012 -0700
@@ -22,7 +22,7 @@
 
 type RawSockaddrAny struct {
 	Addr RawSockaddr
-	Pad  [12]int8
+	Pad  [96]int8
 }
 
 const SizeofSockaddrAny = 0x1c
diff -r 8d768cdf12ce libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/mksysinfo.sh	Sun Apr 22 13:05:34 2012 -0700
@@ -151,6 +151,9 @@
 #if defined(HAVE_LINUX_ETHER_H)
 #include 
 #endif
+#if defined(HAVE_LINUX_FS_H)
+#include 
+#endif
 #if defined(HAVE_LINUX_REBOOT_H)
 #include 
 #endif
@@ -271,6 +274,10 @@
 grep '^const __PC' gen-sysinfo.go |
   sed -e 's/^\(const \)__\(PC[^= ]*\)\(.*\)$/\1\2 = __\2/' >> ${OUT}
 
+# The PATH_MAX constant.
+grep '^const _PATH_MAX ' gen-sysinfo.go |
+  echo 'const PathMax = _PATH_MAX' >> ${OUT}
+
 # epoll constants.
 grep '^const _EPOLL' gen-sysinfo.go |
   sed -e 's/^\(const \)_\(EPOLL[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
@@ -470,9 +477,9 @@
  -e 's/st_size/Size/' \
  -e 's/st_blksize/Blksize/' \
  -e 's/st_blocks/Blocks/' \
- -e 's/st_atim/Atime/' \
- -e 's/st_mtim/Mtime/' \
- -e 's/st_ctim/Ctime/' \
+ -e 's/st_atim/Atim/' \
+ -e 's/st_mtim/Mtim/' \
+ -e 's/st_ctim/Ctim/' \
  -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
  -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
  -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
@@ -791,6 +798,7 @@
   -e 's/ipi_ifindex/Ifindex/' \
   -e 's/ipi_spec_dst/Spec_dst/' \
   -e 's/ipi_addr/Addr/' \
+  -e 's/_in_addr/[4]byte/g' \
 >> ${OUT}
 
 # The in6_pktinfo struct.
@@ -82

Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Gabriel Dos Reis
On Sun, Apr 22, 2012 at 2:15 PM, Jason Merrill  wrote:
> On 04/22/2012 02:42 PM, Manuel López-Ibáńez wrote:
>>
>> Which seems to suggest that we add an option name for each pedwarn
>> enabled by default. Is this also what you suggest?
>
>
> I agree with this, and I think that's also what Gaby was suggesting by
> "finer-grained".

Indeed.

-- Gaby


Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Gabriel Dos Reis
On Sun, Apr 22, 2012 at 2:38 PM, Manuel López-Ibáñez
 wrote:

> For example, -Wmain is enabled by default but also by -Wall and
> -pedantic. However, -Werror=all does not enable -Werror=main. Is this
> a bug or the desired behaviour?

this particular one is a bug.


Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Manuel López-Ibáñez
On 22 April 2012 22:09, Gabriel Dos Reis  wrote:
> On Sun, Apr 22, 2012 at 2:15 PM, Jason Merrill  wrote:
>> On 04/22/2012 02:42 PM, Manuel López-Ibáńez wrote:
>>>
>>> Which seems to suggest that we add an option name for each pedwarn
>>> enabled by default. Is this also what you suggest?
>>
>>
>> I agree with this, and I think that's also what Gaby was suggesting by
>> "finer-grained".
>
> Indeed.

Fine, this makes sense to me. I opened PR c/53075 to track this.
However, adding one option for each pedwarn is a huge task that seems
unlikely to be ever completed.

Cheers,

Manuel.


Re: PR c/44774 -Werror=edantic

2012-04-22 Thread Gabriel Dos Reis
On Sun, Apr 22, 2012 at 3:23 PM, Manuel López-Ibáñez
 wrote:
> On 22 April 2012 22:09, Gabriel Dos Reis  
> wrote:
>> On Sun, Apr 22, 2012 at 2:15 PM, Jason Merrill  wrote:
>>> On 04/22/2012 02:42 PM, Manuel López-Ibáńez wrote:

 Which seems to suggest that we add an option name for each pedwarn
 enabled by default. Is this also what you suggest?
>>>
>>>
>>> I agree with this, and I think that's also what Gaby was suggesting by
>>> "finer-grained".
>>
>> Indeed.
>
> Fine, this makes sense to me. I opened PR c/53075 to track this.
> However, adding one option for each pedwarn is a huge task that seems
> unlikely to be ever completed.

Hmm, I do not think we really need additional option set separately
from the existing
non-generic OPT_Wxxx.


[PATCH v2] ARM: Use different linker path for hardfloat ABI

2012-04-22 Thread Michael Hope
Change the dynamic linker path for ARM hard float executables.
Matches the path discussed and agreed on last week[1].  Carlos will
follow up with the matching patch to GLIBC[2].  I'm happy to if he's
busy.

OK for trunk?

-- Michael
[1] http://sourceware.org/ml/libc-ports/2012-04/msg00060.html
[2] http://sourceware.org/ml/libc-ports/2012-04/msg00064.html

2012-04-23  Michael Hope  

* config/arm/linux-eabi.h (GLIBC_DYNAMIC_LINKER_HARD_FLOAT): Define.
(GLIBC_DYNAMIC_LINKER_SOFT_FLOAT): Define.
(GLIBC_DYNAMIC_LINKER): Redefine to use the hard float path.

diff --git a/gcc/config/arm/linux-eabi.h b/gcc/config/arm/linux-eabi.h
index 80bd825..3ddf812 100644
--- a/gcc/config/arm/linux-eabi.h
+++ b/gcc/config/arm/linux-eabi.h
@@ -62,7 +62,11 @@
 /* Use ld-linux.so.3 so that it will be possible to run "classic"
GNU/Linux binaries on an EABI system.  */
 #undef  GLIBC_DYNAMIC_LINKER
-#define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "/lib/ld-linux.so.3"
+#define GLIBC_DYNAMIC_LINKER_HARD_FLOAT "/lib/ld-linux-armhf.so.3"
+#define GLIBC_DYNAMIC_LINKER \
+   "%{mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_HARD_FLOAT "} \
+%{!mfloat-abi=hard:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "}"

 /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
use the GNU/Linux version, not the generic BPABI version.  */


Fix vectorizer ICE when building Mozilla

2012-04-22 Thread Jan Hubicka
Hi,
when building Mozilla we ICE in expr_invariant_in_loop_p walking ARRAY_REF, 
because one of the
fields is NULL (that is allowed)

Bootstrapped/regtested x86_64-linux, OK?

Honza

* tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Bail out at NULL 
tree refs.
Index: tree-ssa-loop-ivopts.c
===
*** tree-ssa-loop-ivopts.c  (revision 186688)
--- tree-ssa-loop-ivopts.c  (working copy)
*** expr_invariant_in_loop_p (struct loop *l
*** 1411,1417 
  
len = TREE_OPERAND_LENGTH (expr);
for (i = 0; i < len; i++)
! if (!expr_invariant_in_loop_p (loop, TREE_OPERAND (expr, i)))
return false;
  
return true;
--- 1411,1417 
  
len = TREE_OPERAND_LENGTH (expr);
for (i = 0; i < len; i++)
! if (TREE_OPERAND (expr, i) && !expr_invariant_in_loop_p (loop, 
TREE_OPERAND (expr, i)))
return false;
  
return true;


Re: PowerPC prologue and epilogue 2

2012-04-22 Thread David Edelsohn
On Tue, Apr 17, 2012 at 11:12 AM, Alan Modra  wrote:
> This fixes a lot of confusion in rs6000_frame_related call arguments.
> At the time rs6000_frame_related first appeared, the prologue only
> used sp_reg_rtx (r1) or frame_ptr_rtx (r12) as frame_reg_rtx to access
> register save slots.  If r12 was used, it was necessary to add a note
> that gave the equivalent offset relative to r1.
>
> Nowadays, r11 is used as frame_reg_rtx too, when abiv4 and saving regs
> out-of-line with a large frame.  When that change was made the calls
> to rs6000_frame_related were not updated.  So rs6000_frame_related
> won't replace r11 in register save rtl.  As it happens this isn't a
> bug because when you look closely, out-of-line saves are disabled with
> a large frame!  A fix for that will come later in this patch series.
> I also optimize rs6000_frame_related a little to save generating
> duplicate rtl.
>
>        * config/rs6000/rs6000.c (rs6000_frame_related): Don't emit a
>        REG_FRAME_RELATED_EXPR note when the instruction exactly matches
>        the replacement.
>        (emit_frame_save): Delete frame_ptr param.  Rename total_size to
>        frame_reg_to_sp.
>        (rs6000_emit_prologue): Add sp_off.  Update rs6000_frame_related
>        and emit_frame_save calls.  Cope with possibly missing note.

Please change 1 to STACK_POINTER_REGNUM.

Okay with that change.

Thanks, David


Re: PowerPC prologue and epilogue 3

2012-04-22 Thread David Edelsohn
On Tue, Apr 17, 2012 at 11:13 AM, Alan Modra  wrote:
> This continues the prologue and epilogue cleanup.  Not many user
> visible changes here, except for:
> - a bugfix to the LR save RTL emitted by rs6000_emit_savres_rtx which
>  may affect SPE,
> - a bugfix for SPE code emitted when using a static chain,
> - vector saves will be done using r1 for large frames just over 32k in
>  size, and,
> - using r11 as a frame pointer whenever we need to set up r11 for
>  out-of-line saves, and merging two pointer reg setup insns.
> The latter is a necessary prerequisite to enabling out-of-line
> save/restore for large frames, as I do in a later patch.  Currently
> this will only affect abiv4 -Os when using out-of-line saves.
>
> eg. -m32 -Os -mno-multiple
> int f (double x)
> {
>  char a[33];
>  __asm __volatile ("#%0" : "=m" (a) : : "fr31", "r27", "r28");
>  return (int) x;
> }
>        old                     new
>        stwu 1,-96(1)           mflr 0
>        mflr 0                  addi 11,1,-8
>        addi 11,1,88            stwu 1,-96(1)
>        stw 0,100(1)            stw 0,12(11)
>        stfd 31,88(1)           bl _savegpr_27
>        bl _savegpr_27          stfd 31,0(11)
>
>
>        * config/rs6000/rs6000.c (rs6000_emit_stack_reset): Delete forward
>        decl.  Move logic selecting update reg to callers.  Update all callers.
>        (rs6000_emit_allocate_stack): Add copy_off param.
>        (emit_frame_save): Don't handle reg+reg addressing.
>        (ptr_regno_for_savres): New function, extracted from..
>        (rs6000_emit_savres_rtx): ..here.  Add lr_offset param.
>        (rs6000_emit_prologue): Generate frame_ptr_rtx as we need it.
>        Set frame_reg_rtx to r11 whenever r11 is needed, and merge
>        frame offset adjustment for out-of-line save with copy from sp.
>        Simplify condition controlling whether cr is saved early or
>        late.  Use ptr_regno_for_savres to verify correct reg is set
>        up for out-of-line saves.  Pass the actual pointer reg used to
>        rs6000_emit_savres_rtx so rtl matches insns in out-of-line
>        function.  Rearrange spe vars so code is similar to that
>        elsewhere in this function.  Don't update frame_off when spe
>        save code will restore r11.  Use emit_frame_save for spe and
>        gpr saves.  Consolidate darwin out-of-line gpr setup with that
>        for other abis.  Don't assume frame_offset is zero and frame
>        reg is sp when setting up altivec reg saves, and calculate
>        exact offset requirement.
>        (rs6000_emit_epilogue): Use HOST_WIDE_INT for frame_off.  Tidy
>        spe restore code.  Consolidate darwin out-of-line gpr setup
>        with that for other abis.

This patch is okay.

Thanks, David


Re: Fix vectorizer ICE when building Mozilla

2012-04-22 Thread Andrew Pinski
On Sun, Apr 22, 2012 at 4:04 PM, Jan Hubicka  wrote:
> Hi,
> when building Mozilla we ICE in expr_invariant_in_loop_p walking ARRAY_REF, 
> because one of the
> fields is NULL (that is allowed)
>
> Bootstrapped/regtested x86_64-linux, OK?
>
> Honza
>
>        * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Bail out at NULL 
> tree refs.
> Index: tree-ssa-loop-ivopts.c
> ===
> *** tree-ssa-loop-ivopts.c      (revision 186688)
> --- tree-ssa-loop-ivopts.c      (working copy)
> *** expr_invariant_in_loop_p (struct loop *l
> *** 1411,1417 
>
>    len = TREE_OPERAND_LENGTH (expr);
>    for (i = 0; i < len; i++)
> !     if (!expr_invariant_in_loop_p (loop, TREE_OPERAND (expr, i)))
>        return false;
>
>    return true;
> --- 1411,1417 
>
>    len = TREE_OPERAND_LENGTH (expr);
>    for (i = 0; i < len; i++)
> !     if (TREE_OPERAND (expr, i) && !expr_invariant_in_loop_p (loop, 
> TREE_OPERAND (expr, i)))

Long lines, but I think otherwise this is obvious.

Thanks,
Andrew Pinski

>        return false;
>
>    return true;


[google/integration] Extend C++11 UDLs to be compatible with inttypes.h macros (issue6104051)

2012-04-22 Thread Ollie Wild
Add new option, -Wreserved-user-defined-literal.

This option, which is enabled by default, causes the preprocessor to warn
when a string or character literal is followed by a ud-suffix which does
not begin with an underscore.  According to [lex.ext]p10, this is
ill-formed.

Also modifies the preprocessor to treat such ill-formed suffixes as separate
preprocessing tokens.  This is consistent with the Clang front end (see
http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and enables
backwards compatibility with code that uses formatting macros from
, as in the following code block:

  int main() {
int64_t i64 = 123;
printf("My int64: %"PRId64"\n", i64);
  }

Google ref b/6377711.

2012-04-22   Ollie Wild  

* gcc/c-family/c-common.c:
* gcc/c-family/c-opts.c (c_common_handle_option):
* gcc/c-family/c.opt:
* gcc/doc/invoke.texi (struct A):
* gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C (test):
(main):
* libcpp/include/cpplib.h (struct cpp_options):
* libcpp/init.c (cpp_create_reader):
* libcpp/lex.c (lex_raw_string):
(lex_string):

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 1d19251..915dc25 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8724,6 +8724,7 @@ static const struct reason_option_codes_t option_codes[] 
= {
   {CPP_W_NORMALIZE,OPT_Wnormalized_},
   {CPP_W_INVALID_PCH,  OPT_Winvalid_pch},
   {CPP_W_WARNING_DIRECTIVE,OPT_Wcpp},
+  {CPP_W_RESERVED_USER_LITERALS,   OPT_Wreserved_user_defined_literal},
   {CPP_W_NONE, 0}
 };
 
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 5118928..dab6ce5 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -509,6 +509,10 @@ c_common_handle_option (size_t scode, const char *arg, int 
value,
  break;
}
 
+case OPT_Wreserved_user_defined_literal:
+  cpp_opts->warn_reserved_user_literals = value;
+  break;
+
 case OPT_Wreturn_type:
   warn_return_type = value;
   break;
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 40ff96c..f610513 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -589,6 +589,10 @@ Wreorder
 C++ ObjC++ Var(warn_reorder) Warning
 Warn when the compiler reorders code
 
+Wreserved-user-defined-literal
+C++ ObjC++ Warning
+Warn when a string or character literal is followed by a ud-suffix which does 
not begin with an underscore.
+
 Wreturn-type
 C ObjC C++ ObjC++ Var(warn_return_type) Warning
 Warn whenever a function's return type defaults to \"int\" (C), or about 
inconsistent return types (C++)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 1b61e76..d425079 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -198,7 +198,7 @@ in the following sections.
 -fvisibility-ms-compat @gol
 -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
 -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
--Wnon-virtual-dtor  -Wreorder @gol
+-Wnon-virtual-dtor  -Wreorder -Wreserved-user-defined-literal @gol
 -Weffc++  -Wstrict-null-sentinel @gol
 -Wno-non-template-friend  -Wold-style-cast @gol
 -Woverloaded-virtual  -Wno-pmf-conversions @gol
@@ -2474,6 +2474,30 @@ struct A @{
 The compiler will rearrange the member initializers for @samp{i}
 and @samp{j} to match the declaration order of the members, emitting
 a warning to that effect.  This warning is enabled by @option{-Wall}.
+
+@item -Wreserved-user-defined-literal @r{(C++ and Objective-C++ only)}
+@opindex Wreserved-user-defined-literal
+@opindex Wno-reserved-user-defined-literal
+Warn when a string or character literal is followed by a ud-suffix which does
+not begin with an underscore.  As a conforming extension, GCC treats such
+suffixes as separate preprocessing tokens in order to maintain backwards
+compatibility with code that uses formatting macros from @code{}.
+For example:
+
+@smallexample
+#define __STDC_FORMAT_MACROS
+#include 
+#include 
+
+int main() @{
+  int64_t i64 = 123;
+  printf("My int64: %"PRId64"\n", i64);
+@}
+@end smallexample
+
+In this case, @code{PRId64} is treated as a separate preprocessing token.
+
+This warning is enabled by default.
 @end table
 
 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C 
b/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
new file mode 100644
index 000..66de5c0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
@@ -0,0 +1,29 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+// Make sure -Wreserved-user-defined-literal is enabled by default and
+// triggers as expected.
+
+#define BAR "bar"
+#define PLUS_ONE + 1
+
+#include 
+#include 
+
+
+void
+test()
+{
+  char c = '3'PLUS_ONE;  // { dg-warning "invalid suffix on literal" }
+  char s[] = "foo"BAR;   // { d

Re: [google/integration] Extend C++11 UDLs to be compatible with inttypes.h macros (issue6104051)

2012-04-22 Thread Jeffrey Yasskin
Could you try to get this into mainline instead of just the google
branches? In http://gcc.gnu.org/PR52538, Jonathan sounded like he'd
consider accepting it.

On Sun, Apr 22, 2012 at 7:54 PM, Ollie Wild  wrote:
> Add new option, -Wreserved-user-defined-literal.
>
> This option, which is enabled by default, causes the preprocessor to warn
> when a string or character literal is followed by a ud-suffix which does
> not begin with an underscore.  According to [lex.ext]p10, this is
> ill-formed.
>
> Also modifies the preprocessor to treat such ill-formed suffixes as separate
> preprocessing tokens.  This is consistent with the Clang front end (see
> http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and enables
> backwards compatibility with code that uses formatting macros from
> , as in the following code block:
>
>  int main() {
>    int64_t i64 = 123;
>    printf("My int64: %"PRId64"\n", i64);
>  }
>
> Google ref b/6377711.
>
> 2012-04-22   Ollie Wild  
>
>        * gcc/c-family/c-common.c:
>        * gcc/c-family/c-opts.c (c_common_handle_option):
>        * gcc/c-family/c.opt:
>        * gcc/doc/invoke.texi (struct A):
>        * gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C (test):
>        (main):
>        * libcpp/include/cpplib.h (struct cpp_options):
>        * libcpp/init.c (cpp_create_reader):
>        * libcpp/lex.c (lex_raw_string):
>        (lex_string):
>
> diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
> index 1d19251..915dc25 100644
> --- a/gcc/c-family/c-common.c
> +++ b/gcc/c-family/c-common.c
> @@ -8724,6 +8724,7 @@ static const struct reason_option_codes_t 
> option_codes[] = {
>   {CPP_W_NORMALIZE,                    OPT_Wnormalized_},
>   {CPP_W_INVALID_PCH,                  OPT_Winvalid_pch},
>   {CPP_W_WARNING_DIRECTIVE,            OPT_Wcpp},
> +  {CPP_W_RESERVED_USER_LITERALS,       OPT_Wreserved_user_defined_literal},
>   {CPP_W_NONE,                         0}
>  };
>
> diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
> index 5118928..dab6ce5 100644
> --- a/gcc/c-family/c-opts.c
> +++ b/gcc/c-family/c-opts.c
> @@ -509,6 +509,10 @@ c_common_handle_option (size_t scode, const char *arg, 
> int value,
>          break;
>        }
>
> +    case OPT_Wreserved_user_defined_literal:
> +      cpp_opts->warn_reserved_user_literals = value;
> +      break;
> +
>     case OPT_Wreturn_type:
>       warn_return_type = value;
>       break;
> diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
> index 40ff96c..f610513 100644
> --- a/gcc/c-family/c.opt
> +++ b/gcc/c-family/c.opt
> @@ -589,6 +589,10 @@ Wreorder
>  C++ ObjC++ Var(warn_reorder) Warning
>  Warn when the compiler reorders code
>
> +Wreserved-user-defined-literal
> +C++ ObjC++ Warning
> +Warn when a string or character literal is followed by a ud-suffix which 
> does not begin with an underscore.
> +
>  Wreturn-type
>  C ObjC C++ ObjC++ Var(warn_return_type) Warning
>  Warn whenever a function's return type defaults to \"int\" (C), or about 
> inconsistent return types (C++)
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index 1b61e76..d425079 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -198,7 +198,7 @@ in the following sections.
>  -fvisibility-ms-compat @gol
>  -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
>  -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
> --Wnon-virtual-dtor  -Wreorder @gol
> +-Wnon-virtual-dtor  -Wreorder -Wreserved-user-defined-literal @gol
>  -Weffc++  -Wstrict-null-sentinel @gol
>  -Wno-non-template-friend  -Wold-style-cast @gol
>  -Woverloaded-virtual  -Wno-pmf-conversions @gol
> @@ -2474,6 +2474,30 @@ struct A @{
>  The compiler will rearrange the member initializers for @samp{i}
>  and @samp{j} to match the declaration order of the members, emitting
>  a warning to that effect.  This warning is enabled by @option{-Wall}.
> +
> +@item -Wreserved-user-defined-literal @r{(C++ and Objective-C++ only)}
> +@opindex Wreserved-user-defined-literal
> +@opindex Wno-reserved-user-defined-literal
> +Warn when a string or character literal is followed by a ud-suffix which does
> +not begin with an underscore.  As a conforming extension, GCC treats such
> +suffixes as separate preprocessing tokens in order to maintain backwards
> +compatibility with code that uses formatting macros from @code{}.
> +For example:
> +
> +@smallexample
> +#define __STDC_FORMAT_MACROS
> +#include 
> +#include 
> +
> +int main() @{
> +  int64_t i64 = 123;
> +  printf("My int64: %"PRId64"\n", i64);
> +@}
> +@end smallexample
> +
> +In this case, @code{PRId64} is treated as a separate preprocessing token.
> +
> +This warning is enabled by default.
>  @end table
>
>  The following @option{-W@dots{}} options are not affected by @option{-Wall}.
> diff --git a/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C 
> b/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
> new file mode 100644
> index 000..66de5c0
> --- /dev/null
> ++

Re: [google/integration] Extend C++11 UDLs to be compatible with inttypes.h macros (issue6104051)

2012-04-22 Thread Jeffrey Yasskin
Let's let the discussion _start_ before assuming it'll be protracted.
;) I don't think it'll kill us to run the next round of testing in
C++98 mode. If the patch doesn't look close to acceptance in a couple
days, I think it'll make sense to put the then-current version into
the google branches while people are agreeing about what to do in the
long run.

On Sun, Apr 22, 2012 at 8:14 PM, Ollie Wild  wrote:
> I'd like to get this into the google branches first because this is blocking
> testing.
>
> I fully expect this to result in some protracted discussion before it can be
> accepted into trunk.
>
> Ollie
>
>
> On Sun, Apr 22, 2012 at 10:10 PM, Jeffrey Yasskin 
> wrote:
>>
>> Could you try to get this into mainline instead of just the google
>> branches? In http://gcc.gnu.org/PR52538, Jonathan sounded like he'd
>> consider accepting it.
>>
>> On Sun, Apr 22, 2012 at 7:54 PM, Ollie Wild  wrote:
>> > Add new option, -Wreserved-user-defined-literal.
>> >
>> > This option, which is enabled by default, causes the preprocessor to
>> > warn
>> > when a string or character literal is followed by a ud-suffix which does
>> > not begin with an underscore.  According to [lex.ext]p10, this is
>> > ill-formed.
>> >
>> > Also modifies the preprocessor to treat such ill-formed suffixes as
>> > separate
>> > preprocessing tokens.  This is consistent with the Clang front end (see
>> > http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and
>> > enables
>> > backwards compatibility with code that uses formatting macros from
>> > , as in the following code block:
>> >
>> >  int main() {
>> >    int64_t i64 = 123;
>> >    printf("My int64: %"PRId64"\n", i64);
>> >  }
>> >
>> > Google ref b/6377711.
>> >
>> > 2012-04-22   Ollie Wild  
>> >
>> >        * gcc/c-family/c-common.c:
>> >        * gcc/c-family/c-opts.c (c_common_handle_option):
>> >        * gcc/c-family/c.opt:
>> >        * gcc/doc/invoke.texi (struct A):
>> >        * gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
>> > (test):
>> >        (main):
>> >        * libcpp/include/cpplib.h (struct cpp_options):
>> >        * libcpp/init.c (cpp_create_reader):
>> >        * libcpp/lex.c (lex_raw_string):
>> >        (lex_string):
>> >
>> > diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
>> > index 1d19251..915dc25 100644
>> > --- a/gcc/c-family/c-common.c
>> > +++ b/gcc/c-family/c-common.c
>> > @@ -8724,6 +8724,7 @@ static const struct reason_option_codes_t
>> > option_codes[] = {
>> >   {CPP_W_NORMALIZE,                    OPT_Wnormalized_},
>> >   {CPP_W_INVALID_PCH,                  OPT_Winvalid_pch},
>> >   {CPP_W_WARNING_DIRECTIVE,            OPT_Wcpp},
>> > +  {CPP_W_RESERVED_USER_LITERALS,
>> > OPT_Wreserved_user_defined_literal},
>> >   {CPP_W_NONE,                         0}
>> >  };
>> >
>> > diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
>> > index 5118928..dab6ce5 100644
>> > --- a/gcc/c-family/c-opts.c
>> > +++ b/gcc/c-family/c-opts.c
>> > @@ -509,6 +509,10 @@ c_common_handle_option (size_t scode, const char
>> > *arg, int value,
>> >          break;
>> >        }
>> >
>> > +    case OPT_Wreserved_user_defined_literal:
>> > +      cpp_opts->warn_reserved_user_literals = value;
>> > +      break;
>> > +
>> >     case OPT_Wreturn_type:
>> >       warn_return_type = value;
>> >       break;
>> > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
>> > index 40ff96c..f610513 100644
>> > --- a/gcc/c-family/c.opt
>> > +++ b/gcc/c-family/c.opt
>> > @@ -589,6 +589,10 @@ Wreorder
>> >  C++ ObjC++ Var(warn_reorder) Warning
>> >  Warn when the compiler reorders code
>> >
>> > +Wreserved-user-defined-literal
>> > +C++ ObjC++ Warning
>> > +Warn when a string or character literal is followed by a ud-suffix
>> > which does not begin with an underscore.
>> > +
>> >  Wreturn-type
>> >  C ObjC C++ ObjC++ Var(warn_return_type) Warning
>> >  Warn whenever a function's return type defaults to \"int\" (C), or
>> > about inconsistent return types (C++)
>> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
>> > index 1b61e76..d425079 100644
>> > --- a/gcc/doc/invoke.texi
>> > +++ b/gcc/doc/invoke.texi
>> > @@ -198,7 +198,7 @@ in the following sections.
>> >  -fvisibility-ms-compat @gol
>> >  -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
>> >  -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
>> > --Wnon-virtual-dtor  -Wreorder @gol
>> > +-Wnon-virtual-dtor  -Wreorder -Wreserved-user-defined-literal @gol
>> >  -Weffc++  -Wstrict-null-sentinel @gol
>> >  -Wno-non-template-friend  -Wold-style-cast @gol
>> >  -Woverloaded-virtual  -Wno-pmf-conversions @gol
>> > @@ -2474,6 +2474,30 @@ struct A @{
>> >  The compiler will rearrange the member initializers for @samp{i}
>> >  and @samp{j} to match the declaration order of the members, emitting
>> >  a warning to that effect.  This warning is enabled by @option{-Wall}.
>> > +
>> > +@item -Wreserved-user-defined-literal @r{(C++ and Objective-C++ only)}
>> > +@opindex Wreserved-u

Re: [google/integration] Extend C++11 UDLs to be compatible with inttypes.h macros (issue6104051)

2012-04-22 Thread Ollie Wild
Okay, I'll send out a trunk patch for review now, too.

Ollie

On Sun, Apr 22, 2012 at 10:29 PM, Jeffrey Yasskin  wrote:
>
> Let's let the discussion _start_ before assuming it'll be protracted.
> ;) I don't think it'll kill us to run the next round of testing in
> C++98 mode. If the patch doesn't look close to acceptance in a couple
> days, I think it'll make sense to put the then-current version into
> the google branches while people are agreeing about what to do in the
> long run.
>
> On Sun, Apr 22, 2012 at 8:14 PM, Ollie Wild  wrote:
> > I'd like to get this into the google branches first because this is
> > blocking
> > testing.
> >
> > I fully expect this to result in some protracted discussion before it
> > can be
> > accepted into trunk.
> >
> > Ollie
> >
> >
> > On Sun, Apr 22, 2012 at 10:10 PM, Jeffrey Yasskin 
> > wrote:
> >>
> >> Could you try to get this into mainline instead of just the google
> >> branches? In http://gcc.gnu.org/PR52538, Jonathan sounded like he'd
> >> consider accepting it.
> >>
> >> On Sun, Apr 22, 2012 at 7:54 PM, Ollie Wild  wrote:
> >> > Add new option, -Wreserved-user-defined-literal.
> >> >
> >> > This option, which is enabled by default, causes the preprocessor to
> >> > warn
> >> > when a string or character literal is followed by a ud-suffix which
> >> > does
> >> > not begin with an underscore.  According to [lex.ext]p10, this is
> >> > ill-formed.
> >> >
> >> > Also modifies the preprocessor to treat such ill-formed suffixes as
> >> > separate
> >> > preprocessing tokens.  This is consistent with the Clang front end
> >> > (see
> >> > http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and
> >> > enables
> >> > backwards compatibility with code that uses formatting macros from
> >> > , as in the following code block:
> >> >
> >> >  int main() {
> >> >    int64_t i64 = 123;
> >> >    printf("My int64: %"PRId64"\n", i64);
> >> >  }
> >> >
> >> > Google ref b/6377711.
> >> >
> >> > 2012-04-22   Ollie Wild  
> >> >
> >> >        * gcc/c-family/c-common.c:
> >> >        * gcc/c-family/c-opts.c (c_common_handle_option):
> >> >        * gcc/c-family/c.opt:
> >> >        * gcc/doc/invoke.texi (struct A):
> >> >        * gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
> >> > (test):
> >> >        (main):
> >> >        * libcpp/include/cpplib.h (struct cpp_options):
> >> >        * libcpp/init.c (cpp_create_reader):
> >> >        * libcpp/lex.c (lex_raw_string):
> >> >        (lex_string):
> >> >
> >> > diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
> >> > index 1d19251..915dc25 100644
> >> > --- a/gcc/c-family/c-common.c
> >> > +++ b/gcc/c-family/c-common.c
> >> > @@ -8724,6 +8724,7 @@ static const struct reason_option_codes_t
> >> > option_codes[] = {
> >> >   {CPP_W_NORMALIZE,                    OPT_Wnormalized_},
> >> >   {CPP_W_INVALID_PCH,                  OPT_Winvalid_pch},
> >> >   {CPP_W_WARNING_DIRECTIVE,            OPT_Wcpp},
> >> > +  {CPP_W_RESERVED_USER_LITERALS,
> >> > OPT_Wreserved_user_defined_literal},
> >> >   {CPP_W_NONE,                         0}
> >> >  };
> >> >
> >> > diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
> >> > index 5118928..dab6ce5 100644
> >> > --- a/gcc/c-family/c-opts.c
> >> > +++ b/gcc/c-family/c-opts.c
> >> > @@ -509,6 +509,10 @@ c_common_handle_option (size_t scode, const char
> >> > *arg, int value,
> >> >          break;
> >> >        }
> >> >
> >> > +    case OPT_Wreserved_user_defined_literal:
> >> > +      cpp_opts->warn_reserved_user_literals = value;
> >> > +      break;
> >> > +
> >> >     case OPT_Wreturn_type:
> >> >       warn_return_type = value;
> >> >       break;
> >> > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
> >> > index 40ff96c..f610513 100644
> >> > --- a/gcc/c-family/c.opt
> >> > +++ b/gcc/c-family/c.opt
> >> > @@ -589,6 +589,10 @@ Wreorder
> >> >  C++ ObjC++ Var(warn_reorder) Warning
> >> >  Warn when the compiler reorders code
> >> >
> >> > +Wreserved-user-defined-literal
> >> > +C++ ObjC++ Warning
> >> > +Warn when a string or character literal is followed by a ud-suffix
> >> > which does not begin with an underscore.
> >> > +
> >> >  Wreturn-type
> >> >  C ObjC C++ ObjC++ Var(warn_return_type) Warning
> >> >  Warn whenever a function's return type defaults to \"int\" (C), or
> >> > about inconsistent return types (C++)
> >> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> >> > index 1b61e76..d425079 100644
> >> > --- a/gcc/doc/invoke.texi
> >> > +++ b/gcc/doc/invoke.texi
> >> > @@ -198,7 +198,7 @@ in the following sections.
> >> >  -fvisibility-ms-compat @gol
> >> >  -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
> >> >  -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
> >> > --Wnon-virtual-dtor  -Wreorder @gol
> >> > +-Wnon-virtual-dtor  -Wreorder -Wreserved-user-defined-literal @gol
> >> >  -Weffc++  -Wstrict-null-sentinel @gol
> >> >  -Wno-non-template-friend  -Wold-style-cast @gol
> >> >  -Woverloaded-virtual  -Wno-pmf-c

Re: [google/integration] Extend C++11 UDLs to be compatible with inttypes.h macros (issue6104051)

2012-04-22 Thread Jeffrey Yasskin
Thanks!

On Sun, Apr 22, 2012 at 8:32 PM, Ollie Wild  wrote:
> Okay, I'll send out a trunk patch for review now, too.
>
> Ollie
>
> On Sun, Apr 22, 2012 at 10:29 PM, Jeffrey Yasskin  wrote:
>>
>> Let's let the discussion _start_ before assuming it'll be protracted.
>> ;) I don't think it'll kill us to run the next round of testing in
>> C++98 mode. If the patch doesn't look close to acceptance in a couple
>> days, I think it'll make sense to put the then-current version into
>> the google branches while people are agreeing about what to do in the
>> long run.
>>
>> On Sun, Apr 22, 2012 at 8:14 PM, Ollie Wild  wrote:
>> > I'd like to get this into the google branches first because this is
>> > blocking
>> > testing.
>> >
>> > I fully expect this to result in some protracted discussion before it
>> > can be
>> > accepted into trunk.
>> >
>> > Ollie
>> >
>> >
>> > On Sun, Apr 22, 2012 at 10:10 PM, Jeffrey Yasskin 
>> > wrote:
>> >>
>> >> Could you try to get this into mainline instead of just the google
>> >> branches? In http://gcc.gnu.org/PR52538, Jonathan sounded like he'd
>> >> consider accepting it.
>> >>
>> >> On Sun, Apr 22, 2012 at 7:54 PM, Ollie Wild  wrote:
>> >> > Add new option, -Wreserved-user-defined-literal.
>> >> >
>> >> > This option, which is enabled by default, causes the preprocessor to
>> >> > warn
>> >> > when a string or character literal is followed by a ud-suffix which
>> >> > does
>> >> > not begin with an underscore.  According to [lex.ext]p10, this is
>> >> > ill-formed.
>> >> >
>> >> > Also modifies the preprocessor to treat such ill-formed suffixes as
>> >> > separate
>> >> > preprocessing tokens.  This is consistent with the Clang front end
>> >> > (see
>> >> > http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and
>> >> > enables
>> >> > backwards compatibility with code that uses formatting macros from
>> >> > , as in the following code block:
>> >> >
>> >> >  int main() {
>> >> >    int64_t i64 = 123;
>> >> >    printf("My int64: %"PRId64"\n", i64);
>> >> >  }
>> >> >
>> >> > Google ref b/6377711.
>> >> >
>> >> > 2012-04-22   Ollie Wild  
>> >> >
>> >> >        * gcc/c-family/c-common.c:
>> >> >        * gcc/c-family/c-opts.c (c_common_handle_option):
>> >> >        * gcc/c-family/c.opt:
>> >> >        * gcc/doc/invoke.texi (struct A):
>> >> >        * gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
>> >> > (test):
>> >> >        (main):
>> >> >        * libcpp/include/cpplib.h (struct cpp_options):
>> >> >        * libcpp/init.c (cpp_create_reader):
>> >> >        * libcpp/lex.c (lex_raw_string):
>> >> >        (lex_string):
>> >> >
>> >> > diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
>> >> > index 1d19251..915dc25 100644
>> >> > --- a/gcc/c-family/c-common.c
>> >> > +++ b/gcc/c-family/c-common.c
>> >> > @@ -8724,6 +8724,7 @@ static const struct reason_option_codes_t
>> >> > option_codes[] = {
>> >> >   {CPP_W_NORMALIZE,                    OPT_Wnormalized_},
>> >> >   {CPP_W_INVALID_PCH,                  OPT_Winvalid_pch},
>> >> >   {CPP_W_WARNING_DIRECTIVE,            OPT_Wcpp},
>> >> > +  {CPP_W_RESERVED_USER_LITERALS,
>> >> > OPT_Wreserved_user_defined_literal},
>> >> >   {CPP_W_NONE,                         0}
>> >> >  };
>> >> >
>> >> > diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
>> >> > index 5118928..dab6ce5 100644
>> >> > --- a/gcc/c-family/c-opts.c
>> >> > +++ b/gcc/c-family/c-opts.c
>> >> > @@ -509,6 +509,10 @@ c_common_handle_option (size_t scode, const char
>> >> > *arg, int value,
>> >> >          break;
>> >> >        }
>> >> >
>> >> > +    case OPT_Wreserved_user_defined_literal:
>> >> > +      cpp_opts->warn_reserved_user_literals = value;
>> >> > +      break;
>> >> > +
>> >> >     case OPT_Wreturn_type:
>> >> >       warn_return_type = value;
>> >> >       break;
>> >> > diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
>> >> > index 40ff96c..f610513 100644
>> >> > --- a/gcc/c-family/c.opt
>> >> > +++ b/gcc/c-family/c.opt
>> >> > @@ -589,6 +589,10 @@ Wreorder
>> >> >  C++ ObjC++ Var(warn_reorder) Warning
>> >> >  Warn when the compiler reorders code
>> >> >
>> >> > +Wreserved-user-defined-literal
>> >> > +C++ ObjC++ Warning
>> >> > +Warn when a string or character literal is followed by a ud-suffix
>> >> > which does not begin with an underscore.
>> >> > +
>> >> >  Wreturn-type
>> >> >  C ObjC C++ ObjC++ Var(warn_return_type) Warning
>> >> >  Warn whenever a function's return type defaults to \"int\" (C), or
>> >> > about inconsistent return types (C++)
>> >> > diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
>> >> > index 1b61e76..d425079 100644
>> >> > --- a/gcc/doc/invoke.texi
>> >> > +++ b/gcc/doc/invoke.texi
>> >> > @@ -198,7 +198,7 @@ in the following sections.
>> >> >  -fvisibility-ms-compat @gol
>> >> >  -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
>> >> >  -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
>> >> > --Wnon-virtual-dtor  -Wreorder @gol
>> >> > +-Wnon-virtual-dt

PR c++/52538 Extend C++11 UDLs to be compatible with inttypes.h macros (issue6109043)

2012-04-22 Thread Ollie Wild
Add new option, -Wreserved-user-defined-literal.

This option, which is enabled by default, causes the preprocessor to warn
when a string or character literal is followed by a ud-suffix which does
not begin with an underscore.  According to [lex.ext]p10, this is
ill-formed.

Also modifies the preprocessor to treat such ill-formed suffixes as separate
preprocessing tokens.  This is consistent with the Clang front end (see
http://llvm.org/viewvc/llvm-project?view=rev&revision=152287), and enables
backwards compatibility with code that uses formatting macros from
, as in the following code block:

  int main() {
int64_t i64 = 123;
printf("My int64: %"PRId64"\n", i64);
  }

Tested via bootstrap + test.

Okay for trunk?

Thanks,
Ollie


2012-04-22   Ollie Wild  

* gcc/c-family/c-common.c:
* gcc/c-family/c-opts.c (c_common_handle_option):
* gcc/c-family/c.opt:
* gcc/doc/invoke.texi (struct A):
* gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C (test):
(main):
* libcpp/include/cpplib.h (struct cpp_options):
* libcpp/init.c (cpp_create_reader):
* libcpp/lex.c (lex_raw_string):
(lex_string):

diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 4eacd19..f79020c 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8820,6 +8820,7 @@ static const struct reason_option_codes_t option_codes[] 
= {
   {CPP_W_NORMALIZE,OPT_Wnormalized_},
   {CPP_W_INVALID_PCH,  OPT_Winvalid_pch},
   {CPP_W_WARNING_DIRECTIVE,OPT_Wcpp},
+  {CPP_W_RESERVED_USER_LITERALS,   OPT_Wreserved_user_defined_literal},
   {CPP_W_NONE, 0}
 };
 
diff --git a/gcc/c-family/c-opts.c b/gcc/c-family/c-opts.c
index 17e1958..a812762 100644
--- a/gcc/c-family/c-opts.c
+++ b/gcc/c-family/c-opts.c
@@ -510,6 +510,10 @@ c_common_handle_option (size_t scode, const char *arg, int 
value,
  break;
}
 
+case OPT_Wreserved_user_defined_literal:
+  cpp_opts->warn_reserved_user_literals = value;
+  break;
+
 case OPT_Wreturn_type:
   warn_return_type = value;
   break;
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index d8c944d..c8a0c84 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -593,6 +593,10 @@ Wreorder
 C++ ObjC++ Var(warn_reorder) Warning
 Warn when the compiler reorders code
 
+Wreserved-user-defined-literal
+C++ ObjC++ Warning
+Warn when a string or character literal is followed by a ud-suffix which does 
not begin with an underscore.
+
 Wreturn-type
 C ObjC C++ ObjC++ Var(warn_return_type) Warning
 Warn whenever a function's return type defaults to \"int\" (C), or about 
inconsistent return types (C++)
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 8ca2f4e..ddf0fc6 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -199,7 +199,7 @@ in the following sections.
 -fvisibility-ms-compat @gol
 -Wabi  -Wconversion-null  -Wctor-dtor-privacy @gol
 -Wdelete-non-virtual-dtor -Wnarrowing -Wnoexcept @gol
--Wnon-virtual-dtor  -Wreorder @gol
+-Wnon-virtual-dtor  -Wreorder -Wreserved-user-defined-literal @gol
 -Weffc++  -Wstrict-null-sentinel @gol
 -Wno-non-template-friend  -Wold-style-cast @gol
 -Woverloaded-virtual  -Wno-pmf-conversions @gol
@@ -2478,6 +2478,30 @@ struct A @{
 The compiler rearranges the member initializers for @samp{i}
 and @samp{j} to match the declaration order of the members, emitting
 a warning to that effect.  This warning is enabled by @option{-Wall}.
+
+@item -Wreserved-user-defined-literal @r{(C++ and Objective-C++ only)}
+@opindex Wreserved-user-defined-literal
+@opindex Wno-reserved-user-defined-literal
+Warn when a string or character literal is followed by a ud-suffix which does
+not begin with an underscore.  As a conforming extension, GCC treats such
+suffixes as separate preprocessing tokens in order to maintain backwards
+compatibility with code that uses formatting macros from @code{}.
+For example:
+
+@smallexample
+#define __STDC_FORMAT_MACROS
+#include 
+#include 
+
+int main() @{
+  int64_t i64 = 123;
+  printf("My int64: %"PRId64"\n", i64);
+@}
+@end smallexample
+
+In this case, @code{PRId64} is treated as a separate preprocessing token.
+
+This warning is enabled by default.
 @end table
 
 The following @option{-W@dots{}} options are not affected by @option{-Wall}.
diff --git a/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C 
b/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
new file mode 100644
index 000..66de5c0
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/Wreserved-user-defined-literal.C
@@ -0,0 +1,29 @@
+// { dg-do run }
+// { dg-options "-std=c++0x" }
+
+// Make sure -Wreserved-user-defined-literal is enabled by default and
+// triggers as expected.
+
+#define BAR "bar"
+#define PLUS_ONE + 1
+
+#include 
+#include 
+
+
+void
+test()
+{
+  char c = '3'PLUS_ONE;  // { dg-warning "invalid suffix on literal

Re: [patch][google/integration] Don't force tls-model to initial-exec when building libgomp (issue6107046)

2012-04-22 Thread Andrew Pinski
On Sun, Apr 22, 2012 at 10:50 AM, Paul Pluzhnikov
 wrote:
> Greetings,
>
> The patch below is needed for google/integration branch:
> we want to be able build libgomp.a with -fPIC, be able to link it into a
> shared library, and be able to dlopen that library without running out of
> static TLS space (-ftls-model=initial-exec precludes that last part).

Do you understand the reason why it was made -ftls-model=initial-exec
in the first place?
IIRC the main reason is because the slow down from not using
initial-exec model for GOMP is a lot.

Thanks,
Andrew Pinski


> Google ref b/6368405
> Google ref b/6156799
>
> Tested: make && make check
>
>
> 2012-04-22   Paul Pluzhnikov  
>
>        * libgomp/configure.tgt: Don't force initial-exec.
>
> Index: libgomp/configure.tgt
> ===
> --- libgomp/configure.tgt       (revision 186636)
> +++ libgomp/configure.tgt       (working copy)
> @@ -10,16 +10,6 @@
>  #  XCFLAGS             Add extra compile flags to use.
>  #  XLDFLAGS            Add extra link flags to use.
>
> -# Optimize TLS usage by avoiding the overhead of dynamic allocation.
> -if test $gcc_cv_have_tls = yes ; then
> -  case "${target}" in
> -
> -    *-*-linux*)
> -       XCFLAGS="${XCFLAGS} -ftls-model=initial-exec"
> -       ;;
> -  esac
> -fi
> -
>  # Since we require POSIX threads, assume a POSIX system by default.
>  config_path="posix"
>
>
> --
> This patch is available for review at http://codereview.appspot.com/6107046


Re: [patch][google/integration] Don't force tls-model to initial-exec when building libgomp (issue6107046)

2012-04-22 Thread Jakub Jelinek
On Sun, Apr 22, 2012 at 10:09:46PM -0700, Andrew Pinski wrote:
> On Sun, Apr 22, 2012 at 10:50 AM, Paul Pluzhnikov
>  wrote:
> > Greetings,
> >
> > The patch below is needed for google/integration branch:
> > we want to be able build libgomp.a with -fPIC, be able to link it into a
> > shared library, and be able to dlopen that library without running out of
> > static TLS space (-ftls-model=initial-exec precludes that last part).
> 
> Do you understand the reason why it was made -ftls-model=initial-exec
> in the first place?
> IIRC the main reason is because the slow down from not using
> initial-exec model for GOMP is a lot.

Yes, the reason is that initial-exec is much faster than global-exec.

Jakub


Re: [patch][google/integration] Don't force tls-model to initial-exec when building libgomp (issue6107046)

2012-04-22 Thread Paul Pluzhnikov
On Sun, Apr 22, 2012 at 10:09 PM, Andrew Pinski  wrote:

> IIRC the main reason is because the slow down from not using
> initial-exec model for GOMP is a lot.

Given a choice between "slows down a lot" and "doesn't work at all",
we prefer the former ;-)

I see that we are not alone:
http://old.nabble.com/-patch--libgomp%3A-removing-nodlopen-flag-for-portability-td10286039.html

Generally we don't use OpenMP, but some of our third-party libraries
do depend on it.

Thanks for the heads-up.
-- 
Paul Pluzhnikov