gcc-8.3/gcc/c_parser_pragma()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#ac4da2a5]
#backlinks
*説明 [#p500aca9]
-パス: [[gcc-8.3/gcc/c/c-parser.c]]
-FIXME: これは何?
--説明
**引数 [#m893f61b]
-c_parser *parser
--
--[[gcc-8.3/gcc/c_parser]]
-enum pragma_context context
--
--[[gcc-8.3/gcc/pragma_context]]
-bool *if_p
--
**返り値 [#y3b00d46]
-bool
--
**参考 [#adf2a5d7]
*実装 [#padde223]
/* Handle pragmas. Some OpenMP pragmas are associated w...
should be considered, statements. ALLOW_STMT is true...
the context of a function and such pragmas are to be ...
true if we actually parsed such a pragma. */
static bool
c_parser_pragma (c_parser *parser, enum pragma_context c...
{
unsigned int id;
const char *construct = NULL;
id = c_parser_peek_token (parser)->pragma_kind;
gcc_assert (id != PRAGMA_NONE);
-
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/gcc_assert()]]
switch (id)
{
case PRAGMA_OACC_DECLARE:
c_parser_oacc_declare (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_oacc_declare()]]
case PRAGMA_OACC_ENTER_DATA:
if (context != pragma_compound)
{
construct = "acc enter data";
in_compound:
if (context == pragma_stmt)
{
error_at (c_parser_peek_token (parser)->location,
"%<#pragma %s%> may only be used in compound "
"statements", construct);
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL...
return false;
}
goto bad_stmt;
}
c_parser_oacc_enter_exit_data (parser, true);
return false;
-
--[[gcc-8.3/gcc/error_at()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
--[[gcc-8.3/gcc/c_parser_oacc_enter_exit_data()]]
case PRAGMA_OACC_EXIT_DATA:
if (context != pragma_compound)
{
construct = "acc exit data";
goto in_compound;
}
c_parser_oacc_enter_exit_data (parser, false);
return false;
-
--[[gcc-8.3/gcc/c_parser_oacc_enter_exit_data()]]
case PRAGMA_OACC_ROUTINE:
if (context != pragma_external)
{
error_at (c_parser_peek_token (parser)->location,
"%<#pragma acc routine%> must be at file scope");
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NU...
return false;
}
c_parser_oacc_routine (parser, context);
return false;
-
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
--[[gcc-8.3/gcc/c_parser_oacc_routine()]]
case PRAGMA_OACC_UPDATE:
if (context != pragma_compound)
{
construct = "acc update";
goto in_compound;
}
c_parser_oacc_update (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_oacc_update()]]
case PRAGMA_OMP_BARRIER:
if (context != pragma_compound)
{
construct = "omp barrier";
goto in_compound;
}
c_parser_omp_barrier (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_barrier()]]
case PRAGMA_OMP_FLUSH:
if (context != pragma_compound)
{
construct = "omp flush";
goto in_compound;
}
c_parser_omp_flush (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_flush()]]
case PRAGMA_OMP_TASKWAIT:
if (context != pragma_compound)
{
construct = "omp taskwait";
goto in_compound;
}
c_parser_omp_taskwait (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_taskwait()]]
case PRAGMA_OMP_TASKYIELD:
if (context != pragma_compound)
{
construct = "omp taskyield";
goto in_compound;
}
c_parser_omp_taskyield (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_taskyield()]]
case PRAGMA_OMP_CANCEL:
if (context != pragma_compound)
{
construct = "omp cancel";
goto in_compound;
}
c_parser_omp_cancel (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_cancel()]]
case PRAGMA_OMP_CANCELLATION_POINT:
c_parser_omp_cancellation_point (parser, context);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_cancellation_point()]]
case PRAGMA_OMP_THREADPRIVATE:
c_parser_omp_threadprivate (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_threadprivate()]]
case PRAGMA_OMP_TARGET:
return c_parser_omp_target (parser, context, if_p);
-
--[[gcc-8.3/gcc/c_parser_omp_target()]]
case PRAGMA_OMP_END_DECLARE_TARGET:
c_parser_omp_end_declare_target (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_end_declare_target()]]
case PRAGMA_OMP_SECTION:
error_at (c_parser_peek_token (parser)->location,
"%<#pragma omp section%> may only be used in "
"%<#pragma omp sections%> construct");
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL,...
return false;
-
--[[gcc-8.3/gcc/error_at()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
case PRAGMA_OMP_DECLARE:
c_parser_omp_declare (parser, context);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_declare()]]
case PRAGMA_OMP_ORDERED:
return c_parser_omp_ordered (parser, context, if_p);
-
--[[gcc-8.3/gcc/c_parser_omp_ordered()]]
case PRAGMA_IVDEP:
{
const bool ivdep = c_parse_pragma_ivdep (parser);
unsigned short unroll;
if (c_parser_peek_token (parser)->pragma_kind == PRAGMA...
unroll = c_parser_pragma_unroll (parser);
else
unroll = 0;
if (!c_parser_next_token_is_keyword (parser, RID_FOR)
&& !c_parser_next_token_is_keyword (parser, RID_WHI...
&& !c_parser_next_token_is_keyword (parser, RID_DO))
{
c_parser_error (parser, "for, while or do statement...
return false;
}
if (c_parser_next_token_is_keyword (parser, RID_FOR))
c_parser_for_statement (parser, ivdep, unroll, if_p);
else if (c_parser_next_token_is_keyword (parser, RID_WH...
c_parser_while_statement (parser, ivdep, unroll, if_p);
else
c_parser_do_statement (parser, ivdep, unroll);
}
return false;
-
--[[gcc-8.3/gcc/c_parse_pragma_ivdep()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_pragma_unroll()]]
--[[gcc-8.3/gcc/c_parser_next_token_is_keyword()]]
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_for_statement()]]
--[[gcc-8.3/gcc/c_parser_while_statement()]]
--[[gcc-8.3/gcc/c_parser_do_statement()]]
case PRAGMA_UNROLL:
{
unsigned short unroll = c_parser_pragma_unroll (parser);
bool ivdep;
if (c_parser_peek_token (parser)->pragma_kind == PRAGMA...
ivdep = c_parse_pragma_ivdep (parser);
else
ivdep = false;
if (!c_parser_next_token_is_keyword (parser, RID_FOR)
&& !c_parser_next_token_is_keyword (parser, RID_WHI...
&& !c_parser_next_token_is_keyword (parser, RID_DO))
{
c_parser_error (parser, "for, while or do statement...
return false;
}
if (c_parser_next_token_is_keyword (parser, RID_FOR))
c_parser_for_statement (parser, ivdep, unroll, if_p);
else if (c_parser_next_token_is_keyword (parser, RID_WH...
c_parser_while_statement (parser, ivdep, unroll, if_p);
else
c_parser_do_statement (parser, ivdep, unroll);
}
return false;
-
--[[gcc-8.3/gcc/c_parser_pragma_unroll()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parse_pragma_ivdep()]]
--[[gcc-8.3/gcc/c_parser_next_token_is_keyword()]]
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_for_statement()]]
--[[gcc-8.3/gcc/c_parser_while_statement()]]
--[[gcc-8.3/gcc/c_parser_do_statement()]]
case PRAGMA_GCC_PCH_PREPROCESS:
c_parser_error (parser, "%<#pragma GCC pch_preproc...
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL,...
return false;
-
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
case PRAGMA_OACC_WAIT:
if (context != pragma_compound)
{
construct = "acc wait";
goto in_compound;
}
/* FALL THROUGH. */
default:
if (id < PRAGMA_FIRST_EXTERNAL)
{
if (context != pragma_stmt && context != pragma_compo...
{
bad_stmt:
c_parser_error (parser, "expected declaration spe...
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL...
return false;
}
c_parser_omp_construct (parser, if_p);
return true;
}
break;
-
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
--[[gcc-8.3/gcc/c_parser_omp_construct()]]
}
c_parser_consume_pragma (parser);
c_invoke_pragma_handler (id);
-
--[[gcc-8.3/gcc/c_parser_consume_pragma()]]
--[[gcc-8.3/gcc/c_invoke_pragma_handler()]]
/* Skip to EOL, but suppress any error message. Those...
generated by the handler routine through calling er...
to calling c_parser_error. */
parser->error = true;
c_parser_skip_to_pragma_eol (parser);
return false;
}
-
--[[gcc-8.3/gcc/c_parser_skip_to_pragma_eol()]]
*コメント [#j653bda8]
終了行:
*参照元 [#ac4da2a5]
#backlinks
*説明 [#p500aca9]
-パス: [[gcc-8.3/gcc/c/c-parser.c]]
-FIXME: これは何?
--説明
**引数 [#m893f61b]
-c_parser *parser
--
--[[gcc-8.3/gcc/c_parser]]
-enum pragma_context context
--
--[[gcc-8.3/gcc/pragma_context]]
-bool *if_p
--
**返り値 [#y3b00d46]
-bool
--
**参考 [#adf2a5d7]
*実装 [#padde223]
/* Handle pragmas. Some OpenMP pragmas are associated w...
should be considered, statements. ALLOW_STMT is true...
the context of a function and such pragmas are to be ...
true if we actually parsed such a pragma. */
static bool
c_parser_pragma (c_parser *parser, enum pragma_context c...
{
unsigned int id;
const char *construct = NULL;
id = c_parser_peek_token (parser)->pragma_kind;
gcc_assert (id != PRAGMA_NONE);
-
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/gcc_assert()]]
switch (id)
{
case PRAGMA_OACC_DECLARE:
c_parser_oacc_declare (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_oacc_declare()]]
case PRAGMA_OACC_ENTER_DATA:
if (context != pragma_compound)
{
construct = "acc enter data";
in_compound:
if (context == pragma_stmt)
{
error_at (c_parser_peek_token (parser)->location,
"%<#pragma %s%> may only be used in compound "
"statements", construct);
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL...
return false;
}
goto bad_stmt;
}
c_parser_oacc_enter_exit_data (parser, true);
return false;
-
--[[gcc-8.3/gcc/error_at()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
--[[gcc-8.3/gcc/c_parser_oacc_enter_exit_data()]]
case PRAGMA_OACC_EXIT_DATA:
if (context != pragma_compound)
{
construct = "acc exit data";
goto in_compound;
}
c_parser_oacc_enter_exit_data (parser, false);
return false;
-
--[[gcc-8.3/gcc/c_parser_oacc_enter_exit_data()]]
case PRAGMA_OACC_ROUTINE:
if (context != pragma_external)
{
error_at (c_parser_peek_token (parser)->location,
"%<#pragma acc routine%> must be at file scope");
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL, NU...
return false;
}
c_parser_oacc_routine (parser, context);
return false;
-
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
--[[gcc-8.3/gcc/c_parser_oacc_routine()]]
case PRAGMA_OACC_UPDATE:
if (context != pragma_compound)
{
construct = "acc update";
goto in_compound;
}
c_parser_oacc_update (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_oacc_update()]]
case PRAGMA_OMP_BARRIER:
if (context != pragma_compound)
{
construct = "omp barrier";
goto in_compound;
}
c_parser_omp_barrier (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_barrier()]]
case PRAGMA_OMP_FLUSH:
if (context != pragma_compound)
{
construct = "omp flush";
goto in_compound;
}
c_parser_omp_flush (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_flush()]]
case PRAGMA_OMP_TASKWAIT:
if (context != pragma_compound)
{
construct = "omp taskwait";
goto in_compound;
}
c_parser_omp_taskwait (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_taskwait()]]
case PRAGMA_OMP_TASKYIELD:
if (context != pragma_compound)
{
construct = "omp taskyield";
goto in_compound;
}
c_parser_omp_taskyield (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_taskyield()]]
case PRAGMA_OMP_CANCEL:
if (context != pragma_compound)
{
construct = "omp cancel";
goto in_compound;
}
c_parser_omp_cancel (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_cancel()]]
case PRAGMA_OMP_CANCELLATION_POINT:
c_parser_omp_cancellation_point (parser, context);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_cancellation_point()]]
case PRAGMA_OMP_THREADPRIVATE:
c_parser_omp_threadprivate (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_threadprivate()]]
case PRAGMA_OMP_TARGET:
return c_parser_omp_target (parser, context, if_p);
-
--[[gcc-8.3/gcc/c_parser_omp_target()]]
case PRAGMA_OMP_END_DECLARE_TARGET:
c_parser_omp_end_declare_target (parser);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_end_declare_target()]]
case PRAGMA_OMP_SECTION:
error_at (c_parser_peek_token (parser)->location,
"%<#pragma omp section%> may only be used in "
"%<#pragma omp sections%> construct");
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL,...
return false;
-
--[[gcc-8.3/gcc/error_at()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
case PRAGMA_OMP_DECLARE:
c_parser_omp_declare (parser, context);
return false;
-
--[[gcc-8.3/gcc/c_parser_omp_declare()]]
case PRAGMA_OMP_ORDERED:
return c_parser_omp_ordered (parser, context, if_p);
-
--[[gcc-8.3/gcc/c_parser_omp_ordered()]]
case PRAGMA_IVDEP:
{
const bool ivdep = c_parse_pragma_ivdep (parser);
unsigned short unroll;
if (c_parser_peek_token (parser)->pragma_kind == PRAGMA...
unroll = c_parser_pragma_unroll (parser);
else
unroll = 0;
if (!c_parser_next_token_is_keyword (parser, RID_FOR)
&& !c_parser_next_token_is_keyword (parser, RID_WHI...
&& !c_parser_next_token_is_keyword (parser, RID_DO))
{
c_parser_error (parser, "for, while or do statement...
return false;
}
if (c_parser_next_token_is_keyword (parser, RID_FOR))
c_parser_for_statement (parser, ivdep, unroll, if_p);
else if (c_parser_next_token_is_keyword (parser, RID_WH...
c_parser_while_statement (parser, ivdep, unroll, if_p);
else
c_parser_do_statement (parser, ivdep, unroll);
}
return false;
-
--[[gcc-8.3/gcc/c_parse_pragma_ivdep()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parser_pragma_unroll()]]
--[[gcc-8.3/gcc/c_parser_next_token_is_keyword()]]
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_for_statement()]]
--[[gcc-8.3/gcc/c_parser_while_statement()]]
--[[gcc-8.3/gcc/c_parser_do_statement()]]
case PRAGMA_UNROLL:
{
unsigned short unroll = c_parser_pragma_unroll (parser);
bool ivdep;
if (c_parser_peek_token (parser)->pragma_kind == PRAGMA...
ivdep = c_parse_pragma_ivdep (parser);
else
ivdep = false;
if (!c_parser_next_token_is_keyword (parser, RID_FOR)
&& !c_parser_next_token_is_keyword (parser, RID_WHI...
&& !c_parser_next_token_is_keyword (parser, RID_DO))
{
c_parser_error (parser, "for, while or do statement...
return false;
}
if (c_parser_next_token_is_keyword (parser, RID_FOR))
c_parser_for_statement (parser, ivdep, unroll, if_p);
else if (c_parser_next_token_is_keyword (parser, RID_WH...
c_parser_while_statement (parser, ivdep, unroll, if_p);
else
c_parser_do_statement (parser, ivdep, unroll);
}
return false;
-
--[[gcc-8.3/gcc/c_parser_pragma_unroll()]]
--[[gcc-8.3/gcc/c_parser_peek_token()]]
--[[gcc-8.3/gcc/c_parse_pragma_ivdep()]]
--[[gcc-8.3/gcc/c_parser_next_token_is_keyword()]]
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_for_statement()]]
--[[gcc-8.3/gcc/c_parser_while_statement()]]
--[[gcc-8.3/gcc/c_parser_do_statement()]]
case PRAGMA_GCC_PCH_PREPROCESS:
c_parser_error (parser, "%<#pragma GCC pch_preproc...
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL,...
return false;
-
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
case PRAGMA_OACC_WAIT:
if (context != pragma_compound)
{
construct = "acc wait";
goto in_compound;
}
/* FALL THROUGH. */
default:
if (id < PRAGMA_FIRST_EXTERNAL)
{
if (context != pragma_stmt && context != pragma_compo...
{
bad_stmt:
c_parser_error (parser, "expected declaration spe...
c_parser_skip_until_found (parser, CPP_PRAGMA_EOL...
return false;
}
c_parser_omp_construct (parser, if_p);
return true;
}
break;
-
--[[gcc-8.3/gcc/c_parser_error()]]
--[[gcc-8.3/gcc/c_parser_skip_until_found()]]
--[[gcc-8.3/gcc/c_parser_omp_construct()]]
}
c_parser_consume_pragma (parser);
c_invoke_pragma_handler (id);
-
--[[gcc-8.3/gcc/c_parser_consume_pragma()]]
--[[gcc-8.3/gcc/c_invoke_pragma_handler()]]
/* Skip to EOL, but suppress any error message. Those...
generated by the handler routine through calling er...
to calling c_parser_error. */
parser->error = true;
c_parser_skip_to_pragma_eol (parser);
return false;
}
-
--[[gcc-8.3/gcc/c_parser_skip_to_pragma_eol()]]
*コメント [#j653bda8]
ページ名: