1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
/*
* This file is part of the Score-P software (http://www.score-p.org)
*
* Copyright (c) 2009-2011,
* RWTH Aachen University, Germany
* Gesellschaft fuer numerische Simulation mbH Braunschweig, Germany
* Technische Universitaet Dresden, Germany
* University of Oregon, Eugene, USA
* Forschungszentrum Juelich GmbH, Germany
* German Research School for Simulation Sciences GmbH, Juelich/Aachen, Germany
* Technische Universitaet Muenchen, Germany
*
* See the COPYING file in the package base directory for details.
*
* Testfile for automated testing of OPARI2
*
*
* @brief Test the parsers ability to find directives and filter strings and comments.
*/
#include <stdio.h>
#ifdef _OPENMP
#include <omp.h> //just testing
#endif
int main() {
printf("before...\n");
//************************************************
//* The following pragmas should be instrumented *
//************************************************
#pragma omp parallel
{{
printf("parallel 1...\n");
}} //end
# /*complicated*/ pragma \
omp \
/*more*/ parallel
{
printf("parallel 2...\n");
}
//*************************************************
//* The treatment of else blocks doesn't work yet *
//*************************************************
/* #pragma omp parallel */
/* if ( omp_get_thread_num() == 0 ) */
/* { */
/* printf("parallel 3 thread 0 ...\n"); */
/* } */
/* else */
/* { */
/* printf("parallel 3 other threads ...\n"); */
/* } */
/* #pragma omp parallel */
/* if ( omp_get_thread_num() == 0 ) */
/* printf("parallel 4 thread 0 ...\n"); */
/* else */
/* printf("parallel 4 other threads ...\n"); */
/* #pragma omp parallel */
/* if ( omp_get_thread_num() == 0 ) printf("parallel 5 thread 0 ...\n"); */
/* else printf("parallel 5 other threads ...\n"); */
/* #pragma omp parallel */
/* if ( omp_get_thread_num() == 0 ) printf("parallel 6 thread 0 ...\n"); else printf("parallel 6 other threads ...\n"); */
//**************************************
//* The following should be ignored *
//**************************************
//#pragma omp parallel
{
//printf("parallel 1...\n");
}
/*
#pragma omp parallel
{
printf("parallel 1...\n");
}
*/
{
printf("#pragma omp parallel");
// printf("#pragma omp parallel");
/* printf("#pragma omp parallel");*/
/*
printf("#pragma omp parallel");
*/
printf("\" and continuation \
in the next line #pragma omp parallel\" \
and especially strange escape character usage\\
n");
}
printf("after...\n");
//**********************************************
//* Tests for the string parsing part of opari.*
//**********************************************
printf("");
printf("\\");
printf("\\\\");
printf("\\\"");
printf("\"\"");
}
|