Re: [Olena-patches] 694: Add spaces in macros to please icpc.

On 2006-11-03, Roland Levillain <roland@lrde.epita.fr> wrote:
Roland Levillain <roland@lrde.epita.fr> writes:
https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr>
Add spaces in macros to please icpc. * mlc/is_a.hh, mlc/case.hh: Add spaces in macros to please icpc.
0 files changed
Index: mlc/is_a.hh Index: mlc/case.hh
Sorry for this ``blank'' patch, but Vcs removes any white space in altered lines in diffs.
BTW, is there an option to disable this behavior in Vcs? If not, I suggest adding an option like `--show-space-change' (i.e., the opposite from diff's --ignore-space-change).
Or simply when the diff is empty, diff it again without removing white spaces and stuff.
Here is a more readable diff:
LOL.
Index: mlc/is_a.hh =================================================================== --- mlc/is_a.hh (révision 693) +++ mlc/is_a.hh (révision 694) @@ -240,11 +240,11 @@
# define mlc_is_a(T, U) \ mlc::wrap_< \ - typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< typename mlc::basic_<T>::ret, U > \ + typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< typename mlc::basic_< T >::ret, U > \
# define mlc_is_a_(T, U) \ -mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< mlc::basic_<T>::ret, U > +mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< mlc::basic_< T >::ret, U >
[SNIP]
What's the problem with icpc? Why does it actually *need* whitespaces there? -- SIGOURE Benoit aka Tsuna (SUSv3 compliant) _____ "On a long enough timeline, the survival rate /EPITA\ Promo 2008.CSI/ACU for everyone drops to zero" -- Jack.

Tsuna <tsuna@warszawa.lrde.epita.fr> writes:
On 2006-11-03, Roland Levillain <roland@lrde.epita.fr> wrote:
Roland Levillain <roland@lrde.epita.fr> writes:
[...]
Index: mlc/is_a.hh =================================================================== --- mlc/is_a.hh (révision 693) +++ mlc/is_a.hh (révision 694) @@ -240,11 +240,11 @@
# define mlc_is_a(T, U) \ mlc::wrap_< \ - typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< typename mlc::basic_<T>::ret, U > \ + typename mlc::is_a_< sizeof(mlc::form::of< U >()) >::template ret< typename mlc::basic_< T >::ret, U > \
# define mlc_is_a_(T, U) \ -mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< mlc::basic_<T>::ret, U > +mlc::is_a_< sizeof(mlc::form::of< U >()) >::ret< mlc::basic_< T >::ret, U >
[SNIP]
What's the problem with icpc? Why does it actually *need* whitespaces there?
Indeed. % cat icpc-macro-issue.cc template <typename T> struct Foo { }; /* Icpc chokes when expanding this macro when T is a template type: T is substituted with no additional surrounding space, generating a token `>>'. G++ has no such problem, but I haven't checked which is the right behavior, required by the ISO standard. Note that this will no longer be a problem with C++ 0x, since expressions like `Foo<Foo<int>>' will be valid. */ #define foo(T) Foo<T> int main () { foo(Foo<int>) f; } % icpc -gcc-name=gcc-4.0 -o icpc-macro-issue icpc-macro-issue.cc icpc-macro-issue.cc(20): error: space required between adjacent ">" delimiters of nested template argument lists (">>" is the right shift operator) foo(Foo<int>) f; ^ compilation aborted for icpc-macro-issue.cc (code 2) % g++ -o icpc-macro-issue icpc-macro-issue.cc %

Tsuna <tsuna@warszawa.lrde.epita.fr> writes:
On 2006-11-03, Roland Levillain <roland@lrde.epita.fr> wrote:
Roland Levillain <roland@lrde.epita.fr> writes:
https://svn.lrde.epita.fr/svn/oln/trunk/metalic
Index: ChangeLog from Roland Levillain <roland@lrde.epita.fr>
Add spaces in macros to please icpc. * mlc/is_a.hh, mlc/case.hh: Add spaces in macros to please icpc.
0 files changed
Index: mlc/is_a.hh Index: mlc/case.hh
Sorry for this ``blank'' patch, but Vcs removes any white space in altered lines in diffs.
BTW, is there an option to disable this behavior in Vcs? If not, I suggest adding an option like `--show-space-change' (i.e., the opposite from diff's --ignore-space-change).
Or simply when the diff is empty, diff it again without removing white spaces and stuff.
The choice of displaying whitespace changes or not must be left to the user, even if there's a default behavior (not to show them, in the current case). And the problem is even bigger: think of Python files, where indentation matters. For this case, Vcs or svn-wrapper could use libmagic (i.e., `file') to check the type of the file(s), and adjust its behavior. P.S.: BTW, I suspect `file -i' of being buggy on Debian: brasilia ~ % file ~/src/tc/dev/ast-nodes-gen 19:12 #210 /home/levill_r/src/tc/dev/ast-nodes-gen: a python script text executable brasilia ~ % file -i ~/src/tc/dev/ast-nodes-gen 19:12 #211 /home/levill_r/src/tc/dev/ast-nodes-gen: text/x-java; charset=us-ascii :) (Micha just said to me he observed a similar behavior on Gentoo...)
participants (2)
-
Roland Levillain
-
Tsuna