FOC/L4RE: Upstream revision 47

This commit is contained in:
Sebastian Sumpf
2013-02-20 12:17:17 +01:00
parent 34af60da11
commit b22db346c8
127 changed files with 1856 additions and 1965 deletions

View File

@@ -734,7 +734,8 @@ sub parse_file
}
# Member function definition?
if (/^([^\{\(]*?) # pretext, maybe w template decl tag
# if (/^([^\{\(]*?) # pretext, maybe w template decl tag
if (/^((?:[^\{\(]|\(\()*?) # pretext, maybe w template decl tag
\b ($identifier (?: $s :: $s $identifier)*) # class name
($s $template_arg)? # optional class-template args
$s :: $s
@@ -745,7 +746,7 @@ sub parse_file
{
my ($pretext, $class, $templateargs, $name, $args, $posttext)
= ($1, $2, (defined $3 ? $3 : ''), $4, $5, $6);
#print "P<$pretext> C<$class> T<$templateargs> N<$name> A<$args> P<$posttext>\n";
#print "Member: P<$pretext> C<$class> T<$templateargs> N<$name> A<$args> P<$posttext>\n";
# Canonify operator names
$name =~ s/(?<=\w)(?:$s_once)+(?=\W)//gs;
$name =~ s/(?<=\W)(?:$s_once)+(?=\w)//gs;
@@ -769,6 +770,7 @@ sub parse_file
$s( \( $paren_expr \) [^:\{\(\)=]*) # arg list
(\{.*)$/sx) # body
{
#print "Free function: $2 T(" . (defined $3 ? $3 : "") . ") PRE($1) ARGS($4) POST($5)\n";
my $function = { class => '',
name => $2,
templateargs => (defined $3
@@ -869,7 +871,7 @@ sub read_more () # Read one more line of code. Stow away
s/\003/$saved/s;
}
while (s|(//(?!-\s*\n).*)$|\001$number\001|m) # Do not match magic "//-"
while (s|(//(?!-\s*\n).*\n)|\001$number\001|m) # Do not match magic "//-"
{ # The \001 signifies whitespace.
push @comments, $1;
$number++;
@@ -1145,7 +1147,6 @@ sub handle_function
if ($match =~ /^(?:${s}template$s<${s}>)+${s}$/s);
$func->{pretext} =~ s/\Q$match//s;
# $func->{pretext} =~ s|$template[ \t]*||s;
next;
}

View File

@@ -13,7 +13,7 @@ TOOL_TESTS = mapping mapping_inline random random_inline extern_c static \
parser parser_noinline \
multifile variable line line_not line_nh interface comment_in_string \
default_args drop_single1 drop_single2 drop_single3 drop_multi1 \
drop_multi2
drop_multi2 implement_template
mapping_inline_src = mapping
mapping_inline_flags = -i

View File

@@ -0,0 +1,31 @@
INTERFACE:
template< typename T >
class Test
{
public:
void test_func();
};
IMPLEMENTATION:
IMPLEMENT
template< typename T >
// comment
void __attribute__((deprecated))
Test<T>::test_func()
{
}
PUBLIC
template< typename T > // comment 1
template<
typename X, // comment within template args list
typename X2 // another comment in tl args
>
// comment 2
void __attribute__((deprecated))
Test<T>::test_func2<X, X2>()
{
}

View File

@@ -0,0 +1,5 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#include "implement_template.h"
#include "implement_template_i.h"

View File

@@ -0,0 +1,58 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef implement_template_h
#define implement_template_h
//
// INTERFACE definition follows
//
#line 2 "implement_template.cpp"
template< typename T >
class Test
{
public:
void test_func();
public:
#line 23 "implement_template.cpp"
// comment 2
// comment 1
template<
typename X, // comment within template args list
typename X2 // another comment in tl args
> void __attribute__((deprecated))
test_func2<X,X2>();
};
//
// IMPLEMENTATION of function templates
//
#line 12 "implement_template.cpp"
// comment
template< typename T > void __attribute__((deprecated))
Test<T>::test_func()
{
}
#line 20 "implement_template.cpp"
// comment 2
// comment 1
template< typename T > template<
typename X, // comment within template args list
typename X2 // another comment in tl args
> void __attribute__((deprecated))
Test<T>::test_func2<X,X2>()
{
}
#endif // implement_template_h

View File

@@ -0,0 +1,6 @@
// AUTOMATICALLY GENERATED -- DO NOT EDIT! -*- c++ -*-
#ifndef implement_template_i_h
#define implement_template_i_h
#endif // implement_template_i_h

View File

@@ -15,6 +15,7 @@ class Foo
public:
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
static void func1();
};

View File

@@ -8,6 +8,7 @@
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
void
Foo::func1()
{

View File

@@ -15,6 +15,7 @@ class Foo
public:
// A long, multiline comment in front of this function definition.
// Also, a lot of specifiers that need to be handled.
static void func1();
};

View File

@@ -17,17 +17,21 @@ public:
void *
operator new(size_t); // funny comment
#line 16 "operator.cpp"
Foo&
operator+(const Foo&); // funny comment
#line 22 "operator.cpp"
Foo&
operator=(const Foo&); // funny comment
#line 28 "operator.cpp"
Foo&
operator*(const Foo&); // funny comment
};
#line 34 "operator.cpp"

View File

@@ -12,13 +12,3 @@ create_stack<int>()
{
return new stack<int>();
}
#line 192 "template.cpp"
template <> stack_t<bool>*
create_stack<bool>()
{
return new stack<bool>();
}

View File

@@ -109,9 +109,24 @@ template <> stack_t<int>*
create_stack();
#line 195 "template.cpp"
template <> stack_t<bool>*
template <> inline stack_t<bool>*
create_stack();
//
// IMPLEMENTATION of inline functions (and needed classes)
//
#line 192 "template.cpp"
template <> inline stack_t<bool>*
create_stack<bool>()
{
return new stack<bool>();
}
//
// IMPLEMENTATION of function templates
//