Skip to content
Snippets Groups Projects
  • Jakub Jelinek's avatar
    0d973c0a
    openmp: Implement the error directive · 0d973c0a
    Jakub Jelinek authored
    This patch implements the error directive.  Depending on clauses it is either
    a compile time diagnostics (in that case diagnosed right away) or runtime
    diagnostics (libgomp API call that diagnoses at runtime), and either fatal
    or warning (error or warning at compile time or fatal error vs. error at
    runtime) and either has no message or user supplied message (this kind of
    e.g. deprecated attribute).  The directive is also stand-alone directive
    when at runtime while utility (thus disappears from the IL as if it wasn't
    there for parsing like nothing directive) at compile time.
    
    There are some clarifications in the works ATM, so this patch doesn't yet
    require that for compile time diagnostics the user message must be a constant
    string literal, there are uncertainities on what exactly is valid argument
    of message clause (whether just const char * type, convertible to const char *,
    qualified/unqualified const char * or char * or what else) and what to do
    in templates.  Currently even in templates it is diagnosed right away for
    compile time diagnostics, if we'll need to substitute it, we'd need to queue
    something into the IL, have pt.c handle it and diagnose only later.
    
    2021-08-20  Jakub Jelinek  <jakub@redhat.com>
    
    gcc/
    	* omp-builtins.def (BUILT_IN_GOMP_WARNING, BUILT_IN_GOMP_ERROR): New
    	builtins.
    gcc/c-family/
    	* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ERROR.
    	* c-pragma.c (omp_pragmas): Add error directive.
    	* c-omp.c (omp_directives): Uncomment error directive entry.
    gcc/c/
    	* c-parser.c (c_parser_omp_error): New function.
    	(c_parser_pragma): Handle PRAGMA_OMP_ERROR.
    gcc/cp/
    	* parser.c (cp_parser_handle_statement_omp_attributes): Determine if
    	PRAGMA_OMP_ERROR directive is C_OMP_DIR_STANDALONE.
    	(cp_parser_omp_error): New function.
    	(cp_parser_pragma): Handle PRAGMA_OMP_ERROR.
    gcc/fortran/
    	* types.def (BT_FN_VOID_CONST_PTR_SIZE): New DEF_FUNCTION_TYPE_2.
    	* f95-lang.c (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST): Define.
    gcc/testsuite/
    	* c-c++-common/gomp/error-1.c: New test.
    	* c-c++-common/gomp/error-2.c: New test.
    	* c-c++-common/gomp/error-3.c: New test.
    	* g++.dg/gomp/attrs-1.C (bar): Add error directive test.
    	* g++.dg/gomp/attrs-2.C (bar): Add error directive test.
    	* g++.dg/gomp/attrs-13.C: New test.
    	* g++.dg/gomp/error-1.C: New test.
    libgomp/
    	* libgomp.map (GOMP_5.1): Add GOMP_error and GOMP_warning.
    	* libgomp_g.h (GOMP_warning, GOMP_error): Declare.
    	* error.c (GOMP_warning, GOMP_error): New functions.
    	* testsuite/libgomp.c-c++-common/error-1.c: New test.
    0d973c0a
    History
    openmp: Implement the error directive
    Jakub Jelinek authored
    This patch implements the error directive.  Depending on clauses it is either
    a compile time diagnostics (in that case diagnosed right away) or runtime
    diagnostics (libgomp API call that diagnoses at runtime), and either fatal
    or warning (error or warning at compile time or fatal error vs. error at
    runtime) and either has no message or user supplied message (this kind of
    e.g. deprecated attribute).  The directive is also stand-alone directive
    when at runtime while utility (thus disappears from the IL as if it wasn't
    there for parsing like nothing directive) at compile time.
    
    There are some clarifications in the works ATM, so this patch doesn't yet
    require that for compile time diagnostics the user message must be a constant
    string literal, there are uncertainities on what exactly is valid argument
    of message clause (whether just const char * type, convertible to const char *,
    qualified/unqualified const char * or char * or what else) and what to do
    in templates.  Currently even in templates it is diagnosed right away for
    compile time diagnostics, if we'll need to substitute it, we'd need to queue
    something into the IL, have pt.c handle it and diagnose only later.
    
    2021-08-20  Jakub Jelinek  <jakub@redhat.com>
    
    gcc/
    	* omp-builtins.def (BUILT_IN_GOMP_WARNING, BUILT_IN_GOMP_ERROR): New
    	builtins.
    gcc/c-family/
    	* c-pragma.h (enum pragma_kind): Add PRAGMA_OMP_ERROR.
    	* c-pragma.c (omp_pragmas): Add error directive.
    	* c-omp.c (omp_directives): Uncomment error directive entry.
    gcc/c/
    	* c-parser.c (c_parser_omp_error): New function.
    	(c_parser_pragma): Handle PRAGMA_OMP_ERROR.
    gcc/cp/
    	* parser.c (cp_parser_handle_statement_omp_attributes): Determine if
    	PRAGMA_OMP_ERROR directive is C_OMP_DIR_STANDALONE.
    	(cp_parser_omp_error): New function.
    	(cp_parser_pragma): Handle PRAGMA_OMP_ERROR.
    gcc/fortran/
    	* types.def (BT_FN_VOID_CONST_PTR_SIZE): New DEF_FUNCTION_TYPE_2.
    	* f95-lang.c (ATTR_COLD_NORETURN_NOTHROW_LEAF_LIST): Define.
    gcc/testsuite/
    	* c-c++-common/gomp/error-1.c: New test.
    	* c-c++-common/gomp/error-2.c: New test.
    	* c-c++-common/gomp/error-3.c: New test.
    	* g++.dg/gomp/attrs-1.C (bar): Add error directive test.
    	* g++.dg/gomp/attrs-2.C (bar): Add error directive test.
    	* g++.dg/gomp/attrs-13.C: New test.
    	* g++.dg/gomp/error-1.C: New test.
    libgomp/
    	* libgomp.map (GOMP_5.1): Add GOMP_error and GOMP_warning.
    	* libgomp_g.h (GOMP_warning, GOMP_error): Declare.
    	* error.c (GOMP_warning, GOMP_error): New functions.
    	* testsuite/libgomp.c-c++-common/error-1.c: New test.