cdt/cdt_6_0_x/org.eclipse.cdt.ui.tests/resources/folding/FoldingTest.cpp
author dadubrow
Thu, 05 Aug 2010 13:18:02 -0500
changeset 145 d9692fb089a1
parent 37 c2bce6dd59e7
permissions -rw-r--r--
not shipping pulsar plugins
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
37
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     1
/*
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     2
 * header comment
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     3
 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     4
#define ONE
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     5
#define MULTI_LINE_MACRO(x) \
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     6
    if (DBG) { \
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     7
    	printf(x); \
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     8
    }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
     9
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    10
#if 0
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    11
# if 1
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    12
 //
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    13
# endif
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    14
#elif X
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    15
// X
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    16
#else
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    17
# if ONE
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    18
#  if 0
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    19
#   if 1
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    20
 //
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    21
#   endif
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    22
#  else
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    23
#   if 1
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    24
 //
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    25
#   endif
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    26
#  endif
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    27
# endif
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    28
#endif
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    29
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    30
/*
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    31
 * comment
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    32
 */
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    33
int y;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    34
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    35
#if 1
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    36
int func() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    37
#else
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    38
int func2() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    39
#endif
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    40
	return 0;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    41
}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    42
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    43
// multiple single line comments
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    44
// multiple single line comments
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    45
// multiple single line comments
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    46
// multiple single line comments
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    47
// multiple single line comments
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    48
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    49
class Class {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    50
public:
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    51
	int pubField;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    52
    static int staticPubMethod(int arg) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    53
        return 0;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    54
    }
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    55
    int pubMethod();
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    56
};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    57
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    58
int Class::pubMethod() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    59
	return pubField;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    60
}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    61
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    62
struct CppStruct {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    63
    int structField;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    64
};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    65
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    66
union CppUnion {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    67
    int unionField;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    68
};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    69
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    70
// http://bugs.eclipse.org/214590
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    71
int
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    72
main(int argc,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    73
     char *argv[])
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    74
{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    75
	int MyI = 0,j = 0;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    76
	if (0==0) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    77
		puts("Wow ");
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    78
	} else {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    79
		j = j;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    80
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    81
	for (MyI = 0; MyI < 10; ++MyI) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    82
		printf("%d\n",MyI);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    83
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    84
	while (0) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    85
		puts("nothinghere");
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    86
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    87
	switch (1) {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    88
		case 1:
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    89
			puts("ab");
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    90
			break;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    91
		case 2:
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    92
			puts("cd");
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    93
		default:
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    94
			puts("xy");
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    95
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    96
	do {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    97
		puts("tryagain");
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    98
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
    99
	} while (0);
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   100
	if (MyI==0) 
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   101
	{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   102
		return 1;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   103
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   104
    return 0;
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   105
}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   106
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   107
enum E {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   108
    e1,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   109
    e2,
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   110
    e3
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   111
};
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   112
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   113
// http://bugs.eclipse.org/248613
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   114
jungle::Monkey_ptr
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   115
jungle::MonkeyImpl::
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   116
Initialize()
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   117
{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   118
}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   119
// http://bugs.eclipse.org/248716
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   120
void foo() {
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   121
	if (1
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   122
			&& 2)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   123
	{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   124
	} else if (3
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   125
			|| 4)
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   126
	{
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   127
	}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   128
}
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   129
// http://bugs.eclipse.org/255018
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   130
#if 0
c2bce6dd59e7 add cdt_6_0_x
cawthron
parents:
diff changeset
   131
// #endif missing