1ef8225444452a1486bd721f3285301fe84643b00Stephen Hines// RUN: %clang_cc1 -verify -fopenmp=libiomp5 -ferror-limit 100 %s 2ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 3ef8225444452a1486bd721f3285301fe84643b00Stephen Hinesvoid foo() { 4ef8225444452a1486bd721f3285301fe84643b00Stephen Hines} 5ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 6ef8225444452a1486bd721f3285301fe84643b00Stephen Hinesbool foobool(int argc) { 7ef8225444452a1486bd721f3285301fe84643b00Stephen Hines return argc; 8ef8225444452a1486bd721f3285301fe84643b00Stephen Hines} 9ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 10ef8225444452a1486bd721f3285301fe84643b00Stephen Hinesstruct S1; // expected-note {{declared here}} 11ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 12ef8225444452a1486bd721f3285301fe84643b00Stephen Hinestemplate <class T, typename S, int N> // expected-note {{declared here}} 13ef8225444452a1486bd721f3285301fe84643b00Stephen HinesT tmain(T argc, S **argv) { 14ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads // expected-error {{expected '(' after 'num_threads'}} 15ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 16ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 17ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 18ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads () // expected-error {{expected expression}} 19ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 20ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 21ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 22ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} 23ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 24ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads ((argc > 0) ? argv[1] : argv[2]) // expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} 25ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 26ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel sections' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} 27ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 28ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (S) // expected-error {{'S' does not refer to a value}} 29ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 30ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} 31ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 32ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argc) 33ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 34ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (N) // expected-error {{argument to 'num_threads' clause must be a positive integer value}} 35ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 36ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 37ef8225444452a1486bd721f3285301fe84643b00Stephen Hines return argc; 38ef8225444452a1486bd721f3285301fe84643b00Stephen Hines} 39ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 40ef8225444452a1486bd721f3285301fe84643b00Stephen Hinesint main(int argc, char **argv) { 41ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads // expected-error {{expected '(' after 'num_threads'}} 42ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 43ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 44ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 45ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads () // expected-error {{expected expression}} 46ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 47ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 48ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 49ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}} 50ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 51ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argc > 0 ? argv[1] : argv[2]) // expected-error {{integral }} 52ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 53ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (foobool(argc)), num_threads (true), num_threads (-5) // expected-error 2 {{directive '#pragma omp parallel sections' cannot contain more than one 'num_threads' clause}} expected-error {{argument to 'num_threads' clause must be a positive integer value}} 54ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 55ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (S1) // expected-error {{'S1' does not refer to a value}} 56ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 57ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error {{expression must have integral or unscoped enumeration type, not 'char *'}} 58ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 59ef8225444452a1486bd721f3285301fe84643b00Stephen Hines #pragma omp parallel sections num_threads (num_threads(tmain<int, char, -1>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} expected-note {{in instantiation of function template specialization 'tmain<int, char, -1>' requested here}} 60ef8225444452a1486bd721f3285301fe84643b00Stephen Hines {foo();} 61ef8225444452a1486bd721f3285301fe84643b00Stephen Hines 62ef8225444452a1486bd721f3285301fe84643b00Stephen Hines return tmain<int, char, 3>(argc, argv); // expected-note {{in instantiation of function template specialization 'tmain<int, char, 3>' requested here}} 63ef8225444452a1486bd721f3285301fe84643b00Stephen Hines} 64