hexsha
stringlengths 40
40
| repo
stringlengths 5
105
| path
stringlengths 3
173
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
438
| return_type
stringlengths 1
106
⌀ | original_string
stringlengths 21
40.7k
| original_docstring
stringlengths 18
13.4k
| docstring
stringlengths 11
3.24k
| docstring_tokens
sequence | code
stringlengths 14
20.4k
| code_tokens
sequence | short_docstring
stringlengths 0
4.36k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | new_oacc_loop | oacc_loop | static oacc_loop *
new_oacc_loop (oacc_loop *parent, gcall *marker)
{
oacc_loop *loop = new_oacc_loop_raw (parent, gimple_location (marker));
loop->marker = marker;
/* TODO: This is where device_type flattening would occur for the loop
flags. */
loop->flags = TREE_INT_CST_LOW (gimple_call_arg (marker, 3));
tree chunk_size = integer_zero_node;
if (loop->flags & OLF_GANG_STATIC)
chunk_size = gimple_call_arg (marker, 4);
loop->chunk_size = chunk_size;
return loop;
} | /* Start a new OpenACC loop structure beginning at head marker HEAD.
Link into PARENT loop. Return the new loop. */ | Start a new OpenACC loop structure beginning at head marker HEAD.
Link into PARENT loop. Return the new loop. | [
"Start",
"a",
"new",
"OpenACC",
"loop",
"structure",
"beginning",
"at",
"head",
"marker",
"HEAD",
".",
"Link",
"into",
"PARENT",
"loop",
".",
"Return",
"the",
"new",
"loop",
"."
] | static oacc_loop *
new_oacc_loop (oacc_loop *parent, gcall *marker)
{
oacc_loop *loop = new_oacc_loop_raw (parent, gimple_location (marker));
loop->marker = marker;
loop->flags = TREE_INT_CST_LOW (gimple_call_arg (marker, 3));
tree chunk_size = integer_zero_node;
if (loop->flags & OLF_GANG_STATIC)
chunk_size = gimple_call_arg (marker, 4);
loop->chunk_size = chunk_size;
return loop;
} | [
"static",
"oacc_loop",
"*",
"new_oacc_loop",
"(",
"oacc_loop",
"*",
"parent",
",",
"gcall",
"*",
"marker",
")",
"{",
"oacc_loop",
"*",
"loop",
"=",
"new_oacc_loop_raw",
"(",
"parent",
",",
"gimple_location",
"(",
"marker",
")",
")",
";",
"loop",
"->",
"marker",
"=",
"marker",
";",
"loop",
"->",
"flags",
"=",
"TREE_INT_CST_LOW",
"(",
"gimple_call_arg",
"(",
"marker",
",",
"3",
")",
")",
";",
"tree",
"chunk_size",
"=",
"integer_zero_node",
";",
"if",
"(",
"loop",
"->",
"flags",
"&",
"OLF_GANG_STATIC",
")",
"chunk_size",
"=",
"gimple_call_arg",
"(",
"marker",
",",
"4",
")",
";",
"loop",
"->",
"chunk_size",
"=",
"chunk_size",
";",
"return",
"loop",
";",
"}"
] | Start a new OpenACC loop structure beginning at head marker HEAD. | [
"Start",
"a",
"new",
"OpenACC",
"loop",
"structure",
"beginning",
"at",
"head",
"marker",
"HEAD",
"."
] | [
"/* TODO: This is where device_type flattening would occur for the loop\n flags. */"
] | [
{
"param": "parent",
"type": "oacc_loop"
},
{
"param": "marker",
"type": "gcall"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "marker",
"type": "gcall",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | new_oacc_loop_routine | void | static void
new_oacc_loop_routine (oacc_loop *parent, gcall *call, tree decl, tree attrs)
{
oacc_loop *loop = new_oacc_loop_raw (parent, gimple_location (call));
int level = oacc_fn_attrib_level (attrs);
gcc_assert (level >= 0);
loop->marker = call;
loop->routine = decl;
loop->mask = ((GOMP_DIM_MASK (GOMP_DIM_MAX) - 1)
^ (GOMP_DIM_MASK (level) - 1));
} | /* Create a dummy loop encompassing a call to a openACC routine.
Extract the routine's partitioning requirements. */ | Create a dummy loop encompassing a call to a openACC routine.
Extract the routine's partitioning requirements. | [
"Create",
"a",
"dummy",
"loop",
"encompassing",
"a",
"call",
"to",
"a",
"openACC",
"routine",
".",
"Extract",
"the",
"routine",
"'",
"s",
"partitioning",
"requirements",
"."
] | static void
new_oacc_loop_routine (oacc_loop *parent, gcall *call, tree decl, tree attrs)
{
oacc_loop *loop = new_oacc_loop_raw (parent, gimple_location (call));
int level = oacc_fn_attrib_level (attrs);
gcc_assert (level >= 0);
loop->marker = call;
loop->routine = decl;
loop->mask = ((GOMP_DIM_MASK (GOMP_DIM_MAX) - 1)
^ (GOMP_DIM_MASK (level) - 1));
} | [
"static",
"void",
"new_oacc_loop_routine",
"(",
"oacc_loop",
"*",
"parent",
",",
"gcall",
"*",
"call",
",",
"tree",
"decl",
",",
"tree",
"attrs",
")",
"{",
"oacc_loop",
"*",
"loop",
"=",
"new_oacc_loop_raw",
"(",
"parent",
",",
"gimple_location",
"(",
"call",
")",
")",
";",
"int",
"level",
"=",
"oacc_fn_attrib_level",
"(",
"attrs",
")",
";",
"gcc_assert",
"(",
"level",
">=",
"0",
")",
";",
"loop",
"->",
"marker",
"=",
"call",
";",
"loop",
"->",
"routine",
"=",
"decl",
";",
"loop",
"->",
"mask",
"=",
"(",
"(",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
")",
"-",
"1",
")",
"^",
"(",
"GOMP_DIM_MASK",
"(",
"level",
")",
"-",
"1",
")",
")",
";",
"}"
] | Create a dummy loop encompassing a call to a openACC routine. | [
"Create",
"a",
"dummy",
"loop",
"encompassing",
"a",
"call",
"to",
"a",
"openACC",
"routine",
"."
] | [] | [
{
"param": "parent",
"type": "oacc_loop"
},
{
"param": "call",
"type": "gcall"
},
{
"param": "decl",
"type": "tree"
},
{
"param": "attrs",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "parent",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "call",
"type": "gcall",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "decl",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "attrs",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | finish_oacc_loop | oacc_loop | static oacc_loop *
finish_oacc_loop (oacc_loop *loop)
{
/* If the loop has been collapsed, don't partition it. */
if (loop->ifns.is_empty ())
loop->mask = loop->flags = 0;
return loop->parent;
} | /* Finish off the current OpenACC loop ending at tail marker TAIL.
Return the parent loop. */ | Finish off the current OpenACC loop ending at tail marker TAIL.
Return the parent loop. | [
"Finish",
"off",
"the",
"current",
"OpenACC",
"loop",
"ending",
"at",
"tail",
"marker",
"TAIL",
".",
"Return",
"the",
"parent",
"loop",
"."
] | static oacc_loop *
finish_oacc_loop (oacc_loop *loop)
{
if (loop->ifns.is_empty ())
loop->mask = loop->flags = 0;
return loop->parent;
} | [
"static",
"oacc_loop",
"*",
"finish_oacc_loop",
"(",
"oacc_loop",
"*",
"loop",
")",
"{",
"if",
"(",
"loop",
"->",
"ifns",
".",
"is_empty",
"(",
")",
")",
"loop",
"->",
"mask",
"=",
"loop",
"->",
"flags",
"=",
"0",
";",
"return",
"loop",
"->",
"parent",
";",
"}"
] | Finish off the current OpenACC loop ending at tail marker TAIL. | [
"Finish",
"off",
"the",
"current",
"OpenACC",
"loop",
"ending",
"at",
"tail",
"marker",
"TAIL",
"."
] | [
"/* If the loop has been collapsed, don't partition it. */"
] | [
{
"param": "loop",
"type": "oacc_loop"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | free_oacc_loop | void | static void
free_oacc_loop (oacc_loop *loop)
{
if (loop->sibling)
free_oacc_loop (loop->sibling);
if (loop->child)
free_oacc_loop (loop->child);
loop->ifns.release ();
free (loop);
} | /* Free all OpenACC loop structures within LOOP (inclusive). */ | Free all OpenACC loop structures within LOOP (inclusive). | [
"Free",
"all",
"OpenACC",
"loop",
"structures",
"within",
"LOOP",
"(",
"inclusive",
")",
"."
] | static void
free_oacc_loop (oacc_loop *loop)
{
if (loop->sibling)
free_oacc_loop (loop->sibling);
if (loop->child)
free_oacc_loop (loop->child);
loop->ifns.release ();
free (loop);
} | [
"static",
"void",
"free_oacc_loop",
"(",
"oacc_loop",
"*",
"loop",
")",
"{",
"if",
"(",
"loop",
"->",
"sibling",
")",
"free_oacc_loop",
"(",
"loop",
"->",
"sibling",
")",
";",
"if",
"(",
"loop",
"->",
"child",
")",
"free_oacc_loop",
"(",
"loop",
"->",
"child",
")",
";",
"loop",
"->",
"ifns",
".",
"release",
"(",
")",
";",
"free",
"(",
"loop",
")",
";",
"}"
] | Free all OpenACC loop structures within LOOP (inclusive). | [
"Free",
"all",
"OpenACC",
"loop",
"structures",
"within",
"LOOP",
"(",
"inclusive",
")",
"."
] | [] | [
{
"param": "loop",
"type": "oacc_loop"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | dump_oacc_loop_part | void | static void
dump_oacc_loop_part (FILE *file, gcall *from, int depth,
const char *title, int level)
{
enum ifn_unique_kind kind
= (enum ifn_unique_kind) TREE_INT_CST_LOW (gimple_call_arg (from, 0));
fprintf (file, "%*s%s-%d:\n", depth * 2, "", title, level);
for (gimple_stmt_iterator gsi = gsi_for_stmt (from);;)
{
gimple *stmt = gsi_stmt (gsi);
if (gimple_call_internal_p (stmt, IFN_UNIQUE))
{
enum ifn_unique_kind k
= ((enum ifn_unique_kind) TREE_INT_CST_LOW
(gimple_call_arg (stmt, 0)));
if (k == kind && stmt != from)
break;
}
print_gimple_stmt (file, stmt, depth * 2 + 2);
gsi_next (&gsi);
while (gsi_end_p (gsi))
gsi = gsi_start_bb (single_succ (gsi_bb (gsi)));
}
} | /* Dump out the OpenACC loop head or tail beginning at FROM. */ | Dump out the OpenACC loop head or tail beginning at FROM. | [
"Dump",
"out",
"the",
"OpenACC",
"loop",
"head",
"or",
"tail",
"beginning",
"at",
"FROM",
"."
] | static void
dump_oacc_loop_part (FILE *file, gcall *from, int depth,
const char *title, int level)
{
enum ifn_unique_kind kind
= (enum ifn_unique_kind) TREE_INT_CST_LOW (gimple_call_arg (from, 0));
fprintf (file, "%*s%s-%d:\n", depth * 2, "", title, level);
for (gimple_stmt_iterator gsi = gsi_for_stmt (from);;)
{
gimple *stmt = gsi_stmt (gsi);
if (gimple_call_internal_p (stmt, IFN_UNIQUE))
{
enum ifn_unique_kind k
= ((enum ifn_unique_kind) TREE_INT_CST_LOW
(gimple_call_arg (stmt, 0)));
if (k == kind && stmt != from)
break;
}
print_gimple_stmt (file, stmt, depth * 2 + 2);
gsi_next (&gsi);
while (gsi_end_p (gsi))
gsi = gsi_start_bb (single_succ (gsi_bb (gsi)));
}
} | [
"static",
"void",
"dump_oacc_loop_part",
"(",
"FILE",
"*",
"file",
",",
"gcall",
"*",
"from",
",",
"int",
"depth",
",",
"const",
"char",
"*",
"title",
",",
"int",
"level",
")",
"{",
"enum",
"ifn_unique_kind",
"kind",
"=",
"(",
"enum",
"ifn_unique_kind",
")",
"TREE_INT_CST_LOW",
"(",
"gimple_call_arg",
"(",
"from",
",",
"0",
")",
")",
";",
"fprintf",
"(",
"file",
",",
"\"",
"\\n",
"\"",
",",
"depth",
"*",
"2",
",",
"\"",
"\"",
",",
"title",
",",
"level",
")",
";",
"for",
"(",
"gimple_stmt_iterator",
"gsi",
"=",
"gsi_for_stmt",
"(",
"from",
")",
";",
";",
")",
"{",
"gimple",
"*",
"stmt",
"=",
"gsi_stmt",
"(",
"gsi",
")",
";",
"if",
"(",
"gimple_call_internal_p",
"(",
"stmt",
",",
"IFN_UNIQUE",
")",
")",
"{",
"enum",
"ifn_unique_kind",
"k",
"=",
"(",
"(",
"enum",
"ifn_unique_kind",
")",
"TREE_INT_CST_LOW",
"(",
"gimple_call_arg",
"(",
"stmt",
",",
"0",
")",
")",
")",
";",
"if",
"(",
"k",
"==",
"kind",
"&&",
"stmt",
"!=",
"from",
")",
"break",
";",
"}",
"print_gimple_stmt",
"(",
"file",
",",
"stmt",
",",
"depth",
"*",
"2",
"+",
"2",
")",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
";",
"while",
"(",
"gsi_end_p",
"(",
"gsi",
")",
")",
"gsi",
"=",
"gsi_start_bb",
"(",
"single_succ",
"(",
"gsi_bb",
"(",
"gsi",
")",
")",
")",
";",
"}",
"}"
] | Dump out the OpenACC loop head or tail beginning at FROM. | [
"Dump",
"out",
"the",
"OpenACC",
"loop",
"head",
"or",
"tail",
"beginning",
"at",
"FROM",
"."
] | [] | [
{
"param": "file",
"type": "FILE"
},
{
"param": "from",
"type": "gcall"
},
{
"param": "depth",
"type": "int"
},
{
"param": "title",
"type": "char"
},
{
"param": "level",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "from",
"type": "gcall",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "title",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "level",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | dump_oacc_loop | void | static void
dump_oacc_loop (FILE *file, oacc_loop *loop, int depth)
{
int ix;
fprintf (file, "%*sLoop %x(%x) %s:%u\n", depth * 2, "",
loop->flags, loop->mask,
LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc));
if (loop->marker)
print_gimple_stmt (file, loop->marker, depth * 2);
if (loop->routine)
fprintf (file, "%*sRoutine %s:%u:%s\n",
depth * 2, "", DECL_SOURCE_FILE (loop->routine),
DECL_SOURCE_LINE (loop->routine),
IDENTIFIER_POINTER (DECL_NAME (loop->routine)));
for (ix = GOMP_DIM_GANG; ix != GOMP_DIM_MAX; ix++)
if (loop->heads[ix])
dump_oacc_loop_part (file, loop->heads[ix], depth, "Head", ix);
for (ix = GOMP_DIM_MAX; ix--;)
if (loop->tails[ix])
dump_oacc_loop_part (file, loop->tails[ix], depth, "Tail", ix);
if (loop->child)
dump_oacc_loop (file, loop->child, depth + 1);
if (loop->sibling)
dump_oacc_loop (file, loop->sibling, depth);
} | /* Dump OpenACC loops LOOP, its siblings and its children. */ | Dump OpenACC loops LOOP, its siblings and its children. | [
"Dump",
"OpenACC",
"loops",
"LOOP",
"its",
"siblings",
"and",
"its",
"children",
"."
] | static void
dump_oacc_loop (FILE *file, oacc_loop *loop, int depth)
{
int ix;
fprintf (file, "%*sLoop %x(%x) %s:%u\n", depth * 2, "",
loop->flags, loop->mask,
LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc));
if (loop->marker)
print_gimple_stmt (file, loop->marker, depth * 2);
if (loop->routine)
fprintf (file, "%*sRoutine %s:%u:%s\n",
depth * 2, "", DECL_SOURCE_FILE (loop->routine),
DECL_SOURCE_LINE (loop->routine),
IDENTIFIER_POINTER (DECL_NAME (loop->routine)));
for (ix = GOMP_DIM_GANG; ix != GOMP_DIM_MAX; ix++)
if (loop->heads[ix])
dump_oacc_loop_part (file, loop->heads[ix], depth, "Head", ix);
for (ix = GOMP_DIM_MAX; ix--;)
if (loop->tails[ix])
dump_oacc_loop_part (file, loop->tails[ix], depth, "Tail", ix);
if (loop->child)
dump_oacc_loop (file, loop->child, depth + 1);
if (loop->sibling)
dump_oacc_loop (file, loop->sibling, depth);
} | [
"static",
"void",
"dump_oacc_loop",
"(",
"FILE",
"*",
"file",
",",
"oacc_loop",
"*",
"loop",
",",
"int",
"depth",
")",
"{",
"int",
"ix",
";",
"fprintf",
"(",
"file",
",",
"\"",
"\\n",
"\"",
",",
"depth",
"*",
"2",
",",
"\"",
"\"",
",",
"loop",
"->",
"flags",
",",
"loop",
"->",
"mask",
",",
"LOCATION_FILE",
"(",
"loop",
"->",
"loc",
")",
",",
"LOCATION_LINE",
"(",
"loop",
"->",
"loc",
")",
")",
";",
"if",
"(",
"loop",
"->",
"marker",
")",
"print_gimple_stmt",
"(",
"file",
",",
"loop",
"->",
"marker",
",",
"depth",
"*",
"2",
")",
";",
"if",
"(",
"loop",
"->",
"routine",
")",
"fprintf",
"(",
"file",
",",
"\"",
"\\n",
"\"",
",",
"depth",
"*",
"2",
",",
"\"",
"\"",
",",
"DECL_SOURCE_FILE",
"(",
"loop",
"->",
"routine",
")",
",",
"DECL_SOURCE_LINE",
"(",
"loop",
"->",
"routine",
")",
",",
"IDENTIFIER_POINTER",
"(",
"DECL_NAME",
"(",
"loop",
"->",
"routine",
")",
")",
")",
";",
"for",
"(",
"ix",
"=",
"GOMP_DIM_GANG",
";",
"ix",
"!=",
"GOMP_DIM_MAX",
";",
"ix",
"++",
")",
"if",
"(",
"loop",
"->",
"heads",
"[",
"ix",
"]",
")",
"dump_oacc_loop_part",
"(",
"file",
",",
"loop",
"->",
"heads",
"[",
"ix",
"]",
",",
"depth",
",",
"\"",
"\"",
",",
"ix",
")",
";",
"for",
"(",
"ix",
"=",
"GOMP_DIM_MAX",
";",
"ix",
"--",
";",
")",
"if",
"(",
"loop",
"->",
"tails",
"[",
"ix",
"]",
")",
"dump_oacc_loop_part",
"(",
"file",
",",
"loop",
"->",
"tails",
"[",
"ix",
"]",
",",
"depth",
",",
"\"",
"\"",
",",
"ix",
")",
";",
"if",
"(",
"loop",
"->",
"child",
")",
"dump_oacc_loop",
"(",
"file",
",",
"loop",
"->",
"child",
",",
"depth",
"+",
"1",
")",
";",
"if",
"(",
"loop",
"->",
"sibling",
")",
"dump_oacc_loop",
"(",
"file",
",",
"loop",
"->",
"sibling",
",",
"depth",
")",
";",
"}"
] | Dump OpenACC loops LOOP, its siblings and its children. | [
"Dump",
"OpenACC",
"loops",
"LOOP",
"its",
"siblings",
"and",
"its",
"children",
"."
] | [] | [
{
"param": "file",
"type": "FILE"
},
{
"param": "loop",
"type": "oacc_loop"
},
{
"param": "depth",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "depth",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_loop_sibling_nreverse | oacc_loop | static oacc_loop *
oacc_loop_sibling_nreverse (oacc_loop *loop)
{
oacc_loop *last = NULL;
do
{
if (loop->child)
loop->child = oacc_loop_sibling_nreverse (loop->child);
oacc_loop *next = loop->sibling;
loop->sibling = last;
last = loop;
loop = next;
}
while (loop);
return last;
} | /* LOOP is the first sibling. Reverse the order in place and return
the new first sibling. Recurse to child loops. */ | LOOP is the first sibling. Reverse the order in place and return
the new first sibling. Recurse to child loops. | [
"LOOP",
"is",
"the",
"first",
"sibling",
".",
"Reverse",
"the",
"order",
"in",
"place",
"and",
"return",
"the",
"new",
"first",
"sibling",
".",
"Recurse",
"to",
"child",
"loops",
"."
] | static oacc_loop *
oacc_loop_sibling_nreverse (oacc_loop *loop)
{
oacc_loop *last = NULL;
do
{
if (loop->child)
loop->child = oacc_loop_sibling_nreverse (loop->child);
oacc_loop *next = loop->sibling;
loop->sibling = last;
last = loop;
loop = next;
}
while (loop);
return last;
} | [
"static",
"oacc_loop",
"*",
"oacc_loop_sibling_nreverse",
"(",
"oacc_loop",
"*",
"loop",
")",
"{",
"oacc_loop",
"*",
"last",
"=",
"NULL",
";",
"do",
"{",
"if",
"(",
"loop",
"->",
"child",
")",
"loop",
"->",
"child",
"=",
"oacc_loop_sibling_nreverse",
"(",
"loop",
"->",
"child",
")",
";",
"oacc_loop",
"*",
"next",
"=",
"loop",
"->",
"sibling",
";",
"loop",
"->",
"sibling",
"=",
"last",
";",
"last",
"=",
"loop",
";",
"loop",
"=",
"next",
";",
"}",
"while",
"(",
"loop",
")",
";",
"return",
"last",
";",
"}"
] | LOOP is the first sibling. | [
"LOOP",
"is",
"the",
"first",
"sibling",
"."
] | [] | [
{
"param": "loop",
"type": "oacc_loop"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_loop_discovery | oacc_loop | static oacc_loop *
oacc_loop_discovery ()
{
/* Clear basic block flags, in particular BB_VISITED which we're going to use
in the following. */
clear_bb_flags ();
oacc_loop *top = new_oacc_loop_outer (current_function_decl);
oacc_loop_discover_walk (top, ENTRY_BLOCK_PTR_FOR_FN (cfun));
/* The siblings were constructed in reverse order, reverse them so
that diagnostics come out in an unsurprising order. */
top = oacc_loop_sibling_nreverse (top);
return top;
} | /* Discover the OpenACC loops marked up by HEAD and TAIL markers for
the current function. */ | Discover the OpenACC loops marked up by HEAD and TAIL markers for
the current function. | [
"Discover",
"the",
"OpenACC",
"loops",
"marked",
"up",
"by",
"HEAD",
"and",
"TAIL",
"markers",
"for",
"the",
"current",
"function",
"."
] | static oacc_loop *
oacc_loop_discovery ()
{
clear_bb_flags ();
oacc_loop *top = new_oacc_loop_outer (current_function_decl);
oacc_loop_discover_walk (top, ENTRY_BLOCK_PTR_FOR_FN (cfun));
top = oacc_loop_sibling_nreverse (top);
return top;
} | [
"static",
"oacc_loop",
"*",
"oacc_loop_discovery",
"(",
")",
"{",
"clear_bb_flags",
"(",
")",
";",
"oacc_loop",
"*",
"top",
"=",
"new_oacc_loop_outer",
"(",
"current_function_decl",
")",
";",
"oacc_loop_discover_walk",
"(",
"top",
",",
"ENTRY_BLOCK_PTR_FOR_FN",
"(",
"cfun",
")",
")",
";",
"top",
"=",
"oacc_loop_sibling_nreverse",
"(",
"top",
")",
";",
"return",
"top",
";",
"}"
] | Discover the OpenACC loops marked up by HEAD and TAIL markers for
the current function. | [
"Discover",
"the",
"OpenACC",
"loops",
"marked",
"up",
"by",
"HEAD",
"and",
"TAIL",
"markers",
"for",
"the",
"current",
"function",
"."
] | [
"/* Clear basic block flags, in particular BB_VISITED which we're going to use\n in the following. */",
"/* The siblings were constructed in reverse order, reverse them so\n that diagnostics come out in an unsurprising order. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_loop_xform_head_tail | void | static void
oacc_loop_xform_head_tail (gcall *from, int level)
{
enum ifn_unique_kind kind
= (enum ifn_unique_kind) TREE_INT_CST_LOW (gimple_call_arg (from, 0));
tree replacement = build_int_cst (unsigned_type_node, level);
for (gimple_stmt_iterator gsi = gsi_for_stmt (from);;)
{
gimple *stmt = gsi_stmt (gsi);
if (gimple_call_internal_p (stmt, IFN_UNIQUE))
{
enum ifn_unique_kind k
= ((enum ifn_unique_kind)
TREE_INT_CST_LOW (gimple_call_arg (stmt, 0)));
if (k == IFN_UNIQUE_OACC_FORK || k == IFN_UNIQUE_OACC_JOIN)
*gimple_call_arg_ptr (stmt, 2) = replacement;
else if (k == kind && stmt != from)
break;
}
else if (gimple_call_internal_p (stmt, IFN_GOACC_REDUCTION))
*gimple_call_arg_ptr (stmt, 3) = replacement;
gsi_next (&gsi);
while (gsi_end_p (gsi))
gsi = gsi_start_bb (single_succ (gsi_bb (gsi)));
}
} | /* Transform the abstract internal function markers starting at FROM
to be for partitioning level LEVEL. Stop when we meet another HEAD
or TAIL marker. */ | Transform the abstract internal function markers starting at FROM
to be for partitioning level LEVEL. Stop when we meet another HEAD
or TAIL marker. | [
"Transform",
"the",
"abstract",
"internal",
"function",
"markers",
"starting",
"at",
"FROM",
"to",
"be",
"for",
"partitioning",
"level",
"LEVEL",
".",
"Stop",
"when",
"we",
"meet",
"another",
"HEAD",
"or",
"TAIL",
"marker",
"."
] | static void
oacc_loop_xform_head_tail (gcall *from, int level)
{
enum ifn_unique_kind kind
= (enum ifn_unique_kind) TREE_INT_CST_LOW (gimple_call_arg (from, 0));
tree replacement = build_int_cst (unsigned_type_node, level);
for (gimple_stmt_iterator gsi = gsi_for_stmt (from);;)
{
gimple *stmt = gsi_stmt (gsi);
if (gimple_call_internal_p (stmt, IFN_UNIQUE))
{
enum ifn_unique_kind k
= ((enum ifn_unique_kind)
TREE_INT_CST_LOW (gimple_call_arg (stmt, 0)));
if (k == IFN_UNIQUE_OACC_FORK || k == IFN_UNIQUE_OACC_JOIN)
*gimple_call_arg_ptr (stmt, 2) = replacement;
else if (k == kind && stmt != from)
break;
}
else if (gimple_call_internal_p (stmt, IFN_GOACC_REDUCTION))
*gimple_call_arg_ptr (stmt, 3) = replacement;
gsi_next (&gsi);
while (gsi_end_p (gsi))
gsi = gsi_start_bb (single_succ (gsi_bb (gsi)));
}
} | [
"static",
"void",
"oacc_loop_xform_head_tail",
"(",
"gcall",
"*",
"from",
",",
"int",
"level",
")",
"{",
"enum",
"ifn_unique_kind",
"kind",
"=",
"(",
"enum",
"ifn_unique_kind",
")",
"TREE_INT_CST_LOW",
"(",
"gimple_call_arg",
"(",
"from",
",",
"0",
")",
")",
";",
"tree",
"replacement",
"=",
"build_int_cst",
"(",
"unsigned_type_node",
",",
"level",
")",
";",
"for",
"(",
"gimple_stmt_iterator",
"gsi",
"=",
"gsi_for_stmt",
"(",
"from",
")",
";",
";",
")",
"{",
"gimple",
"*",
"stmt",
"=",
"gsi_stmt",
"(",
"gsi",
")",
";",
"if",
"(",
"gimple_call_internal_p",
"(",
"stmt",
",",
"IFN_UNIQUE",
")",
")",
"{",
"enum",
"ifn_unique_kind",
"k",
"=",
"(",
"(",
"enum",
"ifn_unique_kind",
")",
"TREE_INT_CST_LOW",
"(",
"gimple_call_arg",
"(",
"stmt",
",",
"0",
")",
")",
")",
";",
"if",
"(",
"k",
"==",
"IFN_UNIQUE_OACC_FORK",
"||",
"k",
"==",
"IFN_UNIQUE_OACC_JOIN",
")",
"*",
"gimple_call_arg_ptr",
"(",
"stmt",
",",
"2",
")",
"=",
"replacement",
";",
"else",
"if",
"(",
"k",
"==",
"kind",
"&&",
"stmt",
"!=",
"from",
")",
"break",
";",
"}",
"else",
"if",
"(",
"gimple_call_internal_p",
"(",
"stmt",
",",
"IFN_GOACC_REDUCTION",
")",
")",
"*",
"gimple_call_arg_ptr",
"(",
"stmt",
",",
"3",
")",
"=",
"replacement",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
";",
"while",
"(",
"gsi_end_p",
"(",
"gsi",
")",
")",
"gsi",
"=",
"gsi_start_bb",
"(",
"single_succ",
"(",
"gsi_bb",
"(",
"gsi",
")",
")",
")",
";",
"}",
"}"
] | Transform the abstract internal function markers starting at FROM
to be for partitioning level LEVEL. | [
"Transform",
"the",
"abstract",
"internal",
"function",
"markers",
"starting",
"at",
"FROM",
"to",
"be",
"for",
"partitioning",
"level",
"LEVEL",
"."
] | [] | [
{
"param": "from",
"type": "gcall"
},
{
"param": "level",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "from",
"type": "gcall",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "level",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_loop_process | void | static void
oacc_loop_process (oacc_loop *loop)
{
if (loop->child)
oacc_loop_process (loop->child);
if (loop->mask && !loop->routine)
{
int ix;
tree mask_arg = build_int_cst (unsigned_type_node, loop->mask);
tree e_mask_arg = build_int_cst (unsigned_type_node, loop->e_mask);
tree chunk_arg = loop->chunk_size;
gcall *call;
for (ix = 0; loop->ifns.iterate (ix, &call); ix++)
switch (gimple_call_internal_fn (call))
{
case IFN_GOACC_LOOP:
{
bool is_e = gimple_call_arg (call, 5) == integer_minus_one_node;
gimple_call_set_arg (call, 5, is_e ? e_mask_arg : mask_arg);
if (!is_e)
gimple_call_set_arg (call, 4, chunk_arg);
}
break;
case IFN_GOACC_TILE:
gimple_call_set_arg (call, 3, mask_arg);
gimple_call_set_arg (call, 4, e_mask_arg);
break;
default:
gcc_unreachable ();
}
unsigned dim = GOMP_DIM_GANG;
unsigned mask = loop->mask | loop->e_mask;
for (ix = 0; ix != GOMP_DIM_MAX && mask; ix++)
{
while (!(GOMP_DIM_MASK (dim) & mask))
dim++;
oacc_loop_xform_head_tail (loop->heads[ix], dim);
oacc_loop_xform_head_tail (loop->tails[ix], dim);
mask ^= GOMP_DIM_MASK (dim);
}
}
if (loop->sibling)
oacc_loop_process (loop->sibling);
} | /* Process the discovered OpenACC loops, setting the correct
partitioning level etc. */ | Process the discovered OpenACC loops, setting the correct
partitioning level etc. | [
"Process",
"the",
"discovered",
"OpenACC",
"loops",
"setting",
"the",
"correct",
"partitioning",
"level",
"etc",
"."
] | static void
oacc_loop_process (oacc_loop *loop)
{
if (loop->child)
oacc_loop_process (loop->child);
if (loop->mask && !loop->routine)
{
int ix;
tree mask_arg = build_int_cst (unsigned_type_node, loop->mask);
tree e_mask_arg = build_int_cst (unsigned_type_node, loop->e_mask);
tree chunk_arg = loop->chunk_size;
gcall *call;
for (ix = 0; loop->ifns.iterate (ix, &call); ix++)
switch (gimple_call_internal_fn (call))
{
case IFN_GOACC_LOOP:
{
bool is_e = gimple_call_arg (call, 5) == integer_minus_one_node;
gimple_call_set_arg (call, 5, is_e ? e_mask_arg : mask_arg);
if (!is_e)
gimple_call_set_arg (call, 4, chunk_arg);
}
break;
case IFN_GOACC_TILE:
gimple_call_set_arg (call, 3, mask_arg);
gimple_call_set_arg (call, 4, e_mask_arg);
break;
default:
gcc_unreachable ();
}
unsigned dim = GOMP_DIM_GANG;
unsigned mask = loop->mask | loop->e_mask;
for (ix = 0; ix != GOMP_DIM_MAX && mask; ix++)
{
while (!(GOMP_DIM_MASK (dim) & mask))
dim++;
oacc_loop_xform_head_tail (loop->heads[ix], dim);
oacc_loop_xform_head_tail (loop->tails[ix], dim);
mask ^= GOMP_DIM_MASK (dim);
}
}
if (loop->sibling)
oacc_loop_process (loop->sibling);
} | [
"static",
"void",
"oacc_loop_process",
"(",
"oacc_loop",
"*",
"loop",
")",
"{",
"if",
"(",
"loop",
"->",
"child",
")",
"oacc_loop_process",
"(",
"loop",
"->",
"child",
")",
";",
"if",
"(",
"loop",
"->",
"mask",
"&&",
"!",
"loop",
"->",
"routine",
")",
"{",
"int",
"ix",
";",
"tree",
"mask_arg",
"=",
"build_int_cst",
"(",
"unsigned_type_node",
",",
"loop",
"->",
"mask",
")",
";",
"tree",
"e_mask_arg",
"=",
"build_int_cst",
"(",
"unsigned_type_node",
",",
"loop",
"->",
"e_mask",
")",
";",
"tree",
"chunk_arg",
"=",
"loop",
"->",
"chunk_size",
";",
"gcall",
"*",
"call",
";",
"for",
"(",
"ix",
"=",
"0",
";",
"loop",
"->",
"ifns",
".",
"iterate",
"(",
"ix",
",",
"&",
"call",
")",
";",
"ix",
"++",
")",
"switch",
"(",
"gimple_call_internal_fn",
"(",
"call",
")",
")",
"{",
"case",
"IFN_GOACC_LOOP",
":",
"{",
"bool",
"is_e",
"=",
"gimple_call_arg",
"(",
"call",
",",
"5",
")",
"==",
"integer_minus_one_node",
";",
"gimple_call_set_arg",
"(",
"call",
",",
"5",
",",
"is_e",
"?",
"e_mask_arg",
":",
"mask_arg",
")",
";",
"if",
"(",
"!",
"is_e",
")",
"gimple_call_set_arg",
"(",
"call",
",",
"4",
",",
"chunk_arg",
")",
";",
"}",
"break",
";",
"case",
"IFN_GOACC_TILE",
":",
"gimple_call_set_arg",
"(",
"call",
",",
"3",
",",
"mask_arg",
")",
";",
"gimple_call_set_arg",
"(",
"call",
",",
"4",
",",
"e_mask_arg",
")",
";",
"break",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"unsigned",
"dim",
"=",
"GOMP_DIM_GANG",
";",
"unsigned",
"mask",
"=",
"loop",
"->",
"mask",
"|",
"loop",
"->",
"e_mask",
";",
"for",
"(",
"ix",
"=",
"0",
";",
"ix",
"!=",
"GOMP_DIM_MAX",
"&&",
"mask",
";",
"ix",
"++",
")",
"{",
"while",
"(",
"!",
"(",
"GOMP_DIM_MASK",
"(",
"dim",
")",
"&",
"mask",
")",
")",
"dim",
"++",
";",
"oacc_loop_xform_head_tail",
"(",
"loop",
"->",
"heads",
"[",
"ix",
"]",
",",
"dim",
")",
";",
"oacc_loop_xform_head_tail",
"(",
"loop",
"->",
"tails",
"[",
"ix",
"]",
",",
"dim",
")",
";",
"mask",
"^=",
"GOMP_DIM_MASK",
"(",
"dim",
")",
";",
"}",
"}",
"if",
"(",
"loop",
"->",
"sibling",
")",
"oacc_loop_process",
"(",
"loop",
"->",
"sibling",
")",
";",
"}"
] | Process the discovered OpenACC loops, setting the correct
partitioning level etc. | [
"Process",
"the",
"discovered",
"OpenACC",
"loops",
"setting",
"the",
"correct",
"partitioning",
"level",
"etc",
"."
] | [] | [
{
"param": "loop",
"type": "oacc_loop"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_loop_fixed_partitions | null | static unsigned
oacc_loop_fixed_partitions (oacc_loop *loop, unsigned outer_mask)
{
unsigned this_mask = loop->mask;
unsigned mask_all = 0;
bool noisy = true;
#ifdef ACCEL_COMPILER
/* When device_type is supported, we want the device compiler to be
noisy, if the loop parameters are device_type-specific. */
noisy = false;
#endif
if (!loop->routine)
{
bool auto_par = (loop->flags & OLF_AUTO) != 0;
bool seq_par = (loop->flags & OLF_SEQ) != 0;
bool tiling = (loop->flags & OLF_TILE) != 0;
this_mask = ((loop->flags >> OLF_DIM_BASE)
& (GOMP_DIM_MASK (GOMP_DIM_MAX) - 1));
/* Apply auto partitioning if this is a non-partitioned regular
loop, or (no more than) single axis tiled loop. */
bool maybe_auto
= !seq_par && this_mask == (tiling ? this_mask & -this_mask : 0);
if ((this_mask != 0) + auto_par + seq_par > 1)
{
if (noisy)
error_at (loop->loc,
seq_par
? G_("%<seq%> overrides other OpenACC loop specifiers")
: G_("%<auto%> conflicts with other OpenACC loop "
"specifiers"));
maybe_auto = false;
loop->flags &= ~OLF_AUTO;
if (seq_par)
{
loop->flags
&= ~((GOMP_DIM_MASK (GOMP_DIM_MAX) - 1) << OLF_DIM_BASE);
this_mask = 0;
}
}
if (maybe_auto && (loop->flags & OLF_INDEPENDENT))
{
loop->flags |= OLF_AUTO;
mask_all |= GOMP_DIM_MASK (GOMP_DIM_MAX);
}
}
if (this_mask & outer_mask)
{
const oacc_loop *outer;
for (outer = loop->parent; outer; outer = outer->parent)
if ((outer->mask | outer->e_mask) & this_mask)
break;
if (noisy)
{
if (outer)
{
error_at (loop->loc,
loop->routine
? G_("routine call uses same OpenACC parallelism"
" as containing loop")
: G_("inner loop uses same OpenACC parallelism"
" as containing loop"));
inform (outer->loc, "containing loop here");
}
else
error_at (loop->loc,
loop->routine
? G_("routine call uses OpenACC parallelism disallowed"
" by containing routine")
: G_("loop uses OpenACC parallelism disallowed"
" by containing routine"));
if (loop->routine)
inform (DECL_SOURCE_LOCATION (loop->routine),
"routine %qD declared here", loop->routine);
}
this_mask &= ~outer_mask;
}
else
{
unsigned outermost = least_bit_hwi (this_mask);
if (outermost && outermost <= outer_mask)
{
if (noisy)
{
error_at (loop->loc,
"incorrectly nested OpenACC loop parallelism");
const oacc_loop *outer;
for (outer = loop->parent;
outer->flags && outer->flags < outermost;
outer = outer->parent)
continue;
inform (outer->loc, "containing loop here");
}
this_mask &= ~outermost;
}
}
mask_all |= this_mask;
if (loop->flags & OLF_TILE)
{
/* When tiling, vector goes to the element loop, and failing
that we put worker there. The std doesn't contemplate
specifying all three. We choose to put worker and vector on
the element loops in that case. */
unsigned this_e_mask = this_mask & GOMP_DIM_MASK (GOMP_DIM_VECTOR);
if (!this_e_mask || this_mask & GOMP_DIM_MASK (GOMP_DIM_GANG))
this_e_mask |= this_mask & GOMP_DIM_MASK (GOMP_DIM_WORKER);
loop->e_mask = this_e_mask;
this_mask ^= this_e_mask;
}
loop->mask = this_mask;
if (dump_file)
fprintf (dump_file, "Loop %s:%d user specified %d & %d\n",
LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc),
loop->mask, loop->e_mask);
if (loop->child)
{
unsigned tmp_mask = outer_mask | this_mask | loop->e_mask;
loop->inner = oacc_loop_fixed_partitions (loop->child, tmp_mask);
mask_all |= loop->inner;
}
if (loop->sibling)
mask_all |= oacc_loop_fixed_partitions (loop->sibling, outer_mask);
return mask_all;
} | /* Walk the OpenACC loop heirarchy checking and assigning the
programmer-specified partitionings. OUTER_MASK is the partitioning
this loop is contained within. Return mask of partitioning
encountered. If any auto loops are discovered, set GOMP_DIM_MAX
bit. */ | Walk the OpenACC loop heirarchy checking and assigning the
programmer-specified partitionings. OUTER_MASK is the partitioning
this loop is contained within. Return mask of partitioning
encountered. If any auto loops are discovered, set GOMP_DIM_MAX
bit. | [
"Walk",
"the",
"OpenACC",
"loop",
"heirarchy",
"checking",
"and",
"assigning",
"the",
"programmer",
"-",
"specified",
"partitionings",
".",
"OUTER_MASK",
"is",
"the",
"partitioning",
"this",
"loop",
"is",
"contained",
"within",
".",
"Return",
"mask",
"of",
"partitioning",
"encountered",
".",
"If",
"any",
"auto",
"loops",
"are",
"discovered",
"set",
"GOMP_DIM_MAX",
"bit",
"."
] | static unsigned
oacc_loop_fixed_partitions (oacc_loop *loop, unsigned outer_mask)
{
unsigned this_mask = loop->mask;
unsigned mask_all = 0;
bool noisy = true;
#ifdef ACCEL_COMPILER
noisy = false;
#endif
if (!loop->routine)
{
bool auto_par = (loop->flags & OLF_AUTO) != 0;
bool seq_par = (loop->flags & OLF_SEQ) != 0;
bool tiling = (loop->flags & OLF_TILE) != 0;
this_mask = ((loop->flags >> OLF_DIM_BASE)
& (GOMP_DIM_MASK (GOMP_DIM_MAX) - 1));
bool maybe_auto
= !seq_par && this_mask == (tiling ? this_mask & -this_mask : 0);
if ((this_mask != 0) + auto_par + seq_par > 1)
{
if (noisy)
error_at (loop->loc,
seq_par
? G_("%<seq%> overrides other OpenACC loop specifiers")
: G_("%<auto%> conflicts with other OpenACC loop "
"specifiers"));
maybe_auto = false;
loop->flags &= ~OLF_AUTO;
if (seq_par)
{
loop->flags
&= ~((GOMP_DIM_MASK (GOMP_DIM_MAX) - 1) << OLF_DIM_BASE);
this_mask = 0;
}
}
if (maybe_auto && (loop->flags & OLF_INDEPENDENT))
{
loop->flags |= OLF_AUTO;
mask_all |= GOMP_DIM_MASK (GOMP_DIM_MAX);
}
}
if (this_mask & outer_mask)
{
const oacc_loop *outer;
for (outer = loop->parent; outer; outer = outer->parent)
if ((outer->mask | outer->e_mask) & this_mask)
break;
if (noisy)
{
if (outer)
{
error_at (loop->loc,
loop->routine
? G_("routine call uses same OpenACC parallelism"
" as containing loop")
: G_("inner loop uses same OpenACC parallelism"
" as containing loop"));
inform (outer->loc, "containing loop here");
}
else
error_at (loop->loc,
loop->routine
? G_("routine call uses OpenACC parallelism disallowed"
" by containing routine")
: G_("loop uses OpenACC parallelism disallowed"
" by containing routine"));
if (loop->routine)
inform (DECL_SOURCE_LOCATION (loop->routine),
"routine %qD declared here", loop->routine);
}
this_mask &= ~outer_mask;
}
else
{
unsigned outermost = least_bit_hwi (this_mask);
if (outermost && outermost <= outer_mask)
{
if (noisy)
{
error_at (loop->loc,
"incorrectly nested OpenACC loop parallelism");
const oacc_loop *outer;
for (outer = loop->parent;
outer->flags && outer->flags < outermost;
outer = outer->parent)
continue;
inform (outer->loc, "containing loop here");
}
this_mask &= ~outermost;
}
}
mask_all |= this_mask;
if (loop->flags & OLF_TILE)
{
unsigned this_e_mask = this_mask & GOMP_DIM_MASK (GOMP_DIM_VECTOR);
if (!this_e_mask || this_mask & GOMP_DIM_MASK (GOMP_DIM_GANG))
this_e_mask |= this_mask & GOMP_DIM_MASK (GOMP_DIM_WORKER);
loop->e_mask = this_e_mask;
this_mask ^= this_e_mask;
}
loop->mask = this_mask;
if (dump_file)
fprintf (dump_file, "Loop %s:%d user specified %d & %d\n",
LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc),
loop->mask, loop->e_mask);
if (loop->child)
{
unsigned tmp_mask = outer_mask | this_mask | loop->e_mask;
loop->inner = oacc_loop_fixed_partitions (loop->child, tmp_mask);
mask_all |= loop->inner;
}
if (loop->sibling)
mask_all |= oacc_loop_fixed_partitions (loop->sibling, outer_mask);
return mask_all;
} | [
"static",
"unsigned",
"oacc_loop_fixed_partitions",
"(",
"oacc_loop",
"*",
"loop",
",",
"unsigned",
"outer_mask",
")",
"{",
"unsigned",
"this_mask",
"=",
"loop",
"->",
"mask",
";",
"unsigned",
"mask_all",
"=",
"0",
";",
"bool",
"noisy",
"=",
"true",
";",
"#ifdef",
"ACCEL_COMPILER",
"noisy",
"=",
"false",
";",
"#endif",
"if",
"(",
"!",
"loop",
"->",
"routine",
")",
"{",
"bool",
"auto_par",
"=",
"(",
"loop",
"->",
"flags",
"&",
"OLF_AUTO",
")",
"!=",
"0",
";",
"bool",
"seq_par",
"=",
"(",
"loop",
"->",
"flags",
"&",
"OLF_SEQ",
")",
"!=",
"0",
";",
"bool",
"tiling",
"=",
"(",
"loop",
"->",
"flags",
"&",
"OLF_TILE",
")",
"!=",
"0",
";",
"this_mask",
"=",
"(",
"(",
"loop",
"->",
"flags",
">>",
"OLF_DIM_BASE",
")",
"&",
"(",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
")",
"-",
"1",
")",
")",
";",
"bool",
"maybe_auto",
"=",
"!",
"seq_par",
"&&",
"this_mask",
"==",
"(",
"tiling",
"?",
"this_mask",
"&",
"-",
"this_mask",
":",
"0",
")",
";",
"if",
"(",
"(",
"this_mask",
"!=",
"0",
")",
"+",
"auto_par",
"+",
"seq_par",
">",
"1",
")",
"{",
"if",
"(",
"noisy",
")",
"error_at",
"(",
"loop",
"->",
"loc",
",",
"seq_par",
"?",
"G_",
"(",
"\"",
"\"",
")",
":",
"G_",
"(",
"\"",
"\"",
"\"",
"\"",
")",
")",
";",
"maybe_auto",
"=",
"false",
";",
"loop",
"->",
"flags",
"&=",
"~",
"OLF_AUTO",
";",
"if",
"(",
"seq_par",
")",
"{",
"loop",
"->",
"flags",
"&=",
"~",
"(",
"(",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
")",
"-",
"1",
")",
"<<",
"OLF_DIM_BASE",
")",
";",
"this_mask",
"=",
"0",
";",
"}",
"}",
"if",
"(",
"maybe_auto",
"&&",
"(",
"loop",
"->",
"flags",
"&",
"OLF_INDEPENDENT",
")",
")",
"{",
"loop",
"->",
"flags",
"|=",
"OLF_AUTO",
";",
"mask_all",
"|=",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
")",
";",
"}",
"}",
"if",
"(",
"this_mask",
"&",
"outer_mask",
")",
"{",
"const",
"oacc_loop",
"*",
"outer",
";",
"for",
"(",
"outer",
"=",
"loop",
"->",
"parent",
";",
"outer",
";",
"outer",
"=",
"outer",
"->",
"parent",
")",
"if",
"(",
"(",
"outer",
"->",
"mask",
"|",
"outer",
"->",
"e_mask",
")",
"&",
"this_mask",
")",
"break",
";",
"if",
"(",
"noisy",
")",
"{",
"if",
"(",
"outer",
")",
"{",
"error_at",
"(",
"loop",
"->",
"loc",
",",
"loop",
"->",
"routine",
"?",
"G_",
"(",
"\"",
"\"",
"\"",
"\"",
")",
":",
"G_",
"(",
"\"",
"\"",
"\"",
"\"",
")",
")",
";",
"inform",
"(",
"outer",
"->",
"loc",
",",
"\"",
"\"",
")",
";",
"}",
"else",
"error_at",
"(",
"loop",
"->",
"loc",
",",
"loop",
"->",
"routine",
"?",
"G_",
"(",
"\"",
"\"",
"\"",
"\"",
")",
":",
"G_",
"(",
"\"",
"\"",
"\"",
"\"",
")",
")",
";",
"if",
"(",
"loop",
"->",
"routine",
")",
"inform",
"(",
"DECL_SOURCE_LOCATION",
"(",
"loop",
"->",
"routine",
")",
",",
"\"",
"\"",
",",
"loop",
"->",
"routine",
")",
";",
"}",
"this_mask",
"&=",
"~",
"outer_mask",
";",
"}",
"else",
"{",
"unsigned",
"outermost",
"=",
"least_bit_hwi",
"(",
"this_mask",
")",
";",
"if",
"(",
"outermost",
"&&",
"outermost",
"<=",
"outer_mask",
")",
"{",
"if",
"(",
"noisy",
")",
"{",
"error_at",
"(",
"loop",
"->",
"loc",
",",
"\"",
"\"",
")",
";",
"const",
"oacc_loop",
"*",
"outer",
";",
"for",
"(",
"outer",
"=",
"loop",
"->",
"parent",
";",
"outer",
"->",
"flags",
"&&",
"outer",
"->",
"flags",
"<",
"outermost",
";",
"outer",
"=",
"outer",
"->",
"parent",
")",
"continue",
";",
"inform",
"(",
"outer",
"->",
"loc",
",",
"\"",
"\"",
")",
";",
"}",
"this_mask",
"&=",
"~",
"outermost",
";",
"}",
"}",
"mask_all",
"|=",
"this_mask",
";",
"if",
"(",
"loop",
"->",
"flags",
"&",
"OLF_TILE",
")",
"{",
"unsigned",
"this_e_mask",
"=",
"this_mask",
"&",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_VECTOR",
")",
";",
"if",
"(",
"!",
"this_e_mask",
"||",
"this_mask",
"&",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_GANG",
")",
")",
"this_e_mask",
"|=",
"this_mask",
"&",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_WORKER",
")",
";",
"loop",
"->",
"e_mask",
"=",
"this_e_mask",
";",
"this_mask",
"^=",
"this_e_mask",
";",
"}",
"loop",
"->",
"mask",
"=",
"this_mask",
";",
"if",
"(",
"dump_file",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"LOCATION_FILE",
"(",
"loop",
"->",
"loc",
")",
",",
"LOCATION_LINE",
"(",
"loop",
"->",
"loc",
")",
",",
"loop",
"->",
"mask",
",",
"loop",
"->",
"e_mask",
")",
";",
"if",
"(",
"loop",
"->",
"child",
")",
"{",
"unsigned",
"tmp_mask",
"=",
"outer_mask",
"|",
"this_mask",
"|",
"loop",
"->",
"e_mask",
";",
"loop",
"->",
"inner",
"=",
"oacc_loop_fixed_partitions",
"(",
"loop",
"->",
"child",
",",
"tmp_mask",
")",
";",
"mask_all",
"|=",
"loop",
"->",
"inner",
";",
"}",
"if",
"(",
"loop",
"->",
"sibling",
")",
"mask_all",
"|=",
"oacc_loop_fixed_partitions",
"(",
"loop",
"->",
"sibling",
",",
"outer_mask",
")",
";",
"return",
"mask_all",
";",
"}"
] | Walk the OpenACC loop heirarchy checking and assigning the
programmer-specified partitionings. | [
"Walk",
"the",
"OpenACC",
"loop",
"heirarchy",
"checking",
"and",
"assigning",
"the",
"programmer",
"-",
"specified",
"partitionings",
"."
] | [
"/* When device_type is supported, we want the device compiler to be\n noisy, if the loop parameters are device_type-specific. */",
"/* Apply auto partitioning if this is a non-partitioned regular\n\t loop, or (no more than) single axis tiled loop. */",
"/* When tiling, vector goes to the element loop, and failing\n\t that we put worker there. The std doesn't contemplate\n\t specifying all three. We choose to put worker and vector on\n\t the element loops in that case. */"
] | [
{
"param": "loop",
"type": "oacc_loop"
},
{
"param": "outer_mask",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outer_mask",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_loop_auto_partitions | null | static unsigned
oacc_loop_auto_partitions (oacc_loop *loop, unsigned outer_mask,
bool outer_assign)
{
bool assign = (loop->flags & OLF_AUTO) && (loop->flags & OLF_INDEPENDENT);
bool noisy = true;
bool tiling = loop->flags & OLF_TILE;
#ifdef ACCEL_COMPILER
/* When device_type is supported, we want the device compiler to be
noisy, if the loop parameters are device_type-specific. */
noisy = false;
#endif
if (assign && (!outer_assign || loop->inner))
{
/* Allocate outermost and non-innermost loops at the outermost
non-innermost available level. */
unsigned this_mask = GOMP_DIM_MASK (GOMP_DIM_GANG);
/* Find the first outermost available partition. */
while (this_mask <= outer_mask)
this_mask <<= 1;
/* Grab two axes if tiling, and we've not assigned anything */
if (tiling && !(loop->mask | loop->e_mask))
this_mask |= this_mask << 1;
/* Prohibit the innermost partitioning at the moment. */
this_mask &= GOMP_DIM_MASK (GOMP_DIM_MAX - 1) - 1;
/* Don't use any dimension explicitly claimed by an inner loop. */
this_mask &= ~loop->inner;
if (tiling && !loop->e_mask)
{
/* If we got two axes, allocate the inner one to the element
loop. */
loop->e_mask = this_mask & (this_mask << 1);
this_mask ^= loop->e_mask;
}
loop->mask |= this_mask;
}
if (loop->child)
{
unsigned tmp_mask = outer_mask | loop->mask | loop->e_mask;
loop->inner = oacc_loop_auto_partitions (loop->child, tmp_mask,
outer_assign | assign);
}
if (assign && (!loop->mask || (tiling && !loop->e_mask) || !outer_assign))
{
/* Allocate the loop at the innermost available level. Note
that we do this even if we already assigned this loop the
outermost available level above. That way we'll partition
this along 2 axes, if they are available. */
unsigned this_mask = 0;
/* Determine the outermost partitioning used within this loop. */
this_mask = loop->inner | GOMP_DIM_MASK (GOMP_DIM_MAX);
this_mask = least_bit_hwi (this_mask);
/* Pick the partitioning just inside that one. */
this_mask >>= 1;
/* And avoid picking one use by an outer loop. */
this_mask &= ~outer_mask;
/* If tiling and we failed completely above, grab the next one
too. Making sure it doesn't hit an outer loop. */
if (tiling)
{
this_mask &= ~(loop->e_mask | loop->mask);
unsigned tile_mask = ((this_mask >> 1)
& ~(outer_mask | loop->e_mask | loop->mask));
if (tile_mask || loop->mask)
{
loop->e_mask |= this_mask;
this_mask = tile_mask;
}
if (!loop->e_mask && noisy)
warning_at (loop->loc, 0,
"insufficient partitioning available"
" to parallelize element loop");
}
loop->mask |= this_mask;
if (!loop->mask && noisy)
warning_at (loop->loc, 0,
tiling
? G_("insufficient partitioning available"
" to parallelize tile loop")
: G_("insufficient partitioning available"
" to parallelize loop"));
}
if (assign && dump_file)
fprintf (dump_file, "Auto loop %s:%d assigned %d & %d\n",
LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc),
loop->mask, loop->e_mask);
unsigned inner_mask = 0;
if (loop->sibling)
inner_mask |= oacc_loop_auto_partitions (loop->sibling,
outer_mask, outer_assign);
inner_mask |= loop->inner | loop->mask | loop->e_mask;
return inner_mask;
} | /* Walk the OpenACC loop heirarchy to assign auto-partitioned loops.
OUTER_MASK is the partitioning this loop is contained within.
OUTER_ASSIGN is true if an outer loop is being auto-partitioned.
Return the cumulative partitioning used by this loop, siblings and
children. */ | Walk the OpenACC loop heirarchy to assign auto-partitioned loops.
OUTER_MASK is the partitioning this loop is contained within.
OUTER_ASSIGN is true if an outer loop is being auto-partitioned.
Return the cumulative partitioning used by this loop, siblings and
children. | [
"Walk",
"the",
"OpenACC",
"loop",
"heirarchy",
"to",
"assign",
"auto",
"-",
"partitioned",
"loops",
".",
"OUTER_MASK",
"is",
"the",
"partitioning",
"this",
"loop",
"is",
"contained",
"within",
".",
"OUTER_ASSIGN",
"is",
"true",
"if",
"an",
"outer",
"loop",
"is",
"being",
"auto",
"-",
"partitioned",
".",
"Return",
"the",
"cumulative",
"partitioning",
"used",
"by",
"this",
"loop",
"siblings",
"and",
"children",
"."
] | static unsigned
oacc_loop_auto_partitions (oacc_loop *loop, unsigned outer_mask,
bool outer_assign)
{
bool assign = (loop->flags & OLF_AUTO) && (loop->flags & OLF_INDEPENDENT);
bool noisy = true;
bool tiling = loop->flags & OLF_TILE;
#ifdef ACCEL_COMPILER
noisy = false;
#endif
if (assign && (!outer_assign || loop->inner))
{
unsigned this_mask = GOMP_DIM_MASK (GOMP_DIM_GANG);
while (this_mask <= outer_mask)
this_mask <<= 1;
if (tiling && !(loop->mask | loop->e_mask))
this_mask |= this_mask << 1;
this_mask &= GOMP_DIM_MASK (GOMP_DIM_MAX - 1) - 1;
this_mask &= ~loop->inner;
if (tiling && !loop->e_mask)
{
loop->e_mask = this_mask & (this_mask << 1);
this_mask ^= loop->e_mask;
}
loop->mask |= this_mask;
}
if (loop->child)
{
unsigned tmp_mask = outer_mask | loop->mask | loop->e_mask;
loop->inner = oacc_loop_auto_partitions (loop->child, tmp_mask,
outer_assign | assign);
}
if (assign && (!loop->mask || (tiling && !loop->e_mask) || !outer_assign))
{
unsigned this_mask = 0;
this_mask = loop->inner | GOMP_DIM_MASK (GOMP_DIM_MAX);
this_mask = least_bit_hwi (this_mask);
this_mask >>= 1;
this_mask &= ~outer_mask;
if (tiling)
{
this_mask &= ~(loop->e_mask | loop->mask);
unsigned tile_mask = ((this_mask >> 1)
& ~(outer_mask | loop->e_mask | loop->mask));
if (tile_mask || loop->mask)
{
loop->e_mask |= this_mask;
this_mask = tile_mask;
}
if (!loop->e_mask && noisy)
warning_at (loop->loc, 0,
"insufficient partitioning available"
" to parallelize element loop");
}
loop->mask |= this_mask;
if (!loop->mask && noisy)
warning_at (loop->loc, 0,
tiling
? G_("insufficient partitioning available"
" to parallelize tile loop")
: G_("insufficient partitioning available"
" to parallelize loop"));
}
if (assign && dump_file)
fprintf (dump_file, "Auto loop %s:%d assigned %d & %d\n",
LOCATION_FILE (loop->loc), LOCATION_LINE (loop->loc),
loop->mask, loop->e_mask);
unsigned inner_mask = 0;
if (loop->sibling)
inner_mask |= oacc_loop_auto_partitions (loop->sibling,
outer_mask, outer_assign);
inner_mask |= loop->inner | loop->mask | loop->e_mask;
return inner_mask;
} | [
"static",
"unsigned",
"oacc_loop_auto_partitions",
"(",
"oacc_loop",
"*",
"loop",
",",
"unsigned",
"outer_mask",
",",
"bool",
"outer_assign",
")",
"{",
"bool",
"assign",
"=",
"(",
"loop",
"->",
"flags",
"&",
"OLF_AUTO",
")",
"&&",
"(",
"loop",
"->",
"flags",
"&",
"OLF_INDEPENDENT",
")",
";",
"bool",
"noisy",
"=",
"true",
";",
"bool",
"tiling",
"=",
"loop",
"->",
"flags",
"&",
"OLF_TILE",
";",
"#ifdef",
"ACCEL_COMPILER",
"noisy",
"=",
"false",
";",
"#endif",
"if",
"(",
"assign",
"&&",
"(",
"!",
"outer_assign",
"||",
"loop",
"->",
"inner",
")",
")",
"{",
"unsigned",
"this_mask",
"=",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_GANG",
")",
";",
"while",
"(",
"this_mask",
"<=",
"outer_mask",
")",
"this_mask",
"<<=",
"1",
";",
"if",
"(",
"tiling",
"&&",
"!",
"(",
"loop",
"->",
"mask",
"|",
"loop",
"->",
"e_mask",
")",
")",
"this_mask",
"|=",
"this_mask",
"<<",
"1",
";",
"this_mask",
"&=",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
"-",
"1",
")",
"-",
"1",
";",
"this_mask",
"&=",
"~",
"loop",
"->",
"inner",
";",
"if",
"(",
"tiling",
"&&",
"!",
"loop",
"->",
"e_mask",
")",
"{",
"loop",
"->",
"e_mask",
"=",
"this_mask",
"&",
"(",
"this_mask",
"<<",
"1",
")",
";",
"this_mask",
"^=",
"loop",
"->",
"e_mask",
";",
"}",
"loop",
"->",
"mask",
"|=",
"this_mask",
";",
"}",
"if",
"(",
"loop",
"->",
"child",
")",
"{",
"unsigned",
"tmp_mask",
"=",
"outer_mask",
"|",
"loop",
"->",
"mask",
"|",
"loop",
"->",
"e_mask",
";",
"loop",
"->",
"inner",
"=",
"oacc_loop_auto_partitions",
"(",
"loop",
"->",
"child",
",",
"tmp_mask",
",",
"outer_assign",
"|",
"assign",
")",
";",
"}",
"if",
"(",
"assign",
"&&",
"(",
"!",
"loop",
"->",
"mask",
"||",
"(",
"tiling",
"&&",
"!",
"loop",
"->",
"e_mask",
")",
"||",
"!",
"outer_assign",
")",
")",
"{",
"unsigned",
"this_mask",
"=",
"0",
";",
"this_mask",
"=",
"loop",
"->",
"inner",
"|",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
")",
";",
"this_mask",
"=",
"least_bit_hwi",
"(",
"this_mask",
")",
";",
"this_mask",
">>=",
"1",
";",
"this_mask",
"&=",
"~",
"outer_mask",
";",
"if",
"(",
"tiling",
")",
"{",
"this_mask",
"&=",
"~",
"(",
"loop",
"->",
"e_mask",
"|",
"loop",
"->",
"mask",
")",
";",
"unsigned",
"tile_mask",
"=",
"(",
"(",
"this_mask",
">>",
"1",
")",
"&",
"~",
"(",
"outer_mask",
"|",
"loop",
"->",
"e_mask",
"|",
"loop",
"->",
"mask",
")",
")",
";",
"if",
"(",
"tile_mask",
"||",
"loop",
"->",
"mask",
")",
"{",
"loop",
"->",
"e_mask",
"|=",
"this_mask",
";",
"this_mask",
"=",
"tile_mask",
";",
"}",
"if",
"(",
"!",
"loop",
"->",
"e_mask",
"&&",
"noisy",
")",
"warning_at",
"(",
"loop",
"->",
"loc",
",",
"0",
",",
"\"",
"\"",
"\"",
"\"",
")",
";",
"}",
"loop",
"->",
"mask",
"|=",
"this_mask",
";",
"if",
"(",
"!",
"loop",
"->",
"mask",
"&&",
"noisy",
")",
"warning_at",
"(",
"loop",
"->",
"loc",
",",
"0",
",",
"tiling",
"?",
"G_",
"(",
"\"",
"\"",
"\"",
"\"",
")",
":",
"G_",
"(",
"\"",
"\"",
"\"",
"\"",
")",
")",
";",
"}",
"if",
"(",
"assign",
"&&",
"dump_file",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"LOCATION_FILE",
"(",
"loop",
"->",
"loc",
")",
",",
"LOCATION_LINE",
"(",
"loop",
"->",
"loc",
")",
",",
"loop",
"->",
"mask",
",",
"loop",
"->",
"e_mask",
")",
";",
"unsigned",
"inner_mask",
"=",
"0",
";",
"if",
"(",
"loop",
"->",
"sibling",
")",
"inner_mask",
"|=",
"oacc_loop_auto_partitions",
"(",
"loop",
"->",
"sibling",
",",
"outer_mask",
",",
"outer_assign",
")",
";",
"inner_mask",
"|=",
"loop",
"->",
"inner",
"|",
"loop",
"->",
"mask",
"|",
"loop",
"->",
"e_mask",
";",
"return",
"inner_mask",
";",
"}"
] | Walk the OpenACC loop heirarchy to assign auto-partitioned loops. | [
"Walk",
"the",
"OpenACC",
"loop",
"heirarchy",
"to",
"assign",
"auto",
"-",
"partitioned",
"loops",
"."
] | [
"/* When device_type is supported, we want the device compiler to be\n noisy, if the loop parameters are device_type-specific. */",
"/* Allocate outermost and non-innermost loops at the outermost\n\t non-innermost available level. */",
"/* Find the first outermost available partition. */",
"/* Grab two axes if tiling, and we've not assigned anything */",
"/* Prohibit the innermost partitioning at the moment. */",
"/* Don't use any dimension explicitly claimed by an inner loop. */",
"/* If we got two axes, allocate the inner one to the element\n\t loop. */",
"/* Allocate the loop at the innermost available level. Note\n\t that we do this even if we already assigned this loop the\n\t outermost available level above. That way we'll partition\n\t this along 2 axes, if they are available. */",
"/* Determine the outermost partitioning used within this loop. */",
"/* Pick the partitioning just inside that one. */",
"/* And avoid picking one use by an outer loop. */",
"/* If tiling and we failed completely above, grab the next one\n\t too. Making sure it doesn't hit an outer loop. */"
] | [
{
"param": "loop",
"type": "oacc_loop"
},
{
"param": "outer_mask",
"type": "unsigned"
},
{
"param": "outer_assign",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outer_mask",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outer_assign",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | oacc_loop_partition | null | static unsigned
oacc_loop_partition (oacc_loop *loop, unsigned outer_mask)
{
unsigned mask_all = oacc_loop_fixed_partitions (loop, outer_mask);
if (mask_all & GOMP_DIM_MASK (GOMP_DIM_MAX))
{
mask_all ^= GOMP_DIM_MASK (GOMP_DIM_MAX);
mask_all |= oacc_loop_auto_partitions (loop, outer_mask, false);
}
return mask_all;
} | /* Walk the OpenACC loop heirarchy to check and assign partitioning
axes. Return mask of partitioning. */ | Walk the OpenACC loop heirarchy to check and assign partitioning
axes. Return mask of partitioning. | [
"Walk",
"the",
"OpenACC",
"loop",
"heirarchy",
"to",
"check",
"and",
"assign",
"partitioning",
"axes",
".",
"Return",
"mask",
"of",
"partitioning",
"."
] | static unsigned
oacc_loop_partition (oacc_loop *loop, unsigned outer_mask)
{
unsigned mask_all = oacc_loop_fixed_partitions (loop, outer_mask);
if (mask_all & GOMP_DIM_MASK (GOMP_DIM_MAX))
{
mask_all ^= GOMP_DIM_MASK (GOMP_DIM_MAX);
mask_all |= oacc_loop_auto_partitions (loop, outer_mask, false);
}
return mask_all;
} | [
"static",
"unsigned",
"oacc_loop_partition",
"(",
"oacc_loop",
"*",
"loop",
",",
"unsigned",
"outer_mask",
")",
"{",
"unsigned",
"mask_all",
"=",
"oacc_loop_fixed_partitions",
"(",
"loop",
",",
"outer_mask",
")",
";",
"if",
"(",
"mask_all",
"&",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
")",
")",
"{",
"mask_all",
"^=",
"GOMP_DIM_MASK",
"(",
"GOMP_DIM_MAX",
")",
";",
"mask_all",
"|=",
"oacc_loop_auto_partitions",
"(",
"loop",
",",
"outer_mask",
",",
"false",
")",
";",
"}",
"return",
"mask_all",
";",
"}"
] | Walk the OpenACC loop heirarchy to check and assign partitioning
axes. | [
"Walk",
"the",
"OpenACC",
"loop",
"heirarchy",
"to",
"check",
"and",
"assign",
"partitioning",
"axes",
"."
] | [] | [
{
"param": "loop",
"type": "oacc_loop"
},
{
"param": "outer_mask",
"type": "unsigned"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "loop",
"type": "oacc_loop",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "outer_mask",
"type": "unsigned",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | default_goacc_fork_join | bool | bool
default_goacc_fork_join (gcall *ARG_UNUSED (call),
const int *ARG_UNUSED (dims), bool is_fork)
{
if (is_fork)
return targetm.have_oacc_fork ();
else
return targetm.have_oacc_join ();
} | /* Default fork/join early expander. Delete the function calls if
there is no RTL expander. */ | Default fork/join early expander. Delete the function calls if
there is no RTL expander. | [
"Default",
"fork",
"/",
"join",
"early",
"expander",
".",
"Delete",
"the",
"function",
"calls",
"if",
"there",
"is",
"no",
"RTL",
"expander",
"."
] | bool
default_goacc_fork_join (gcall *ARG_UNUSED (call),
const int *ARG_UNUSED (dims), bool is_fork)
{
if (is_fork)
return targetm.have_oacc_fork ();
else
return targetm.have_oacc_join ();
} | [
"bool",
"default_goacc_fork_join",
"(",
"gcall",
"*",
"ARG_UNUSED",
"(",
"call",
")",
",",
"const",
"int",
"*",
"ARG_UNUSED",
"(",
"dims",
")",
",",
"bool",
"is_fork",
")",
"{",
"if",
"(",
"is_fork",
")",
"return",
"targetm",
".",
"have_oacc_fork",
"(",
")",
";",
"else",
"return",
"targetm",
".",
"have_oacc_join",
"(",
")",
";",
"}"
] | Default fork/join early expander. | [
"Default",
"fork",
"/",
"join",
"early",
"expander",
"."
] | [] | [
{
"param": "ARG_UNUSED",
"type": "int"
},
{
"param": "is_fork",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ARG_UNUSED",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "is_fork",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | default_goacc_validate_dims | bool | bool
default_goacc_validate_dims (tree ARG_UNUSED (decl), int *dims,
int ARG_UNUSED (fn_level))
{
bool changed = false;
for (unsigned ix = 0; ix != GOMP_DIM_MAX; ix++)
{
if (dims[ix] != 1)
{
dims[ix] = 1;
changed = true;
}
}
return changed;
} | /* Default launch dimension validator. Force everything to 1. A
backend that wants to provide larger dimensions must override this
hook. */ | Default launch dimension validator. Force everything to 1. A
backend that wants to provide larger dimensions must override this
hook. | [
"Default",
"launch",
"dimension",
"validator",
".",
"Force",
"everything",
"to",
"1",
".",
"A",
"backend",
"that",
"wants",
"to",
"provide",
"larger",
"dimensions",
"must",
"override",
"this",
"hook",
"."
] | bool
default_goacc_validate_dims (tree ARG_UNUSED (decl), int *dims,
int ARG_UNUSED (fn_level))
{
bool changed = false;
for (unsigned ix = 0; ix != GOMP_DIM_MAX; ix++)
{
if (dims[ix] != 1)
{
dims[ix] = 1;
changed = true;
}
}
return changed;
} | [
"bool",
"default_goacc_validate_dims",
"(",
"tree",
"ARG_UNUSED",
"(",
"decl",
")",
",",
"int",
"*",
"dims",
",",
"int",
"ARG_UNUSED",
"(",
"fn_level",
")",
")",
"{",
"bool",
"changed",
"=",
"false",
";",
"for",
"(",
"unsigned",
"ix",
"=",
"0",
";",
"ix",
"!=",
"GOMP_DIM_MAX",
";",
"ix",
"++",
")",
"{",
"if",
"(",
"dims",
"[",
"ix",
"]",
"!=",
"1",
")",
"{",
"dims",
"[",
"ix",
"]",
"=",
"1",
";",
"changed",
"=",
"true",
";",
"}",
"}",
"return",
"changed",
";",
"}"
] | Default launch dimension validator. | [
"Default",
"launch",
"dimension",
"validator",
"."
] | [] | [
{
"param": "ARG_UNUSED",
"type": "int"
},
{
"param": "dims",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ARG_UNUSED",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "dims",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | default_goacc_dim_limit | int | int
default_goacc_dim_limit (int ARG_UNUSED (axis))
{
#ifdef ACCEL_COMPILER
return 0;
#else
return 1;
#endif
} | /* Default dimension bound is unknown on accelerator and 1 on host. */ | Default dimension bound is unknown on accelerator and 1 on host. | [
"Default",
"dimension",
"bound",
"is",
"unknown",
"on",
"accelerator",
"and",
"1",
"on",
"host",
"."
] | int
default_goacc_dim_limit (int ARG_UNUSED (axis))
{
#ifdef ACCEL_COMPILER
return 0;
#else
return 1;
#endif
} | [
"int",
"default_goacc_dim_limit",
"(",
"int",
"ARG_UNUSED",
"(",
"axis",
")",
")",
"{",
"#ifdef",
"ACCEL_COMPILER",
"return",
"0",
";",
"#else",
"return",
"1",
";",
"#endif",
"}"
] | Default dimension bound is unknown on accelerator and 1 on host. | [
"Default",
"dimension",
"bound",
"is",
"unknown",
"on",
"accelerator",
"and",
"1",
"on",
"host",
"."
] | [] | [
{
"param": "ARG_UNUSED",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ARG_UNUSED",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | ompdevlow_adjust_simt_enter | void | static void
ompdevlow_adjust_simt_enter (gimple_stmt_iterator *gsi, bool *regimplify)
{
gimple *alloc_stmt = gsi_stmt (*gsi);
tree simtrec = gimple_call_lhs (alloc_stmt);
tree simduid = gimple_call_arg (alloc_stmt, 0);
gimple *enter_stmt = SSA_NAME_DEF_STMT (simduid);
gcc_assert (gimple_call_internal_p (enter_stmt, IFN_GOMP_SIMT_ENTER));
tree rectype = lang_hooks.types.make_type (RECORD_TYPE);
TYPE_ARTIFICIAL (rectype) = TYPE_NAMELESS (rectype) = 1;
TREE_ADDRESSABLE (rectype) = 1;
TREE_TYPE (simtrec) = build_pointer_type (rectype);
for (unsigned i = 1; i < gimple_call_num_args (enter_stmt); i++)
{
tree *argp = gimple_call_arg_ptr (enter_stmt, i);
if (*argp == null_pointer_node)
continue;
gcc_assert (TREE_CODE (*argp) == ADDR_EXPR
&& VAR_P (TREE_OPERAND (*argp, 0)));
tree var = TREE_OPERAND (*argp, 0);
tree field = build_decl (DECL_SOURCE_LOCATION (var), FIELD_DECL,
DECL_NAME (var), TREE_TYPE (var));
SET_DECL_ALIGN (field, DECL_ALIGN (var));
DECL_USER_ALIGN (field) = DECL_USER_ALIGN (var);
TREE_THIS_VOLATILE (field) = TREE_THIS_VOLATILE (var);
insert_field_into_struct (rectype, field);
tree t = build_simple_mem_ref (simtrec);
t = build3 (COMPONENT_REF, TREE_TYPE (var), t, field, NULL);
TREE_THIS_VOLATILE (t) = TREE_THIS_VOLATILE (var);
SET_DECL_VALUE_EXPR (var, t);
DECL_HAS_VALUE_EXPR_P (var) = 1;
*regimplify = true;
}
layout_type (rectype);
tree size = TYPE_SIZE_UNIT (rectype);
tree align = build_int_cst (TREE_TYPE (size), TYPE_ALIGN_UNIT (rectype));
alloc_stmt
= gimple_build_call_internal (IFN_GOMP_SIMT_ENTER_ALLOC, 2, size, align);
gimple_call_set_lhs (alloc_stmt, simtrec);
gsi_replace (gsi, alloc_stmt, false);
gimple_stmt_iterator enter_gsi = gsi_for_stmt (enter_stmt);
enter_stmt = gimple_build_assign (simduid, gimple_call_arg (enter_stmt, 0));
gsi_replace (&enter_gsi, enter_stmt, false);
use_operand_p use;
gimple *exit_stmt;
if (single_imm_use (simtrec, &use, &exit_stmt))
{
gcc_assert (gimple_call_internal_p (exit_stmt, IFN_GOMP_SIMT_EXIT));
gimple_stmt_iterator exit_gsi = gsi_for_stmt (exit_stmt);
tree clobber = build_constructor (rectype, NULL);
TREE_THIS_VOLATILE (clobber) = 1;
exit_stmt = gimple_build_assign (build_simple_mem_ref (simtrec), clobber);
gsi_insert_before (&exit_gsi, exit_stmt, GSI_SAME_STMT);
}
else
gcc_checking_assert (has_zero_uses (simtrec));
} | /* Rewrite GOMP_SIMT_ENTER_ALLOC call given by GSI and remove the preceding
GOMP_SIMT_ENTER call identifying the privatized variables, which are
turned to structure fields and receive a DECL_VALUE_EXPR accordingly.
Set *REGIMPLIFY to true, except if no privatized variables were seen. */ | Rewrite GOMP_SIMT_ENTER_ALLOC call given by GSI and remove the preceding
GOMP_SIMT_ENTER call identifying the privatized variables, which are
turned to structure fields and receive a DECL_VALUE_EXPR accordingly.
Set *REGIMPLIFY to true, except if no privatized variables were seen. | [
"Rewrite",
"GOMP_SIMT_ENTER_ALLOC",
"call",
"given",
"by",
"GSI",
"and",
"remove",
"the",
"preceding",
"GOMP_SIMT_ENTER",
"call",
"identifying",
"the",
"privatized",
"variables",
"which",
"are",
"turned",
"to",
"structure",
"fields",
"and",
"receive",
"a",
"DECL_VALUE_EXPR",
"accordingly",
".",
"Set",
"*",
"REGIMPLIFY",
"to",
"true",
"except",
"if",
"no",
"privatized",
"variables",
"were",
"seen",
"."
] | static void
ompdevlow_adjust_simt_enter (gimple_stmt_iterator *gsi, bool *regimplify)
{
gimple *alloc_stmt = gsi_stmt (*gsi);
tree simtrec = gimple_call_lhs (alloc_stmt);
tree simduid = gimple_call_arg (alloc_stmt, 0);
gimple *enter_stmt = SSA_NAME_DEF_STMT (simduid);
gcc_assert (gimple_call_internal_p (enter_stmt, IFN_GOMP_SIMT_ENTER));
tree rectype = lang_hooks.types.make_type (RECORD_TYPE);
TYPE_ARTIFICIAL (rectype) = TYPE_NAMELESS (rectype) = 1;
TREE_ADDRESSABLE (rectype) = 1;
TREE_TYPE (simtrec) = build_pointer_type (rectype);
for (unsigned i = 1; i < gimple_call_num_args (enter_stmt); i++)
{
tree *argp = gimple_call_arg_ptr (enter_stmt, i);
if (*argp == null_pointer_node)
continue;
gcc_assert (TREE_CODE (*argp) == ADDR_EXPR
&& VAR_P (TREE_OPERAND (*argp, 0)));
tree var = TREE_OPERAND (*argp, 0);
tree field = build_decl (DECL_SOURCE_LOCATION (var), FIELD_DECL,
DECL_NAME (var), TREE_TYPE (var));
SET_DECL_ALIGN (field, DECL_ALIGN (var));
DECL_USER_ALIGN (field) = DECL_USER_ALIGN (var);
TREE_THIS_VOLATILE (field) = TREE_THIS_VOLATILE (var);
insert_field_into_struct (rectype, field);
tree t = build_simple_mem_ref (simtrec);
t = build3 (COMPONENT_REF, TREE_TYPE (var), t, field, NULL);
TREE_THIS_VOLATILE (t) = TREE_THIS_VOLATILE (var);
SET_DECL_VALUE_EXPR (var, t);
DECL_HAS_VALUE_EXPR_P (var) = 1;
*regimplify = true;
}
layout_type (rectype);
tree size = TYPE_SIZE_UNIT (rectype);
tree align = build_int_cst (TREE_TYPE (size), TYPE_ALIGN_UNIT (rectype));
alloc_stmt
= gimple_build_call_internal (IFN_GOMP_SIMT_ENTER_ALLOC, 2, size, align);
gimple_call_set_lhs (alloc_stmt, simtrec);
gsi_replace (gsi, alloc_stmt, false);
gimple_stmt_iterator enter_gsi = gsi_for_stmt (enter_stmt);
enter_stmt = gimple_build_assign (simduid, gimple_call_arg (enter_stmt, 0));
gsi_replace (&enter_gsi, enter_stmt, false);
use_operand_p use;
gimple *exit_stmt;
if (single_imm_use (simtrec, &use, &exit_stmt))
{
gcc_assert (gimple_call_internal_p (exit_stmt, IFN_GOMP_SIMT_EXIT));
gimple_stmt_iterator exit_gsi = gsi_for_stmt (exit_stmt);
tree clobber = build_constructor (rectype, NULL);
TREE_THIS_VOLATILE (clobber) = 1;
exit_stmt = gimple_build_assign (build_simple_mem_ref (simtrec), clobber);
gsi_insert_before (&exit_gsi, exit_stmt, GSI_SAME_STMT);
}
else
gcc_checking_assert (has_zero_uses (simtrec));
} | [
"static",
"void",
"ompdevlow_adjust_simt_enter",
"(",
"gimple_stmt_iterator",
"*",
"gsi",
",",
"bool",
"*",
"regimplify",
")",
"{",
"gimple",
"*",
"alloc_stmt",
"=",
"gsi_stmt",
"(",
"*",
"gsi",
")",
";",
"tree",
"simtrec",
"=",
"gimple_call_lhs",
"(",
"alloc_stmt",
")",
";",
"tree",
"simduid",
"=",
"gimple_call_arg",
"(",
"alloc_stmt",
",",
"0",
")",
";",
"gimple",
"*",
"enter_stmt",
"=",
"SSA_NAME_DEF_STMT",
"(",
"simduid",
")",
";",
"gcc_assert",
"(",
"gimple_call_internal_p",
"(",
"enter_stmt",
",",
"IFN_GOMP_SIMT_ENTER",
")",
")",
";",
"tree",
"rectype",
"=",
"lang_hooks",
".",
"types",
".",
"make_type",
"(",
"RECORD_TYPE",
")",
";",
"TYPE_ARTIFICIAL",
"(",
"rectype",
")",
"=",
"TYPE_NAMELESS",
"(",
"rectype",
")",
"=",
"1",
";",
"TREE_ADDRESSABLE",
"(",
"rectype",
")",
"=",
"1",
";",
"TREE_TYPE",
"(",
"simtrec",
")",
"=",
"build_pointer_type",
"(",
"rectype",
")",
";",
"for",
"(",
"unsigned",
"i",
"=",
"1",
";",
"i",
"<",
"gimple_call_num_args",
"(",
"enter_stmt",
")",
";",
"i",
"++",
")",
"{",
"tree",
"*",
"argp",
"=",
"gimple_call_arg_ptr",
"(",
"enter_stmt",
",",
"i",
")",
";",
"if",
"(",
"*",
"argp",
"==",
"null_pointer_node",
")",
"continue",
";",
"gcc_assert",
"(",
"TREE_CODE",
"(",
"*",
"argp",
")",
"==",
"ADDR_EXPR",
"&&",
"VAR_P",
"(",
"TREE_OPERAND",
"(",
"*",
"argp",
",",
"0",
")",
")",
")",
";",
"tree",
"var",
"=",
"TREE_OPERAND",
"(",
"*",
"argp",
",",
"0",
")",
";",
"tree",
"field",
"=",
"build_decl",
"(",
"DECL_SOURCE_LOCATION",
"(",
"var",
")",
",",
"FIELD_DECL",
",",
"DECL_NAME",
"(",
"var",
")",
",",
"TREE_TYPE",
"(",
"var",
")",
")",
";",
"SET_DECL_ALIGN",
"(",
"field",
",",
"DECL_ALIGN",
"(",
"var",
")",
")",
";",
"DECL_USER_ALIGN",
"(",
"field",
")",
"=",
"DECL_USER_ALIGN",
"(",
"var",
")",
";",
"TREE_THIS_VOLATILE",
"(",
"field",
")",
"=",
"TREE_THIS_VOLATILE",
"(",
"var",
")",
";",
"insert_field_into_struct",
"(",
"rectype",
",",
"field",
")",
";",
"tree",
"t",
"=",
"build_simple_mem_ref",
"(",
"simtrec",
")",
";",
"t",
"=",
"build3",
"(",
"COMPONENT_REF",
",",
"TREE_TYPE",
"(",
"var",
")",
",",
"t",
",",
"field",
",",
"NULL",
")",
";",
"TREE_THIS_VOLATILE",
"(",
"t",
")",
"=",
"TREE_THIS_VOLATILE",
"(",
"var",
")",
";",
"SET_DECL_VALUE_EXPR",
"(",
"var",
",",
"t",
")",
";",
"DECL_HAS_VALUE_EXPR_P",
"(",
"var",
")",
"=",
"1",
";",
"*",
"regimplify",
"=",
"true",
";",
"}",
"layout_type",
"(",
"rectype",
")",
";",
"tree",
"size",
"=",
"TYPE_SIZE_UNIT",
"(",
"rectype",
")",
";",
"tree",
"align",
"=",
"build_int_cst",
"(",
"TREE_TYPE",
"(",
"size",
")",
",",
"TYPE_ALIGN_UNIT",
"(",
"rectype",
")",
")",
";",
"alloc_stmt",
"=",
"gimple_build_call_internal",
"(",
"IFN_GOMP_SIMT_ENTER_ALLOC",
",",
"2",
",",
"size",
",",
"align",
")",
";",
"gimple_call_set_lhs",
"(",
"alloc_stmt",
",",
"simtrec",
")",
";",
"gsi_replace",
"(",
"gsi",
",",
"alloc_stmt",
",",
"false",
")",
";",
"gimple_stmt_iterator",
"enter_gsi",
"=",
"gsi_for_stmt",
"(",
"enter_stmt",
")",
";",
"enter_stmt",
"=",
"gimple_build_assign",
"(",
"simduid",
",",
"gimple_call_arg",
"(",
"enter_stmt",
",",
"0",
")",
")",
";",
"gsi_replace",
"(",
"&",
"enter_gsi",
",",
"enter_stmt",
",",
"false",
")",
";",
"use_operand_p",
"use",
";",
"gimple",
"*",
"exit_stmt",
";",
"if",
"(",
"single_imm_use",
"(",
"simtrec",
",",
"&",
"use",
",",
"&",
"exit_stmt",
")",
")",
"{",
"gcc_assert",
"(",
"gimple_call_internal_p",
"(",
"exit_stmt",
",",
"IFN_GOMP_SIMT_EXIT",
")",
")",
";",
"gimple_stmt_iterator",
"exit_gsi",
"=",
"gsi_for_stmt",
"(",
"exit_stmt",
")",
";",
"tree",
"clobber",
"=",
"build_constructor",
"(",
"rectype",
",",
"NULL",
")",
";",
"TREE_THIS_VOLATILE",
"(",
"clobber",
")",
"=",
"1",
";",
"exit_stmt",
"=",
"gimple_build_assign",
"(",
"build_simple_mem_ref",
"(",
"simtrec",
")",
",",
"clobber",
")",
";",
"gsi_insert_before",
"(",
"&",
"exit_gsi",
",",
"exit_stmt",
",",
"GSI_SAME_STMT",
")",
";",
"}",
"else",
"gcc_checking_assert",
"(",
"has_zero_uses",
"(",
"simtrec",
")",
")",
";",
"}"
] | Rewrite GOMP_SIMT_ENTER_ALLOC call given by GSI and remove the preceding
GOMP_SIMT_ENTER call identifying the privatized variables, which are
turned to structure fields and receive a DECL_VALUE_EXPR accordingly. | [
"Rewrite",
"GOMP_SIMT_ENTER_ALLOC",
"call",
"given",
"by",
"GSI",
"and",
"remove",
"the",
"preceding",
"GOMP_SIMT_ENTER",
"call",
"identifying",
"the",
"privatized",
"variables",
"which",
"are",
"turned",
"to",
"structure",
"fields",
"and",
"receive",
"a",
"DECL_VALUE_EXPR",
"accordingly",
"."
] | [] | [
{
"param": "gsi",
"type": "gimple_stmt_iterator"
},
{
"param": "regimplify",
"type": "bool"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "gsi",
"type": "gimple_stmt_iterator",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "regimplify",
"type": "bool",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | find_simtpriv_var_op | tree | static tree
find_simtpriv_var_op (tree *tp, int *walk_subtrees, void *)
{
tree t = *tp;
if (VAR_P (t)
&& DECL_HAS_VALUE_EXPR_P (t)
&& lookup_attribute ("omp simt private", DECL_ATTRIBUTES (t)))
{
*walk_subtrees = 0;
return t;
}
return NULL_TREE;
} | /* Callback for walk_gimple_stmt used to scan for SIMT-privatized variables. */ | Callback for walk_gimple_stmt used to scan for SIMT-privatized variables. | [
"Callback",
"for",
"walk_gimple_stmt",
"used",
"to",
"scan",
"for",
"SIMT",
"-",
"privatized",
"variables",
"."
] | static tree
find_simtpriv_var_op (tree *tp, int *walk_subtrees, void *)
{
tree t = *tp;
if (VAR_P (t)
&& DECL_HAS_VALUE_EXPR_P (t)
&& lookup_attribute ("omp simt private", DECL_ATTRIBUTES (t)))
{
*walk_subtrees = 0;
return t;
}
return NULL_TREE;
} | [
"static",
"tree",
"find_simtpriv_var_op",
"(",
"tree",
"*",
"tp",
",",
"int",
"*",
"walk_subtrees",
",",
"void",
"*",
")",
"{",
"tree",
"t",
"=",
"*",
"tp",
";",
"if",
"(",
"VAR_P",
"(",
"t",
")",
"&&",
"DECL_HAS_VALUE_EXPR_P",
"(",
"t",
")",
"&&",
"lookup_attribute",
"(",
"\"",
"\"",
",",
"DECL_ATTRIBUTES",
"(",
"t",
")",
")",
")",
"{",
"*",
"walk_subtrees",
"=",
"0",
";",
"return",
"t",
";",
"}",
"return",
"NULL_TREE",
";",
"}"
] | Callback for walk_gimple_stmt used to scan for SIMT-privatized variables. | [
"Callback",
"for",
"walk_gimple_stmt",
"used",
"to",
"scan",
"for",
"SIMT",
"-",
"privatized",
"variables",
"."
] | [] | [
{
"param": "tp",
"type": "tree"
},
{
"param": "walk_subtrees",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "walk_subtrees",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | execute_omp_device_lower | null | static unsigned int
execute_omp_device_lower ()
{
int vf = targetm.simt.vf ? targetm.simt.vf () : 1;
bool regimplify = false;
basic_block bb;
gimple_stmt_iterator gsi;
FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
if (!is_gimple_call (stmt) || !gimple_call_internal_p (stmt))
continue;
tree lhs = gimple_call_lhs (stmt), rhs = NULL_TREE;
tree type = lhs ? TREE_TYPE (lhs) : integer_type_node;
switch (gimple_call_internal_fn (stmt))
{
case IFN_GOMP_USE_SIMT:
rhs = vf == 1 ? integer_zero_node : integer_one_node;
break;
case IFN_GOMP_SIMT_ENTER:
rhs = vf == 1 ? gimple_call_arg (stmt, 0) : NULL_TREE;
goto simtreg_enter_exit;
case IFN_GOMP_SIMT_ENTER_ALLOC:
if (vf != 1)
ompdevlow_adjust_simt_enter (&gsi, ®implify);
rhs = vf == 1 ? null_pointer_node : NULL_TREE;
goto simtreg_enter_exit;
case IFN_GOMP_SIMT_EXIT:
simtreg_enter_exit:
if (vf != 1)
continue;
unlink_stmt_vdef (stmt);
break;
case IFN_GOMP_SIMT_LANE:
case IFN_GOMP_SIMT_LAST_LANE:
rhs = vf == 1 ? build_zero_cst (type) : NULL_TREE;
break;
case IFN_GOMP_SIMT_VF:
rhs = build_int_cst (type, vf);
break;
case IFN_GOMP_SIMT_ORDERED_PRED:
rhs = vf == 1 ? integer_zero_node : NULL_TREE;
if (rhs || !lhs)
unlink_stmt_vdef (stmt);
break;
case IFN_GOMP_SIMT_VOTE_ANY:
case IFN_GOMP_SIMT_XCHG_BFLY:
case IFN_GOMP_SIMT_XCHG_IDX:
rhs = vf == 1 ? gimple_call_arg (stmt, 0) : NULL_TREE;
break;
case IFN_GOMP_SIMD_LANE:
case IFN_GOMP_SIMD_LAST_LANE:
rhs = vf != 1 ? build_zero_cst (type) : NULL_TREE;
break;
case IFN_GOMP_SIMD_VF:
rhs = vf != 1 ? build_one_cst (type) : NULL_TREE;
break;
default:
continue;
}
if (lhs && !rhs)
continue;
stmt = lhs ? gimple_build_assign (lhs, rhs) : gimple_build_nop ();
gsi_replace (&gsi, stmt, false);
}
if (regimplify)
FOR_EACH_BB_REVERSE_FN (bb, cfun)
for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
if (walk_gimple_stmt (&gsi, NULL, find_simtpriv_var_op, NULL))
{
if (gimple_clobber_p (gsi_stmt (gsi)))
gsi_remove (&gsi, true);
else
gimple_regimplify_operands (gsi_stmt (gsi), &gsi);
}
if (vf != 1)
cfun->has_force_vectorize_loops = false;
return 0;
} | /* Cleanup uses of SIMT placeholder internal functions: on non-SIMT targets,
VF is 1 and LANE is 0; on SIMT targets, VF is folded to a constant, and
LANE is kept to be expanded to RTL later on. Also cleanup all other SIMT
internal functions on non-SIMT targets, and likewise some SIMD internal
functions on SIMT targets. */ | Cleanup uses of SIMT placeholder internal functions: on non-SIMT targets,
VF is 1 and LANE is 0; on SIMT targets, VF is folded to a constant, and
LANE is kept to be expanded to RTL later on. Also cleanup all other SIMT
internal functions on non-SIMT targets, and likewise some SIMD internal
functions on SIMT targets. | [
"Cleanup",
"uses",
"of",
"SIMT",
"placeholder",
"internal",
"functions",
":",
"on",
"non",
"-",
"SIMT",
"targets",
"VF",
"is",
"1",
"and",
"LANE",
"is",
"0",
";",
"on",
"SIMT",
"targets",
"VF",
"is",
"folded",
"to",
"a",
"constant",
"and",
"LANE",
"is",
"kept",
"to",
"be",
"expanded",
"to",
"RTL",
"later",
"on",
".",
"Also",
"cleanup",
"all",
"other",
"SIMT",
"internal",
"functions",
"on",
"non",
"-",
"SIMT",
"targets",
"and",
"likewise",
"some",
"SIMD",
"internal",
"functions",
"on",
"SIMT",
"targets",
"."
] | static unsigned int
execute_omp_device_lower ()
{
int vf = targetm.simt.vf ? targetm.simt.vf () : 1;
bool regimplify = false;
basic_block bb;
gimple_stmt_iterator gsi;
FOR_EACH_BB_FN (bb, cfun)
for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi))
{
gimple *stmt = gsi_stmt (gsi);
if (!is_gimple_call (stmt) || !gimple_call_internal_p (stmt))
continue;
tree lhs = gimple_call_lhs (stmt), rhs = NULL_TREE;
tree type = lhs ? TREE_TYPE (lhs) : integer_type_node;
switch (gimple_call_internal_fn (stmt))
{
case IFN_GOMP_USE_SIMT:
rhs = vf == 1 ? integer_zero_node : integer_one_node;
break;
case IFN_GOMP_SIMT_ENTER:
rhs = vf == 1 ? gimple_call_arg (stmt, 0) : NULL_TREE;
goto simtreg_enter_exit;
case IFN_GOMP_SIMT_ENTER_ALLOC:
if (vf != 1)
ompdevlow_adjust_simt_enter (&gsi, ®implify);
rhs = vf == 1 ? null_pointer_node : NULL_TREE;
goto simtreg_enter_exit;
case IFN_GOMP_SIMT_EXIT:
simtreg_enter_exit:
if (vf != 1)
continue;
unlink_stmt_vdef (stmt);
break;
case IFN_GOMP_SIMT_LANE:
case IFN_GOMP_SIMT_LAST_LANE:
rhs = vf == 1 ? build_zero_cst (type) : NULL_TREE;
break;
case IFN_GOMP_SIMT_VF:
rhs = build_int_cst (type, vf);
break;
case IFN_GOMP_SIMT_ORDERED_PRED:
rhs = vf == 1 ? integer_zero_node : NULL_TREE;
if (rhs || !lhs)
unlink_stmt_vdef (stmt);
break;
case IFN_GOMP_SIMT_VOTE_ANY:
case IFN_GOMP_SIMT_XCHG_BFLY:
case IFN_GOMP_SIMT_XCHG_IDX:
rhs = vf == 1 ? gimple_call_arg (stmt, 0) : NULL_TREE;
break;
case IFN_GOMP_SIMD_LANE:
case IFN_GOMP_SIMD_LAST_LANE:
rhs = vf != 1 ? build_zero_cst (type) : NULL_TREE;
break;
case IFN_GOMP_SIMD_VF:
rhs = vf != 1 ? build_one_cst (type) : NULL_TREE;
break;
default:
continue;
}
if (lhs && !rhs)
continue;
stmt = lhs ? gimple_build_assign (lhs, rhs) : gimple_build_nop ();
gsi_replace (&gsi, stmt, false);
}
if (regimplify)
FOR_EACH_BB_REVERSE_FN (bb, cfun)
for (gsi = gsi_last_bb (bb); !gsi_end_p (gsi); gsi_prev (&gsi))
if (walk_gimple_stmt (&gsi, NULL, find_simtpriv_var_op, NULL))
{
if (gimple_clobber_p (gsi_stmt (gsi)))
gsi_remove (&gsi, true);
else
gimple_regimplify_operands (gsi_stmt (gsi), &gsi);
}
if (vf != 1)
cfun->has_force_vectorize_loops = false;
return 0;
} | [
"static",
"unsigned",
"int",
"execute_omp_device_lower",
"(",
")",
"{",
"int",
"vf",
"=",
"targetm",
".",
"simt",
".",
"vf",
"?",
"targetm",
".",
"simt",
".",
"vf",
"(",
")",
":",
"1",
";",
"bool",
"regimplify",
"=",
"false",
";",
"basic_block",
"bb",
";",
"gimple_stmt_iterator",
"gsi",
";",
"FOR_EACH_BB_FN",
"(",
"bb",
",",
"cfun",
")",
"",
"for",
"(",
"gsi",
"=",
"gsi_start_bb",
"(",
"bb",
")",
";",
"!",
"gsi_end_p",
"(",
"gsi",
")",
";",
"gsi_next",
"(",
"&",
"gsi",
")",
")",
"{",
"gimple",
"*",
"stmt",
"=",
"gsi_stmt",
"(",
"gsi",
")",
";",
"if",
"(",
"!",
"is_gimple_call",
"(",
"stmt",
")",
"||",
"!",
"gimple_call_internal_p",
"(",
"stmt",
")",
")",
"continue",
";",
"tree",
"lhs",
"=",
"gimple_call_lhs",
"(",
"stmt",
")",
",",
"rhs",
"=",
"NULL_TREE",
";",
"tree",
"type",
"=",
"lhs",
"?",
"TREE_TYPE",
"(",
"lhs",
")",
":",
"integer_type_node",
";",
"switch",
"(",
"gimple_call_internal_fn",
"(",
"stmt",
")",
")",
"{",
"case",
"IFN_GOMP_USE_SIMT",
":",
"rhs",
"=",
"vf",
"==",
"1",
"?",
"integer_zero_node",
":",
"integer_one_node",
";",
"break",
";",
"case",
"IFN_GOMP_SIMT_ENTER",
":",
"rhs",
"=",
"vf",
"==",
"1",
"?",
"gimple_call_arg",
"(",
"stmt",
",",
"0",
")",
":",
"NULL_TREE",
";",
"goto",
"simtreg_enter_exit",
";",
"case",
"IFN_GOMP_SIMT_ENTER_ALLOC",
":",
"if",
"(",
"vf",
"!=",
"1",
")",
"ompdevlow_adjust_simt_enter",
"(",
"&",
"gsi",
",",
"&",
"regimplify",
")",
";",
"rhs",
"=",
"vf",
"==",
"1",
"?",
"null_pointer_node",
":",
"NULL_TREE",
";",
"goto",
"simtreg_enter_exit",
";",
"case",
"IFN_GOMP_SIMT_EXIT",
":",
"simtreg_enter_exit",
":",
"if",
"(",
"vf",
"!=",
"1",
")",
"continue",
";",
"unlink_stmt_vdef",
"(",
"stmt",
")",
";",
"break",
";",
"case",
"IFN_GOMP_SIMT_LANE",
":",
"case",
"IFN_GOMP_SIMT_LAST_LANE",
":",
"rhs",
"=",
"vf",
"==",
"1",
"?",
"build_zero_cst",
"(",
"type",
")",
":",
"NULL_TREE",
";",
"break",
";",
"case",
"IFN_GOMP_SIMT_VF",
":",
"rhs",
"=",
"build_int_cst",
"(",
"type",
",",
"vf",
")",
";",
"break",
";",
"case",
"IFN_GOMP_SIMT_ORDERED_PRED",
":",
"rhs",
"=",
"vf",
"==",
"1",
"?",
"integer_zero_node",
":",
"NULL_TREE",
";",
"if",
"(",
"rhs",
"||",
"!",
"lhs",
")",
"unlink_stmt_vdef",
"(",
"stmt",
")",
";",
"break",
";",
"case",
"IFN_GOMP_SIMT_VOTE_ANY",
":",
"case",
"IFN_GOMP_SIMT_XCHG_BFLY",
":",
"case",
"IFN_GOMP_SIMT_XCHG_IDX",
":",
"rhs",
"=",
"vf",
"==",
"1",
"?",
"gimple_call_arg",
"(",
"stmt",
",",
"0",
")",
":",
"NULL_TREE",
";",
"break",
";",
"case",
"IFN_GOMP_SIMD_LANE",
":",
"case",
"IFN_GOMP_SIMD_LAST_LANE",
":",
"rhs",
"=",
"vf",
"!=",
"1",
"?",
"build_zero_cst",
"(",
"type",
")",
":",
"NULL_TREE",
";",
"break",
";",
"case",
"IFN_GOMP_SIMD_VF",
":",
"rhs",
"=",
"vf",
"!=",
"1",
"?",
"build_one_cst",
"(",
"type",
")",
":",
"NULL_TREE",
";",
"break",
";",
"default",
":",
"continue",
";",
"}",
"if",
"(",
"lhs",
"&&",
"!",
"rhs",
")",
"continue",
";",
"stmt",
"=",
"lhs",
"?",
"gimple_build_assign",
"(",
"lhs",
",",
"rhs",
")",
":",
"gimple_build_nop",
"(",
")",
";",
"gsi_replace",
"(",
"&",
"gsi",
",",
"stmt",
",",
"false",
")",
";",
"}",
"if",
"(",
"regimplify",
")",
"FOR_EACH_BB_REVERSE_FN",
"(",
"bb",
",",
"cfun",
")",
"",
"for",
"(",
"gsi",
"=",
"gsi_last_bb",
"(",
"bb",
")",
";",
"!",
"gsi_end_p",
"(",
"gsi",
")",
";",
"gsi_prev",
"(",
"&",
"gsi",
")",
")",
"if",
"(",
"walk_gimple_stmt",
"(",
"&",
"gsi",
",",
"NULL",
",",
"find_simtpriv_var_op",
",",
"NULL",
")",
")",
"{",
"if",
"(",
"gimple_clobber_p",
"(",
"gsi_stmt",
"(",
"gsi",
")",
")",
")",
"gsi_remove",
"(",
"&",
"gsi",
",",
"true",
")",
";",
"else",
"gimple_regimplify_operands",
"(",
"gsi_stmt",
"(",
"gsi",
")",
",",
"&",
"gsi",
")",
";",
"}",
"if",
"(",
"vf",
"!=",
"1",
")",
"cfun",
"->",
"has_force_vectorize_loops",
"=",
"false",
";",
"return",
"0",
";",
"}"
] | Cleanup uses of SIMT placeholder internal functions: on non-SIMT targets,
VF is 1 and LANE is 0; on SIMT targets, VF is folded to a constant, and
LANE is kept to be expanded to RTL later on. | [
"Cleanup",
"uses",
"of",
"SIMT",
"placeholder",
"internal",
"functions",
":",
"on",
"non",
"-",
"SIMT",
"targets",
"VF",
"is",
"1",
"and",
"LANE",
"is",
"0",
";",
"on",
"SIMT",
"targets",
"VF",
"is",
"folded",
"to",
"a",
"constant",
"and",
"LANE",
"is",
"kept",
"to",
"be",
"expanded",
"to",
"RTL",
"later",
"on",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
0abf0283c9e2db828dd98473e495eb93837cefbf | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/omp-offload.c | [
"BSD-3-Clause"
] | C | find_link_var_op | tree | static tree
find_link_var_op (tree *tp, int *walk_subtrees, void *)
{
tree t = *tp;
if (VAR_P (t)
&& DECL_HAS_VALUE_EXPR_P (t)
&& is_global_var (t)
&& lookup_attribute ("omp declare target link", DECL_ATTRIBUTES (t)))
{
*walk_subtrees = 0;
return t;
}
return NULL_TREE;
} | /* Callback for walk_gimple_stmt used to scan for link var operands. */ | Callback for walk_gimple_stmt used to scan for link var operands. | [
"Callback",
"for",
"walk_gimple_stmt",
"used",
"to",
"scan",
"for",
"link",
"var",
"operands",
"."
] | static tree
find_link_var_op (tree *tp, int *walk_subtrees, void *)
{
tree t = *tp;
if (VAR_P (t)
&& DECL_HAS_VALUE_EXPR_P (t)
&& is_global_var (t)
&& lookup_attribute ("omp declare target link", DECL_ATTRIBUTES (t)))
{
*walk_subtrees = 0;
return t;
}
return NULL_TREE;
} | [
"static",
"tree",
"find_link_var_op",
"(",
"tree",
"*",
"tp",
",",
"int",
"*",
"walk_subtrees",
",",
"void",
"*",
")",
"{",
"tree",
"t",
"=",
"*",
"tp",
";",
"if",
"(",
"VAR_P",
"(",
"t",
")",
"&&",
"DECL_HAS_VALUE_EXPR_P",
"(",
"t",
")",
"&&",
"is_global_var",
"(",
"t",
")",
"&&",
"lookup_attribute",
"(",
"\"",
"\"",
",",
"DECL_ATTRIBUTES",
"(",
"t",
")",
")",
")",
"{",
"*",
"walk_subtrees",
"=",
"0",
";",
"return",
"t",
";",
"}",
"return",
"NULL_TREE",
";",
"}"
] | Callback for walk_gimple_stmt used to scan for link var operands. | [
"Callback",
"for",
"walk_gimple_stmt",
"used",
"to",
"scan",
"for",
"link",
"var",
"operands",
"."
] | [] | [
{
"param": "tp",
"type": "tree"
},
{
"param": "walk_subtrees",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "tp",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "walk_subtrees",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | readline_line_completion_function | char | char *
readline_line_completion_function (const char *text, int matches)
{
return line_completion_function (text, matches,
rl_line_buffer, rl_point);
} | /* Line completion interface function for readline. */ | Line completion interface function for readline. | [
"Line",
"completion",
"interface",
"function",
"for",
"readline",
"."
] | char *
readline_line_completion_function (const char *text, int matches)
{
return line_completion_function (text, matches,
rl_line_buffer, rl_point);
} | [
"char",
"*",
"readline_line_completion_function",
"(",
"const",
"char",
"*",
"text",
",",
"int",
"matches",
")",
"{",
"return",
"line_completion_function",
"(",
"text",
",",
"matches",
",",
"rl_line_buffer",
",",
"rl_point",
")",
";",
"}"
] | Line completion interface function for readline. | [
"Line",
"completion",
"interface",
"function",
"for",
"readline",
"."
] | [] | [
{
"param": "text",
"type": "char"
},
{
"param": "matches",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "matches",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | noop_completer | null | VEC (char_ptr) *
noop_completer (struct cmd_list_element *ignore,
char *text, char *prefix)
{
return NULL;
} | /* This can be used for functions which don't want to complete on
symbols but don't want to complete on anything else either. */ | This can be used for functions which don't want to complete on
symbols but don't want to complete on anything else either. | [
"This",
"can",
"be",
"used",
"for",
"functions",
"which",
"don",
"'",
"t",
"want",
"to",
"complete",
"on",
"symbols",
"but",
"don",
"'",
"t",
"want",
"to",
"complete",
"on",
"anything",
"else",
"either",
"."
] | VEC (char_ptr) *
noop_completer (struct cmd_list_element *ignore,
char *text, char *prefix)
{
return NULL;
} | [
"VEC",
"(",
"char_ptr",
")",
"*",
"noop_completer",
"(",
"struct",
"cmd_list_element",
"*",
"ignore",
",",
"char",
"*",
"text",
",",
"char",
"*",
"prefix",
")",
"{",
"return",
"NULL",
";",
"}"
] | This can be used for functions which don't want to complete on
symbols but don't want to complete on anything else either. | [
"This",
"can",
"be",
"used",
"for",
"functions",
"which",
"don",
"'",
"t",
"want",
"to",
"complete",
"on",
"symbols",
"but",
"don",
"'",
"t",
"want",
"to",
"complete",
"on",
"anything",
"else",
"either",
"."
] | [] | [
{
"param": "ignore",
"type": "struct cmd_list_element"
},
{
"param": "text",
"type": "char"
},
{
"param": "prefix",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ignore",
"type": "struct cmd_list_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "prefix",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | add_struct_fields | void | static void
add_struct_fields (struct type *type, VEC (char_ptr) **output,
char *fieldname, int namelen)
{
int i;
int computed_type_name = 0;
const char *type_name = NULL;
CHECK_TYPEDEF (type);
for (i = 0; i < TYPE_NFIELDS (type); ++i)
{
if (i < TYPE_N_BASECLASSES (type))
add_struct_fields (TYPE_BASECLASS (type, i),
output, fieldname, namelen);
else if (TYPE_FIELD_NAME (type, i))
{
if (TYPE_FIELD_NAME (type, i)[0] != '\0')
{
if (! strncmp (TYPE_FIELD_NAME (type, i),
fieldname, namelen))
VEC_safe_push (char_ptr, *output,
xstrdup (TYPE_FIELD_NAME (type, i)));
}
else if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_UNION)
{
/* Recurse into anonymous unions. */
add_struct_fields (TYPE_FIELD_TYPE (type, i),
output, fieldname, namelen);
}
}
}
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
{
const char *name = TYPE_FN_FIELDLIST_NAME (type, i);
if (name && ! strncmp (name, fieldname, namelen))
{
if (!computed_type_name)
{
type_name = type_name_no_tag (type);
computed_type_name = 1;
}
/* Omit constructors from the completion list. */
if (!type_name || strcmp (type_name, name))
VEC_safe_push (char_ptr, *output, xstrdup (name));
}
}
} | /* Helper for expression_completer which recursively adds field and
method names from TYPE, a struct or union type, to the array
OUTPUT. */ | Helper for expression_completer which recursively adds field and
method names from TYPE, a struct or union type, to the array
OUTPUT. | [
"Helper",
"for",
"expression_completer",
"which",
"recursively",
"adds",
"field",
"and",
"method",
"names",
"from",
"TYPE",
"a",
"struct",
"or",
"union",
"type",
"to",
"the",
"array",
"OUTPUT",
"."
] | static void
add_struct_fields (struct type *type, VEC (char_ptr) **output,
char *fieldname, int namelen)
{
int i;
int computed_type_name = 0;
const char *type_name = NULL;
CHECK_TYPEDEF (type);
for (i = 0; i < TYPE_NFIELDS (type); ++i)
{
if (i < TYPE_N_BASECLASSES (type))
add_struct_fields (TYPE_BASECLASS (type, i),
output, fieldname, namelen);
else if (TYPE_FIELD_NAME (type, i))
{
if (TYPE_FIELD_NAME (type, i)[0] != '\0')
{
if (! strncmp (TYPE_FIELD_NAME (type, i),
fieldname, namelen))
VEC_safe_push (char_ptr, *output,
xstrdup (TYPE_FIELD_NAME (type, i)));
}
else if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_UNION)
{
add_struct_fields (TYPE_FIELD_TYPE (type, i),
output, fieldname, namelen);
}
}
}
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
{
const char *name = TYPE_FN_FIELDLIST_NAME (type, i);
if (name && ! strncmp (name, fieldname, namelen))
{
if (!computed_type_name)
{
type_name = type_name_no_tag (type);
computed_type_name = 1;
}
if (!type_name || strcmp (type_name, name))
VEC_safe_push (char_ptr, *output, xstrdup (name));
}
}
} | [
"static",
"void",
"add_struct_fields",
"(",
"struct",
"type",
"*",
"type",
",",
"VEC",
"(",
"char_ptr",
")",
"*",
"*",
"output",
",",
"char",
"*",
"fieldname",
",",
"int",
"namelen",
")",
"{",
"int",
"i",
";",
"int",
"computed_type_name",
"=",
"0",
";",
"const",
"char",
"*",
"type_name",
"=",
"NULL",
";",
"CHECK_TYPEDEF",
"(",
"type",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"TYPE_NFIELDS",
"(",
"type",
")",
";",
"++",
"i",
")",
"{",
"if",
"(",
"i",
"<",
"TYPE_N_BASECLASSES",
"(",
"type",
")",
")",
"add_struct_fields",
"(",
"TYPE_BASECLASS",
"(",
"type",
",",
"i",
")",
",",
"output",
",",
"fieldname",
",",
"namelen",
")",
";",
"else",
"if",
"(",
"TYPE_FIELD_NAME",
"(",
"type",
",",
"i",
")",
")",
"{",
"if",
"(",
"TYPE_FIELD_NAME",
"(",
"type",
",",
"i",
")",
"[",
"0",
"]",
"!=",
"'",
"\\0",
"'",
")",
"{",
"if",
"(",
"!",
"strncmp",
"(",
"TYPE_FIELD_NAME",
"(",
"type",
",",
"i",
")",
",",
"fieldname",
",",
"namelen",
")",
")",
"VEC_safe_push",
"(",
"char_ptr",
",",
"*",
"output",
",",
"xstrdup",
"(",
"TYPE_FIELD_NAME",
"(",
"type",
",",
"i",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"TYPE_CODE",
"(",
"TYPE_FIELD_TYPE",
"(",
"type",
",",
"i",
")",
")",
"==",
"TYPE_CODE_UNION",
")",
"{",
"add_struct_fields",
"(",
"TYPE_FIELD_TYPE",
"(",
"type",
",",
"i",
")",
",",
"output",
",",
"fieldname",
",",
"namelen",
")",
";",
"}",
"}",
"}",
"for",
"(",
"i",
"=",
"TYPE_NFN_FIELDS",
"(",
"type",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"--",
"i",
")",
"{",
"const",
"char",
"*",
"name",
"=",
"TYPE_FN_FIELDLIST_NAME",
"(",
"type",
",",
"i",
")",
";",
"if",
"(",
"name",
"&&",
"!",
"strncmp",
"(",
"name",
",",
"fieldname",
",",
"namelen",
")",
")",
"{",
"if",
"(",
"!",
"computed_type_name",
")",
"{",
"type_name",
"=",
"type_name_no_tag",
"(",
"type",
")",
";",
"computed_type_name",
"=",
"1",
";",
"}",
"if",
"(",
"!",
"type_name",
"||",
"strcmp",
"(",
"type_name",
",",
"name",
")",
")",
"VEC_safe_push",
"(",
"char_ptr",
",",
"*",
"output",
",",
"xstrdup",
"(",
"name",
")",
")",
";",
"}",
"}",
"}"
] | Helper for expression_completer which recursively adds field and
method names from TYPE, a struct or union type, to the array
OUTPUT. | [
"Helper",
"for",
"expression_completer",
"which",
"recursively",
"adds",
"field",
"and",
"method",
"names",
"from",
"TYPE",
"a",
"struct",
"or",
"union",
"type",
"to",
"the",
"array",
"OUTPUT",
"."
] | [
"/* Recurse into anonymous unions. */",
"/* Omit constructors from the completion list. */"
] | [
{
"param": "type",
"type": "struct type"
},
{
"param": "VEC",
"type": "VEC (char_ptr)"
},
{
"param": "fieldname",
"type": "char"
},
{
"param": "namelen",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "type",
"type": "struct type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "VEC",
"type": "VEC (char_ptr)",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fieldname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "namelen",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | expression_completer | null | VEC (char_ptr) *
expression_completer (struct cmd_list_element *ignore,
char *text, char *word)
{
struct type *type = NULL;
char *fieldname, *p;
volatile struct gdb_exception except;
enum type_code code = TYPE_CODE_UNDEF;
/* Perform a tentative parse of the expression, to see whether a
field completion is required. */
fieldname = NULL;
TRY_CATCH (except, RETURN_MASK_ERROR)
{
type = parse_expression_for_completion (text, &fieldname, &code);
}
if (except.reason < 0)
return NULL;
if (fieldname && type)
{
for (;;)
{
CHECK_TYPEDEF (type);
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
break;
type = TYPE_TARGET_TYPE (type);
}
if (TYPE_CODE (type) == TYPE_CODE_UNION
|| TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
int flen = strlen (fieldname);
VEC (char_ptr) *result = NULL;
add_struct_fields (type, &result, fieldname, flen);
xfree (fieldname);
return result;
}
}
else if (fieldname && code != TYPE_CODE_UNDEF)
{
VEC (char_ptr) *result;
struct cleanup *cleanup = make_cleanup (xfree, fieldname);
result = make_symbol_completion_type (fieldname, fieldname, code);
do_cleanups (cleanup);
return result;
}
xfree (fieldname);
/* Commands which complete on locations want to see the entire
argument. */
for (p = word;
p > text && p[-1] != ' ' && p[-1] != '\t';
p--)
;
/* Not ideal but it is what we used to do before... */
return location_completer (ignore, p, word);
} | /* Complete on expressions. Often this means completing on symbol
names, but some language parsers also have support for completing
field names. */ | Complete on expressions. Often this means completing on symbol
names, but some language parsers also have support for completing
field names. | [
"Complete",
"on",
"expressions",
".",
"Often",
"this",
"means",
"completing",
"on",
"symbol",
"names",
"but",
"some",
"language",
"parsers",
"also",
"have",
"support",
"for",
"completing",
"field",
"names",
"."
] | VEC (char_ptr) *
expression_completer (struct cmd_list_element *ignore,
char *text, char *word)
{
struct type *type = NULL;
char *fieldname, *p;
volatile struct gdb_exception except;
enum type_code code = TYPE_CODE_UNDEF;
fieldname = NULL;
TRY_CATCH (except, RETURN_MASK_ERROR)
{
type = parse_expression_for_completion (text, &fieldname, &code);
}
if (except.reason < 0)
return NULL;
if (fieldname && type)
{
for (;;)
{
CHECK_TYPEDEF (type);
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
break;
type = TYPE_TARGET_TYPE (type);
}
if (TYPE_CODE (type) == TYPE_CODE_UNION
|| TYPE_CODE (type) == TYPE_CODE_STRUCT)
{
int flen = strlen (fieldname);
VEC (char_ptr) *result = NULL;
add_struct_fields (type, &result, fieldname, flen);
xfree (fieldname);
return result;
}
}
else if (fieldname && code != TYPE_CODE_UNDEF)
{
VEC (char_ptr) *result;
struct cleanup *cleanup = make_cleanup (xfree, fieldname);
result = make_symbol_completion_type (fieldname, fieldname, code);
do_cleanups (cleanup);
return result;
}
xfree (fieldname);
for (p = word;
p > text && p[-1] != ' ' && p[-1] != '\t';
p--)
;
return location_completer (ignore, p, word);
} | [
"VEC",
"(",
"char_ptr",
")",
"*",
"expression_completer",
"(",
"struct",
"cmd_list_element",
"*",
"ignore",
",",
"char",
"*",
"text",
",",
"char",
"*",
"word",
")",
"{",
"struct",
"type",
"*",
"type",
"=",
"NULL",
";",
"char",
"*",
"fieldname",
",",
"*",
"p",
";",
"volatile",
"struct",
"gdb_exception",
"except",
";",
"enum",
"type_code",
"code",
"=",
"TYPE_CODE_UNDEF",
";",
"fieldname",
"=",
"NULL",
";",
"TRY_CATCH",
"(",
"except",
",",
"RETURN_MASK_ERROR",
")",
"",
"{",
"type",
"=",
"parse_expression_for_completion",
"(",
"text",
",",
"&",
"fieldname",
",",
"&",
"code",
")",
";",
"}",
"if",
"(",
"except",
".",
"reason",
"<",
"0",
")",
"return",
"NULL",
";",
"if",
"(",
"fieldname",
"&&",
"type",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"CHECK_TYPEDEF",
"(",
"type",
")",
";",
"if",
"(",
"TYPE_CODE",
"(",
"type",
")",
"!=",
"TYPE_CODE_PTR",
"&&",
"TYPE_CODE",
"(",
"type",
")",
"!=",
"TYPE_CODE_REF",
")",
"break",
";",
"type",
"=",
"TYPE_TARGET_TYPE",
"(",
"type",
")",
";",
"}",
"if",
"(",
"TYPE_CODE",
"(",
"type",
")",
"==",
"TYPE_CODE_UNION",
"||",
"TYPE_CODE",
"(",
"type",
")",
"==",
"TYPE_CODE_STRUCT",
")",
"{",
"int",
"flen",
"=",
"strlen",
"(",
"fieldname",
")",
";",
"VEC",
"(",
"char_ptr",
")",
"*",
"result",
"=",
"NULL",
";",
"add_struct_fields",
"(",
"type",
",",
"&",
"result",
",",
"fieldname",
",",
"flen",
")",
";",
"xfree",
"(",
"fieldname",
")",
";",
"return",
"result",
";",
"}",
"}",
"else",
"if",
"(",
"fieldname",
"&&",
"code",
"!=",
"TYPE_CODE_UNDEF",
")",
"{",
"VEC",
"(",
"char_ptr",
")",
"*",
"result",
";",
"struct",
"cleanup",
"*",
"cleanup",
"=",
"make_cleanup",
"(",
"xfree",
",",
"fieldname",
")",
";",
"result",
"=",
"make_symbol_completion_type",
"(",
"fieldname",
",",
"fieldname",
",",
"code",
")",
";",
"do_cleanups",
"(",
"cleanup",
")",
";",
"return",
"result",
";",
"}",
"xfree",
"(",
"fieldname",
")",
";",
"for",
"(",
"p",
"=",
"word",
";",
"p",
">",
"text",
"&&",
"p",
"[",
"-1",
"]",
"!=",
"'",
"'",
"&&",
"p",
"[",
"-1",
"]",
"!=",
"'",
"\\t",
"'",
";",
"p",
"--",
")",
";",
"return",
"location_completer",
"(",
"ignore",
",",
"p",
",",
"word",
")",
";",
"}"
] | Complete on expressions. | [
"Complete",
"on",
"expressions",
"."
] | [
"/* Perform a tentative parse of the expression, to see whether a\n field completion is required. */",
"/* Commands which complete on locations want to see the entire\n argument. */",
"/* Not ideal but it is what we used to do before... */"
] | [
{
"param": "ignore",
"type": "struct cmd_list_element"
},
{
"param": "text",
"type": "char"
},
{
"param": "word",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ignore",
"type": "struct cmd_list_element",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "word",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | complete_line_internal | null | static VEC (char_ptr) *
complete_line_internal (const char *text,
char *line_buffer, int point,
complete_line_internal_reason reason)
{
VEC (char_ptr) *list = NULL;
char *tmp_command, *p;
int ignore_help_classes;
/* Pointer within tmp_command which corresponds to text. */
char *word;
struct cmd_list_element *c, *result_list;
/* Choose the default set of word break characters to break
completions. If we later find out that we are doing completions
on command strings (as opposed to strings supplied by the
individual command completer functions, which can be any string)
then we will switch to the special word break set for command
strings, which leaves out the '-' character used in some
commands. */
rl_completer_word_break_characters =
current_language->la_word_break_characters();
/* Decide whether to complete on a list of gdb commands or on
symbols. */
tmp_command = (char *) alloca (point + 1);
p = tmp_command;
/* The help command should complete help aliases. */
ignore_help_classes = reason != handle_help;
strncpy (tmp_command, line_buffer, point);
tmp_command[point] = '\0';
/* Since text always contains some number of characters leading up
to point, we can find the equivalent position in tmp_command
by subtracting that many characters from the end of tmp_command. */
word = tmp_command + point - strlen (text);
if (point == 0)
{
/* An empty line we want to consider ambiguous; that is, it
could be any command. */
c = CMD_LIST_AMBIGUOUS;
result_list = 0;
}
else
{
c = lookup_cmd_1 (&p, cmdlist, &result_list, ignore_help_classes);
}
/* Move p up to the next interesting thing. */
while (*p == ' ' || *p == '\t')
{
p++;
}
if (!c)
{
/* It is an unrecognized command. So there are no
possible completions. */
list = NULL;
}
else if (c == CMD_LIST_AMBIGUOUS)
{
char *q;
/* lookup_cmd_1 advances p up to the first ambiguous thing, but
doesn't advance over that thing itself. Do so now. */
q = p;
while (*q && (isalnum (*q) || *q == '-' || *q == '_'))
++q;
if (q != tmp_command + point)
{
/* There is something beyond the ambiguous
command, so there are no possible completions. For
example, "info t " or "info t foo" does not complete
to anything, because "info t" can be "info target" or
"info terminal". */
list = NULL;
}
else
{
/* We're trying to complete on the command which was ambiguous.
This we can deal with. */
if (result_list)
{
if (reason != handle_brkchars)
list = complete_on_cmdlist (*result_list->prefixlist, p,
word, ignore_help_classes);
}
else
{
if (reason != handle_brkchars)
list = complete_on_cmdlist (cmdlist, p, word,
ignore_help_classes);
}
/* Ensure that readline does the right thing with respect to
inserting quotes. */
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
}
else
{
/* We've recognized a full command. */
if (p == tmp_command + point)
{
/* There is no non-whitespace in the line beyond the
command. */
if (p[-1] == ' ' || p[-1] == '\t')
{
/* The command is followed by whitespace; we need to
complete on whatever comes after command. */
if (c->prefixlist)
{
/* It is a prefix command; what comes after it is
a subcommand (e.g. "info "). */
if (reason != handle_brkchars)
list = complete_on_cmdlist (*c->prefixlist, p, word,
ignore_help_classes);
/* Ensure that readline does the right thing
with respect to inserting quotes. */
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
else if (reason == handle_help)
list = NULL;
else if (c->enums)
{
if (reason != handle_brkchars)
list = complete_on_enum (c->enums, p, word);
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
else
{
/* It is a normal command; what comes after it is
completed by the command's completer function. */
if (c->completer == filename_completer)
{
/* Many commands which want to complete on
file names accept several file names, as
in "run foo bar >>baz". So we don't want
to complete the entire text after the
command, just the last word. To this
end, we need to find the beginning of the
file name by starting at `word' and going
backwards. */
for (p = word;
p > tmp_command
&& strchr (gdb_completer_file_name_break_characters, p[-1]) == NULL;
p--)
;
rl_completer_word_break_characters =
gdb_completer_file_name_break_characters;
}
else if (c->completer == location_completer)
{
/* Commands which complete on locations want to
see the entire argument. */
for (p = word;
p > tmp_command
&& p[-1] != ' ' && p[-1] != '\t';
p--)
;
}
if (reason != handle_brkchars && c->completer != NULL)
list = (*c->completer) (c, p, word);
}
}
else
{
/* The command is not followed by whitespace; we need to
complete on the command itself, e.g. "p" which is a
command itself but also can complete to "print", "ptype"
etc. */
char *q;
/* Find the command we are completing on. */
q = p;
while (q > tmp_command)
{
if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_')
--q;
else
break;
}
if (reason != handle_brkchars)
list = complete_on_cmdlist (result_list, q, word,
ignore_help_classes);
/* Ensure that readline does the right thing
with respect to inserting quotes. */
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
}
else if (reason == handle_help)
list = NULL;
else
{
/* There is non-whitespace beyond the command. */
if (c->prefixlist && !c->allow_unknown)
{
/* It is an unrecognized subcommand of a prefix command,
e.g. "info adsfkdj". */
list = NULL;
}
else if (c->enums)
{
if (reason != handle_brkchars)
list = complete_on_enum (c->enums, p, word);
}
else
{
/* It is a normal command. */
if (c->completer == filename_completer)
{
/* See the commentary above about the specifics
of file-name completion. */
for (p = word;
p > tmp_command
&& strchr (gdb_completer_file_name_break_characters,
p[-1]) == NULL;
p--)
;
rl_completer_word_break_characters =
gdb_completer_file_name_break_characters;
}
else if (c->completer == location_completer)
{
for (p = word;
p > tmp_command
&& p[-1] != ' ' && p[-1] != '\t';
p--)
;
}
if (reason != handle_brkchars && c->completer != NULL)
list = (*c->completer) (c, p, word);
}
}
}
return list;
} | /* Internal function used to handle completions.
TEXT is the caller's idea of the "word" we are looking at.
LINE_BUFFER is available to be looked at; it contains the entire
text of the line. POINT is the offset in that line of the cursor.
You should pretend that the line ends at POINT.
REASON is of type complete_line_internal_reason.
If REASON is handle_brkchars:
Preliminary phase, called by gdb_completion_word_break_characters
function, is used to determine the correct set of chars that are
word delimiters depending on the current command in line_buffer.
No completion list should be generated; the return value should be
NULL. This is checked by an assertion in that function.
If REASON is handle_completions:
Main phase, called by complete_line function, is used to get the list
of posible completions.
If REASON is handle_help:
Special case when completing a 'help' command. In this case,
once sub-command completions are exhausted, we simply return NULL.
*/ | Internal function used to handle completions.
TEXT is the caller's idea of the "word" we are looking at.
LINE_BUFFER is available to be looked at; it contains the entire
text of the line. POINT is the offset in that line of the cursor.
You should pretend that the line ends at POINT.
REASON is of type complete_line_internal_reason.
If REASON is handle_brkchars:
Preliminary phase, called by gdb_completion_word_break_characters
function, is used to determine the correct set of chars that are
word delimiters depending on the current command in line_buffer.
No completion list should be generated; the return value should be
NULL. This is checked by an assertion in that function.
If REASON is handle_completions:
Main phase, called by complete_line function, is used to get the list
of posible completions.
If REASON is handle_help:
Special case when completing a 'help' command. In this case,
once sub-command completions are exhausted, we simply return NULL. | [
"Internal",
"function",
"used",
"to",
"handle",
"completions",
".",
"TEXT",
"is",
"the",
"caller",
"'",
"s",
"idea",
"of",
"the",
"\"",
"word",
"\"",
"we",
"are",
"looking",
"at",
".",
"LINE_BUFFER",
"is",
"available",
"to",
"be",
"looked",
"at",
";",
"it",
"contains",
"the",
"entire",
"text",
"of",
"the",
"line",
".",
"POINT",
"is",
"the",
"offset",
"in",
"that",
"line",
"of",
"the",
"cursor",
".",
"You",
"should",
"pretend",
"that",
"the",
"line",
"ends",
"at",
"POINT",
".",
"REASON",
"is",
"of",
"type",
"complete_line_internal_reason",
".",
"If",
"REASON",
"is",
"handle_brkchars",
":",
"Preliminary",
"phase",
"called",
"by",
"gdb_completion_word_break_characters",
"function",
"is",
"used",
"to",
"determine",
"the",
"correct",
"set",
"of",
"chars",
"that",
"are",
"word",
"delimiters",
"depending",
"on",
"the",
"current",
"command",
"in",
"line_buffer",
".",
"No",
"completion",
"list",
"should",
"be",
"generated",
";",
"the",
"return",
"value",
"should",
"be",
"NULL",
".",
"This",
"is",
"checked",
"by",
"an",
"assertion",
"in",
"that",
"function",
".",
"If",
"REASON",
"is",
"handle_completions",
":",
"Main",
"phase",
"called",
"by",
"complete_line",
"function",
"is",
"used",
"to",
"get",
"the",
"list",
"of",
"posible",
"completions",
".",
"If",
"REASON",
"is",
"handle_help",
":",
"Special",
"case",
"when",
"completing",
"a",
"'",
"help",
"'",
"command",
".",
"In",
"this",
"case",
"once",
"sub",
"-",
"command",
"completions",
"are",
"exhausted",
"we",
"simply",
"return",
"NULL",
"."
] | static VEC (char_ptr) *
complete_line_internal (const char *text,
char *line_buffer, int point,
complete_line_internal_reason reason)
{
VEC (char_ptr) *list = NULL;
char *tmp_command, *p;
int ignore_help_classes;
char *word;
struct cmd_list_element *c, *result_list;
rl_completer_word_break_characters =
current_language->la_word_break_characters();
tmp_command = (char *) alloca (point + 1);
p = tmp_command;
ignore_help_classes = reason != handle_help;
strncpy (tmp_command, line_buffer, point);
tmp_command[point] = '\0';
word = tmp_command + point - strlen (text);
if (point == 0)
{
c = CMD_LIST_AMBIGUOUS;
result_list = 0;
}
else
{
c = lookup_cmd_1 (&p, cmdlist, &result_list, ignore_help_classes);
}
while (*p == ' ' || *p == '\t')
{
p++;
}
if (!c)
{
list = NULL;
}
else if (c == CMD_LIST_AMBIGUOUS)
{
char *q;
q = p;
while (*q && (isalnum (*q) || *q == '-' || *q == '_'))
++q;
if (q != tmp_command + point)
{
list = NULL;
}
else
{
if (result_list)
{
if (reason != handle_brkchars)
list = complete_on_cmdlist (*result_list->prefixlist, p,
word, ignore_help_classes);
}
else
{
if (reason != handle_brkchars)
list = complete_on_cmdlist (cmdlist, p, word,
ignore_help_classes);
}
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
}
else
{
if (p == tmp_command + point)
{
if (p[-1] == ' ' || p[-1] == '\t')
{
if (c->prefixlist)
{
if (reason != handle_brkchars)
list = complete_on_cmdlist (*c->prefixlist, p, word,
ignore_help_classes);
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
else if (reason == handle_help)
list = NULL;
else if (c->enums)
{
if (reason != handle_brkchars)
list = complete_on_enum (c->enums, p, word);
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
else
{
if (c->completer == filename_completer)
{
for (p = word;
p > tmp_command
&& strchr (gdb_completer_file_name_break_characters, p[-1]) == NULL;
p--)
;
rl_completer_word_break_characters =
gdb_completer_file_name_break_characters;
}
else if (c->completer == location_completer)
{
for (p = word;
p > tmp_command
&& p[-1] != ' ' && p[-1] != '\t';
p--)
;
}
if (reason != handle_brkchars && c->completer != NULL)
list = (*c->completer) (c, p, word);
}
}
else
{
char *q;
q = p;
while (q > tmp_command)
{
if (isalnum (q[-1]) || q[-1] == '-' || q[-1] == '_')
--q;
else
break;
}
if (reason != handle_brkchars)
list = complete_on_cmdlist (result_list, q, word,
ignore_help_classes);
rl_completer_word_break_characters =
gdb_completer_command_word_break_characters;
}
}
else if (reason == handle_help)
list = NULL;
else
{
if (c->prefixlist && !c->allow_unknown)
{
list = NULL;
}
else if (c->enums)
{
if (reason != handle_brkchars)
list = complete_on_enum (c->enums, p, word);
}
else
{
if (c->completer == filename_completer)
{
for (p = word;
p > tmp_command
&& strchr (gdb_completer_file_name_break_characters,
p[-1]) == NULL;
p--)
;
rl_completer_word_break_characters =
gdb_completer_file_name_break_characters;
}
else if (c->completer == location_completer)
{
for (p = word;
p > tmp_command
&& p[-1] != ' ' && p[-1] != '\t';
p--)
;
}
if (reason != handle_brkchars && c->completer != NULL)
list = (*c->completer) (c, p, word);
}
}
}
return list;
} | [
"static",
"VEC",
"(",
"char_ptr",
")",
"*",
"complete_line_internal",
"(",
"const",
"char",
"*",
"text",
",",
"char",
"*",
"line_buffer",
",",
"int",
"point",
",",
"complete_line_internal_reason",
"reason",
")",
"{",
"VEC",
"(",
"char_ptr",
")",
"*",
"list",
"=",
"NULL",
";",
"char",
"*",
"tmp_command",
",",
"*",
"p",
";",
"int",
"ignore_help_classes",
";",
"char",
"*",
"word",
";",
"struct",
"cmd_list_element",
"*",
"c",
",",
"*",
"result_list",
";",
"rl_completer_word_break_characters",
"=",
"current_language",
"->",
"la_word_break_characters",
"(",
")",
";",
"tmp_command",
"=",
"(",
"char",
"*",
")",
"alloca",
"(",
"point",
"+",
"1",
")",
";",
"p",
"=",
"tmp_command",
";",
"ignore_help_classes",
"=",
"reason",
"!=",
"handle_help",
";",
"strncpy",
"(",
"tmp_command",
",",
"line_buffer",
",",
"point",
")",
";",
"tmp_command",
"[",
"point",
"]",
"=",
"'",
"\\0",
"'",
";",
"word",
"=",
"tmp_command",
"+",
"point",
"-",
"strlen",
"(",
"text",
")",
";",
"if",
"(",
"point",
"==",
"0",
")",
"{",
"c",
"=",
"CMD_LIST_AMBIGUOUS",
";",
"result_list",
"=",
"0",
";",
"}",
"else",
"{",
"c",
"=",
"lookup_cmd_1",
"(",
"&",
"p",
",",
"cmdlist",
",",
"&",
"result_list",
",",
"ignore_help_classes",
")",
";",
"}",
"while",
"(",
"*",
"p",
"==",
"'",
"'",
"||",
"*",
"p",
"==",
"'",
"\\t",
"'",
")",
"{",
"p",
"++",
";",
"}",
"if",
"(",
"!",
"c",
")",
"{",
"list",
"=",
"NULL",
";",
"}",
"else",
"if",
"(",
"c",
"==",
"CMD_LIST_AMBIGUOUS",
")",
"{",
"char",
"*",
"q",
";",
"q",
"=",
"p",
";",
"while",
"(",
"*",
"q",
"&&",
"(",
"isalnum",
"(",
"*",
"q",
")",
"||",
"*",
"q",
"==",
"'",
"'",
"||",
"*",
"q",
"==",
"'",
"'",
")",
")",
"++",
"q",
";",
"if",
"(",
"q",
"!=",
"tmp_command",
"+",
"point",
")",
"{",
"list",
"=",
"NULL",
";",
"}",
"else",
"{",
"if",
"(",
"result_list",
")",
"{",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
")",
"list",
"=",
"complete_on_cmdlist",
"(",
"*",
"result_list",
"->",
"prefixlist",
",",
"p",
",",
"word",
",",
"ignore_help_classes",
")",
";",
"}",
"else",
"{",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
")",
"list",
"=",
"complete_on_cmdlist",
"(",
"cmdlist",
",",
"p",
",",
"word",
",",
"ignore_help_classes",
")",
";",
"}",
"rl_completer_word_break_characters",
"=",
"gdb_completer_command_word_break_characters",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"p",
"==",
"tmp_command",
"+",
"point",
")",
"{",
"if",
"(",
"p",
"[",
"-1",
"]",
"==",
"'",
"'",
"||",
"p",
"[",
"-1",
"]",
"==",
"'",
"\\t",
"'",
")",
"{",
"if",
"(",
"c",
"->",
"prefixlist",
")",
"{",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
")",
"list",
"=",
"complete_on_cmdlist",
"(",
"*",
"c",
"->",
"prefixlist",
",",
"p",
",",
"word",
",",
"ignore_help_classes",
")",
";",
"rl_completer_word_break_characters",
"=",
"gdb_completer_command_word_break_characters",
";",
"}",
"else",
"if",
"(",
"reason",
"==",
"handle_help",
")",
"list",
"=",
"NULL",
";",
"else",
"if",
"(",
"c",
"->",
"enums",
")",
"{",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
")",
"list",
"=",
"complete_on_enum",
"(",
"c",
"->",
"enums",
",",
"p",
",",
"word",
")",
";",
"rl_completer_word_break_characters",
"=",
"gdb_completer_command_word_break_characters",
";",
"}",
"else",
"{",
"if",
"(",
"c",
"->",
"completer",
"==",
"filename_completer",
")",
"{",
"for",
"(",
"p",
"=",
"word",
";",
"p",
">",
"tmp_command",
"&&",
"strchr",
"(",
"gdb_completer_file_name_break_characters",
",",
"p",
"[",
"-1",
"]",
")",
"==",
"NULL",
";",
"p",
"--",
")",
";",
"rl_completer_word_break_characters",
"=",
"gdb_completer_file_name_break_characters",
";",
"}",
"else",
"if",
"(",
"c",
"->",
"completer",
"==",
"location_completer",
")",
"{",
"for",
"(",
"p",
"=",
"word",
";",
"p",
">",
"tmp_command",
"&&",
"p",
"[",
"-1",
"]",
"!=",
"'",
"'",
"&&",
"p",
"[",
"-1",
"]",
"!=",
"'",
"\\t",
"'",
";",
"p",
"--",
")",
";",
"}",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
"&&",
"c",
"->",
"completer",
"!=",
"NULL",
")",
"list",
"=",
"(",
"*",
"c",
"->",
"completer",
")",
"(",
"c",
",",
"p",
",",
"word",
")",
";",
"}",
"}",
"else",
"{",
"char",
"*",
"q",
";",
"q",
"=",
"p",
";",
"while",
"(",
"q",
">",
"tmp_command",
")",
"{",
"if",
"(",
"isalnum",
"(",
"q",
"[",
"-1",
"]",
")",
"||",
"q",
"[",
"-1",
"]",
"==",
"'",
"'",
"||",
"q",
"[",
"-1",
"]",
"==",
"'",
"'",
")",
"--",
"q",
";",
"else",
"break",
";",
"}",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
")",
"list",
"=",
"complete_on_cmdlist",
"(",
"result_list",
",",
"q",
",",
"word",
",",
"ignore_help_classes",
")",
";",
"rl_completer_word_break_characters",
"=",
"gdb_completer_command_word_break_characters",
";",
"}",
"}",
"else",
"if",
"(",
"reason",
"==",
"handle_help",
")",
"list",
"=",
"NULL",
";",
"else",
"{",
"if",
"(",
"c",
"->",
"prefixlist",
"&&",
"!",
"c",
"->",
"allow_unknown",
")",
"{",
"list",
"=",
"NULL",
";",
"}",
"else",
"if",
"(",
"c",
"->",
"enums",
")",
"{",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
")",
"list",
"=",
"complete_on_enum",
"(",
"c",
"->",
"enums",
",",
"p",
",",
"word",
")",
";",
"}",
"else",
"{",
"if",
"(",
"c",
"->",
"completer",
"==",
"filename_completer",
")",
"{",
"for",
"(",
"p",
"=",
"word",
";",
"p",
">",
"tmp_command",
"&&",
"strchr",
"(",
"gdb_completer_file_name_break_characters",
",",
"p",
"[",
"-1",
"]",
")",
"==",
"NULL",
";",
"p",
"--",
")",
";",
"rl_completer_word_break_characters",
"=",
"gdb_completer_file_name_break_characters",
";",
"}",
"else",
"if",
"(",
"c",
"->",
"completer",
"==",
"location_completer",
")",
"{",
"for",
"(",
"p",
"=",
"word",
";",
"p",
">",
"tmp_command",
"&&",
"p",
"[",
"-1",
"]",
"!=",
"'",
"'",
"&&",
"p",
"[",
"-1",
"]",
"!=",
"'",
"\\t",
"'",
";",
"p",
"--",
")",
";",
"}",
"if",
"(",
"reason",
"!=",
"handle_brkchars",
"&&",
"c",
"->",
"completer",
"!=",
"NULL",
")",
"list",
"=",
"(",
"*",
"c",
"->",
"completer",
")",
"(",
"c",
",",
"p",
",",
"word",
")",
";",
"}",
"}",
"}",
"return",
"list",
";",
"}"
] | Internal function used to handle completions. | [
"Internal",
"function",
"used",
"to",
"handle",
"completions",
"."
] | [
"/* Pointer within tmp_command which corresponds to text. */",
"/* Choose the default set of word break characters to break\n completions. If we later find out that we are doing completions\n on command strings (as opposed to strings supplied by the\n individual command completer functions, which can be any string)\n then we will switch to the special word break set for command\n strings, which leaves out the '-' character used in some\n commands. */",
"/* Decide whether to complete on a list of gdb commands or on\n symbols. */",
"/* The help command should complete help aliases. */",
"/* Since text always contains some number of characters leading up\n to point, we can find the equivalent position in tmp_command\n by subtracting that many characters from the end of tmp_command. */",
"/* An empty line we want to consider ambiguous; that is, it\n\t could be any command. */",
"/* Move p up to the next interesting thing. */",
"/* It is an unrecognized command. So there are no\n\t possible completions. */",
"/* lookup_cmd_1 advances p up to the first ambiguous thing, but\n\t doesn't advance over that thing itself. Do so now. */",
"/* There is something beyond the ambiguous\n\t command, so there are no possible completions. For\n\t example, \"info t \" or \"info t foo\" does not complete\n\t to anything, because \"info t\" can be \"info target\" or\n\t \"info terminal\". */",
"/* We're trying to complete on the command which was ambiguous.\n\t This we can deal with. */",
"/* Ensure that readline does the right thing with respect to\n\t inserting quotes. */",
"/* We've recognized a full command. */",
"/* There is no non-whitespace in the line beyond the\n\t command. */",
"/* The command is followed by whitespace; we need to\n\t\t complete on whatever comes after command. */",
"/* It is a prefix command; what comes after it is\n\t\t a subcommand (e.g. \"info \"). */",
"/* Ensure that readline does the right thing\n\t\t with respect to inserting quotes. */",
"/* It is a normal command; what comes after it is\n\t\t completed by the command's completer function. */",
"/* Many commands which want to complete on\n\t\t\t file names accept several file names, as\n\t\t\t in \"run foo bar >>baz\". So we don't want\n\t\t\t to complete the entire text after the\n\t\t\t command, just the last word. To this\n\t\t\t end, we need to find the beginning of the\n\t\t\t file name by starting at `word' and going\n\t\t\t backwards. */",
"/* Commands which complete on locations want to\n\t\t\t see the entire argument. */",
"/* The command is not followed by whitespace; we need to\n\t\t complete on the command itself, e.g. \"p\" which is a\n\t\t command itself but also can complete to \"print\", \"ptype\"\n\t\t etc. */",
"/* Find the command we are completing on. */",
"/* Ensure that readline does the right thing\n\t\t with respect to inserting quotes. */",
"/* There is non-whitespace beyond the command. */",
"/* It is an unrecognized subcommand of a prefix command,\n\t\t e.g. \"info adsfkdj\". */",
"/* It is a normal command. */",
"/* See the commentary above about the specifics\n\t\t of file-name completion. */"
] | [
{
"param": "text",
"type": "char"
},
{
"param": "line_buffer",
"type": "char"
},
{
"param": "point",
"type": "int"
},
{
"param": "reason",
"type": "complete_line_internal_reason"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line_buffer",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "point",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reason",
"type": "complete_line_internal_reason",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | complete_line | null | VEC (char_ptr) *
complete_line (const char *text, char *line_buffer, int point)
{
return complete_line_internal (text, line_buffer,
point, handle_completions);
} | /* Generate completions all at once. Returns a vector of strings.
Each element is allocated with xmalloc. It can also return NULL if
there are no completions.
TEXT is the caller's idea of the "word" we are looking at.
LINE_BUFFER is available to be looked at; it contains the entire
text of the line.
POINT is the offset in that line of the cursor. You
should pretend that the line ends at POINT. */ | Generate completions all at once. Returns a vector of strings.
Each element is allocated with xmalloc. It can also return NULL if
there are no completions.
TEXT is the caller's idea of the "word" we are looking at.
LINE_BUFFER is available to be looked at; it contains the entire
text of the line.
POINT is the offset in that line of the cursor. You
should pretend that the line ends at POINT. | [
"Generate",
"completions",
"all",
"at",
"once",
".",
"Returns",
"a",
"vector",
"of",
"strings",
".",
"Each",
"element",
"is",
"allocated",
"with",
"xmalloc",
".",
"It",
"can",
"also",
"return",
"NULL",
"if",
"there",
"are",
"no",
"completions",
".",
"TEXT",
"is",
"the",
"caller",
"'",
"s",
"idea",
"of",
"the",
"\"",
"word",
"\"",
"we",
"are",
"looking",
"at",
".",
"LINE_BUFFER",
"is",
"available",
"to",
"be",
"looked",
"at",
";",
"it",
"contains",
"the",
"entire",
"text",
"of",
"the",
"line",
".",
"POINT",
"is",
"the",
"offset",
"in",
"that",
"line",
"of",
"the",
"cursor",
".",
"You",
"should",
"pretend",
"that",
"the",
"line",
"ends",
"at",
"POINT",
"."
] | VEC (char_ptr) *
complete_line (const char *text, char *line_buffer, int point)
{
return complete_line_internal (text, line_buffer,
point, handle_completions);
} | [
"VEC",
"(",
"char_ptr",
")",
"*",
"complete_line",
"(",
"const",
"char",
"*",
"text",
",",
"char",
"*",
"line_buffer",
",",
"int",
"point",
")",
"{",
"return",
"complete_line_internal",
"(",
"text",
",",
"line_buffer",
",",
"point",
",",
"handle_completions",
")",
";",
"}"
] | Generate completions all at once. | [
"Generate",
"completions",
"all",
"at",
"once",
"."
] | [] | [
{
"param": "text",
"type": "char"
},
{
"param": "line_buffer",
"type": "char"
},
{
"param": "point",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line_buffer",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "point",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | gdb_completion_word_break_characters | char | char *
gdb_completion_word_break_characters (void)
{
VEC (char_ptr) *list;
list = complete_line_internal (rl_line_buffer, rl_line_buffer, rl_point,
handle_brkchars);
gdb_assert (list == NULL);
return rl_completer_word_break_characters;
} | /* Get the list of chars that are considered as word breaks
for the current command. */ | Get the list of chars that are considered as word breaks
for the current command. | [
"Get",
"the",
"list",
"of",
"chars",
"that",
"are",
"considered",
"as",
"word",
"breaks",
"for",
"the",
"current",
"command",
"."
] | char *
gdb_completion_word_break_characters (void)
{
VEC (char_ptr) *list;
list = complete_line_internal (rl_line_buffer, rl_line_buffer, rl_point,
handle_brkchars);
gdb_assert (list == NULL);
return rl_completer_word_break_characters;
} | [
"char",
"*",
"gdb_completion_word_break_characters",
"(",
"void",
")",
"{",
"VEC",
"(",
"char_ptr",
")",
"*",
"list",
";",
"list",
"=",
"complete_line_internal",
"(",
"rl_line_buffer",
",",
"rl_line_buffer",
",",
"rl_point",
",",
"handle_brkchars",
")",
";",
"gdb_assert",
"(",
"list",
"==",
"NULL",
")",
";",
"return",
"rl_completer_word_break_characters",
";",
"}"
] | Get the list of chars that are considered as word breaks
for the current command. | [
"Get",
"the",
"list",
"of",
"chars",
"that",
"are",
"considered",
"as",
"word",
"breaks",
"for",
"the",
"current",
"command",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | line_completion_function | char | static char *
line_completion_function (const char *text, int matches,
char *line_buffer, int point)
{
static VEC (char_ptr) *list = NULL; /* Cache of completions. */
static int index; /* Next cached completion. */
char *output = NULL;
if (matches == 0)
{
/* The caller is beginning to accumulate a new set of
completions, so we need to find all of them now, and cache
them for returning one at a time on future calls. */
if (list)
{
/* Free the storage used by LIST, but not by the strings
inside. This is because rl_complete_internal () frees
the strings. As complete_line may abort by calling
`error' clear LIST now. */
VEC_free (char_ptr, list);
}
index = 0;
list = complete_line (text, line_buffer, point);
}
/* If we found a list of potential completions during initialization
then dole them out one at a time. After returning the last one,
return NULL (and continue to do so) each time we are called after
that, until a new list is available. */
if (list)
{
if (index < VEC_length (char_ptr, list))
{
output = VEC_index (char_ptr, list, index);
index++;
}
}
#if 0
/* Can't do this because readline hasn't yet checked the word breaks
for figuring out whether to insert a quote. */
if (output == NULL)
/* Make sure the word break characters are set back to normal for
the next time that readline tries to complete something. */
rl_completer_word_break_characters =
current_language->la_word_break_characters();
#endif
return (output);
} | /* Generate completions one by one for the completer. Each time we
are called return another potential completion to the caller.
line_completion just completes on commands or passes the buck to
the command's completer function, the stuff specific to symbol
completion is in make_symbol_completion_list.
TEXT is the caller's idea of the "word" we are looking at.
MATCHES is the number of matches that have currently been collected
from calling this completion function. When zero, then we need to
initialize, otherwise the initialization has already taken place
and we can just return the next potential completion string.
LINE_BUFFER is available to be looked at; it contains the entire
text of the line. POINT is the offset in that line of the cursor.
You should pretend that the line ends at POINT.
Returns NULL if there are no more completions, else a pointer to a
string which is a possible completion, it is the caller's
responsibility to free the string. */ | Generate completions one by one for the completer. Each time we
are called return another potential completion to the caller.
line_completion just completes on commands or passes the buck to
the command's completer function, the stuff specific to symbol
completion is in make_symbol_completion_list.
TEXT is the caller's idea of the "word" we are looking at.
MATCHES is the number of matches that have currently been collected
from calling this completion function. When zero, then we need to
initialize, otherwise the initialization has already taken place
and we can just return the next potential completion string.
LINE_BUFFER is available to be looked at; it contains the entire
text of the line. POINT is the offset in that line of the cursor.
You should pretend that the line ends at POINT.
Returns NULL if there are no more completions, else a pointer to a
string which is a possible completion, it is the caller's
responsibility to free the string. | [
"Generate",
"completions",
"one",
"by",
"one",
"for",
"the",
"completer",
".",
"Each",
"time",
"we",
"are",
"called",
"return",
"another",
"potential",
"completion",
"to",
"the",
"caller",
".",
"line_completion",
"just",
"completes",
"on",
"commands",
"or",
"passes",
"the",
"buck",
"to",
"the",
"command",
"'",
"s",
"completer",
"function",
"the",
"stuff",
"specific",
"to",
"symbol",
"completion",
"is",
"in",
"make_symbol_completion_list",
".",
"TEXT",
"is",
"the",
"caller",
"'",
"s",
"idea",
"of",
"the",
"\"",
"word",
"\"",
"we",
"are",
"looking",
"at",
".",
"MATCHES",
"is",
"the",
"number",
"of",
"matches",
"that",
"have",
"currently",
"been",
"collected",
"from",
"calling",
"this",
"completion",
"function",
".",
"When",
"zero",
"then",
"we",
"need",
"to",
"initialize",
"otherwise",
"the",
"initialization",
"has",
"already",
"taken",
"place",
"and",
"we",
"can",
"just",
"return",
"the",
"next",
"potential",
"completion",
"string",
".",
"LINE_BUFFER",
"is",
"available",
"to",
"be",
"looked",
"at",
";",
"it",
"contains",
"the",
"entire",
"text",
"of",
"the",
"line",
".",
"POINT",
"is",
"the",
"offset",
"in",
"that",
"line",
"of",
"the",
"cursor",
".",
"You",
"should",
"pretend",
"that",
"the",
"line",
"ends",
"at",
"POINT",
".",
"Returns",
"NULL",
"if",
"there",
"are",
"no",
"more",
"completions",
"else",
"a",
"pointer",
"to",
"a",
"string",
"which",
"is",
"a",
"possible",
"completion",
"it",
"is",
"the",
"caller",
"'",
"s",
"responsibility",
"to",
"free",
"the",
"string",
"."
] | static char *
line_completion_function (const char *text, int matches,
char *line_buffer, int point)
{
static VEC (char_ptr) *list = NULL;
static int index;
char *output = NULL;
if (matches == 0)
{
if (list)
{
VEC_free (char_ptr, list);
}
index = 0;
list = complete_line (text, line_buffer, point);
}
if (list)
{
if (index < VEC_length (char_ptr, list))
{
output = VEC_index (char_ptr, list, index);
index++;
}
}
#if 0
if (output == NULL)
rl_completer_word_break_characters =
current_language->la_word_break_characters();
#endif
return (output);
} | [
"static",
"char",
"*",
"line_completion_function",
"(",
"const",
"char",
"*",
"text",
",",
"int",
"matches",
",",
"char",
"*",
"line_buffer",
",",
"int",
"point",
")",
"{",
"static",
"VEC",
"(",
"char_ptr",
")",
"*",
"list",
"=",
"NULL",
";",
"static",
"int",
"index",
";",
"char",
"*",
"output",
"=",
"NULL",
";",
"if",
"(",
"matches",
"==",
"0",
")",
"{",
"if",
"(",
"list",
")",
"{",
"VEC_free",
"(",
"char_ptr",
",",
"list",
")",
";",
"}",
"index",
"=",
"0",
";",
"list",
"=",
"complete_line",
"(",
"text",
",",
"line_buffer",
",",
"point",
")",
";",
"}",
"if",
"(",
"list",
")",
"{",
"if",
"(",
"index",
"<",
"VEC_length",
"(",
"char_ptr",
",",
"list",
")",
")",
"{",
"output",
"=",
"VEC_index",
"(",
"char_ptr",
",",
"list",
",",
"index",
")",
";",
"index",
"++",
";",
"}",
"}",
"#if",
"0",
"\n",
"if",
"(",
"output",
"==",
"NULL",
")",
"rl_completer_word_break_characters",
"=",
"current_language",
"->",
"la_word_break_characters",
"(",
")",
";",
"#endif",
"return",
"(",
"output",
")",
";",
"}"
] | Generate completions one by one for the completer. | [
"Generate",
"completions",
"one",
"by",
"one",
"for",
"the",
"completer",
"."
] | [
"/* Cache of completions. */",
"/* Next cached completion. */",
"/* The caller is beginning to accumulate a new set of\n completions, so we need to find all of them now, and cache\n them for returning one at a time on future calls. */",
"/* Free the storage used by LIST, but not by the strings\n\t inside. This is because rl_complete_internal () frees\n\t the strings. As complete_line may abort by calling\n\t `error' clear LIST now. */",
"/* If we found a list of potential completions during initialization\n then dole them out one at a time. After returning the last one,\n return NULL (and continue to do so) each time we are called after\n that, until a new list is available. */",
"/* Can't do this because readline hasn't yet checked the word breaks\n for figuring out whether to insert a quote. */",
"/* Make sure the word break characters are set back to normal for\n the next time that readline tries to complete something. */"
] | [
{
"param": "text",
"type": "char"
},
{
"param": "matches",
"type": "int"
},
{
"param": "line_buffer",
"type": "char"
},
{
"param": "point",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "matches",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "line_buffer",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "point",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | skip_quoted_chars | char | char *
skip_quoted_chars (char *str, char *quotechars, char *breakchars)
{
char quote_char = '\0';
char *scan;
if (quotechars == NULL)
quotechars = gdb_completer_quote_characters;
if (breakchars == NULL)
breakchars = current_language->la_word_break_characters();
for (scan = str; *scan != '\0'; scan++)
{
if (quote_char != '\0')
{
/* Ignore everything until the matching close quote char. */
if (*scan == quote_char)
{
/* Found matching close quote. */
scan++;
break;
}
}
else if (strchr (quotechars, *scan))
{
/* Found start of a quoted string. */
quote_char = *scan;
}
else if (strchr (breakchars, *scan))
{
break;
}
}
return (scan);
} | /* Skip over the possibly quoted word STR (as defined by the quote
characters QUOTECHARS and the word break characters BREAKCHARS).
Returns pointer to the location after the "word". If either
QUOTECHARS or BREAKCHARS is NULL, use the same values used by the
completer. */ | Skip over the possibly quoted word STR (as defined by the quote
characters QUOTECHARS and the word break characters BREAKCHARS).
Returns pointer to the location after the "word". If either
QUOTECHARS or BREAKCHARS is NULL, use the same values used by the
completer. | [
"Skip",
"over",
"the",
"possibly",
"quoted",
"word",
"STR",
"(",
"as",
"defined",
"by",
"the",
"quote",
"characters",
"QUOTECHARS",
"and",
"the",
"word",
"break",
"characters",
"BREAKCHARS",
")",
".",
"Returns",
"pointer",
"to",
"the",
"location",
"after",
"the",
"\"",
"word",
"\"",
".",
"If",
"either",
"QUOTECHARS",
"or",
"BREAKCHARS",
"is",
"NULL",
"use",
"the",
"same",
"values",
"used",
"by",
"the",
"completer",
"."
] | char *
skip_quoted_chars (char *str, char *quotechars, char *breakchars)
{
char quote_char = '\0';
char *scan;
if (quotechars == NULL)
quotechars = gdb_completer_quote_characters;
if (breakchars == NULL)
breakchars = current_language->la_word_break_characters();
for (scan = str; *scan != '\0'; scan++)
{
if (quote_char != '\0')
{
if (*scan == quote_char)
{
scan++;
break;
}
}
else if (strchr (quotechars, *scan))
{
quote_char = *scan;
}
else if (strchr (breakchars, *scan))
{
break;
}
}
return (scan);
} | [
"char",
"*",
"skip_quoted_chars",
"(",
"char",
"*",
"str",
",",
"char",
"*",
"quotechars",
",",
"char",
"*",
"breakchars",
")",
"{",
"char",
"quote_char",
"=",
"'",
"\\0",
"'",
";",
"char",
"*",
"scan",
";",
"if",
"(",
"quotechars",
"==",
"NULL",
")",
"quotechars",
"=",
"gdb_completer_quote_characters",
";",
"if",
"(",
"breakchars",
"==",
"NULL",
")",
"breakchars",
"=",
"current_language",
"->",
"la_word_break_characters",
"(",
")",
";",
"for",
"(",
"scan",
"=",
"str",
";",
"*",
"scan",
"!=",
"'",
"\\0",
"'",
";",
"scan",
"++",
")",
"{",
"if",
"(",
"quote_char",
"!=",
"'",
"\\0",
"'",
")",
"{",
"if",
"(",
"*",
"scan",
"==",
"quote_char",
")",
"{",
"scan",
"++",
";",
"break",
";",
"}",
"}",
"else",
"if",
"(",
"strchr",
"(",
"quotechars",
",",
"*",
"scan",
")",
")",
"{",
"quote_char",
"=",
"*",
"scan",
";",
"}",
"else",
"if",
"(",
"strchr",
"(",
"breakchars",
",",
"*",
"scan",
")",
")",
"{",
"break",
";",
"}",
"}",
"return",
"(",
"scan",
")",
";",
"}"
] | Skip over the possibly quoted word STR (as defined by the quote
characters QUOTECHARS and the word break characters BREAKCHARS). | [
"Skip",
"over",
"the",
"possibly",
"quoted",
"word",
"STR",
"(",
"as",
"defined",
"by",
"the",
"quote",
"characters",
"QUOTECHARS",
"and",
"the",
"word",
"break",
"characters",
"BREAKCHARS",
")",
"."
] | [
"/* Ignore everything until the matching close quote char. */",
"/* Found matching close quote. */",
"/* Found start of a quoted string. */"
] | [
{
"param": "str",
"type": "char"
},
{
"param": "quotechars",
"type": "char"
},
{
"param": "breakchars",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "quotechars",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "breakchars",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
3b14fc942342af4876a6729e43975849eb3fd3dc | atrens/DragonFlyBSD-src | contrib/gdb-7/gdb/completer.c | [
"BSD-3-Clause"
] | C | skip_quoted | char | char *
skip_quoted (char *str)
{
return skip_quoted_chars (str, NULL, NULL);
} | /* Skip over the possibly quoted word STR (as defined by the quote
characters and word break characters used by the completer).
Returns pointer to the location after the "word". */ | Skip over the possibly quoted word STR (as defined by the quote
characters and word break characters used by the completer).
Returns pointer to the location after the "word". | [
"Skip",
"over",
"the",
"possibly",
"quoted",
"word",
"STR",
"(",
"as",
"defined",
"by",
"the",
"quote",
"characters",
"and",
"word",
"break",
"characters",
"used",
"by",
"the",
"completer",
")",
".",
"Returns",
"pointer",
"to",
"the",
"location",
"after",
"the",
"\"",
"word",
"\"",
"."
] | char *
skip_quoted (char *str)
{
return skip_quoted_chars (str, NULL, NULL);
} | [
"char",
"*",
"skip_quoted",
"(",
"char",
"*",
"str",
")",
"{",
"return",
"skip_quoted_chars",
"(",
"str",
",",
"NULL",
",",
"NULL",
")",
";",
"}"
] | Skip over the possibly quoted word STR (as defined by the quote
characters and word break characters used by the completer). | [
"Skip",
"over",
"the",
"possibly",
"quoted",
"word",
"STR",
"(",
"as",
"defined",
"by",
"the",
"quote",
"characters",
"and",
"word",
"break",
"characters",
"used",
"by",
"the",
"completer",
")",
"."
] | [] | [
{
"param": "str",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "str",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_get_reloc_size | null | unsigned int
bfd_get_reloc_size (reloc_howto_type *howto)
{
switch (howto->size)
{
case 0: return 1;
case 1: return 2;
case 2: return 4;
case 3: return 0;
case 4: return 8;
case 5: return 3;
default: abort ();
}
} | /*
FUNCTION
bfd_get_reloc_size
SYNOPSIS
unsigned int bfd_get_reloc_size (reloc_howto_type *);
DESCRIPTION
For a reloc_howto_type that operates on a fixed number of bytes,
this returns the number of bytes operated on.
*/ |
DESCRIPTION
For a reloc_howto_type that operates on a fixed number of bytes,
this returns the number of bytes operated on. | [
"DESCRIPTION",
"For",
"a",
"reloc_howto_type",
"that",
"operates",
"on",
"a",
"fixed",
"number",
"of",
"bytes",
"this",
"returns",
"the",
"number",
"of",
"bytes",
"operated",
"on",
"."
] | unsigned int
bfd_get_reloc_size (reloc_howto_type *howto)
{
switch (howto->size)
{
case 0: return 1;
case 1: return 2;
case 2: return 4;
case 3: return 0;
case 4: return 8;
case 5: return 3;
default: abort ();
}
} | [
"unsigned",
"int",
"bfd_get_reloc_size",
"(",
"reloc_howto_type",
"*",
"howto",
")",
"{",
"switch",
"(",
"howto",
"->",
"size",
")",
"{",
"case",
"0",
":",
"return",
"1",
";",
"case",
"1",
":",
"return",
"2",
";",
"case",
"2",
":",
"return",
"4",
";",
"case",
"3",
":",
"return",
"0",
";",
"case",
"4",
":",
"return",
"8",
";",
"case",
"5",
":",
"return",
"3",
";",
"default",
":",
"abort",
"(",
")",
";",
"}",
"}"
] | FUNCTION
bfd_get_reloc_size | [
"FUNCTION",
"bfd_get_reloc_size"
] | [] | [
{
"param": "howto",
"type": "reloc_howto_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_reloc_offset_in_range | bfd_boolean | bfd_boolean
bfd_reloc_offset_in_range (reloc_howto_type *howto,
bfd *abfd,
asection *section,
bfd_size_type octet)
{
bfd_size_type octet_end = bfd_get_section_limit_octets (abfd, section);
bfd_size_type reloc_size = bfd_get_reloc_size (howto);
/* The reloc field must be contained entirely within the section.
Allow zero length fields (marker relocs or NONE relocs where no
relocation will be performed) at the end of the section. */
return octet <= octet_end && octet + reloc_size <= octet_end;
} | /* HOWTO describes a relocation, at offset OCTET. Return whether the
relocation field is within SECTION of ABFD. */ | HOWTO describes a relocation, at offset OCTET. Return whether the
relocation field is within SECTION of ABFD. | [
"HOWTO",
"describes",
"a",
"relocation",
"at",
"offset",
"OCTET",
".",
"Return",
"whether",
"the",
"relocation",
"field",
"is",
"within",
"SECTION",
"of",
"ABFD",
"."
] | bfd_boolean
bfd_reloc_offset_in_range (reloc_howto_type *howto,
bfd *abfd,
asection *section,
bfd_size_type octet)
{
bfd_size_type octet_end = bfd_get_section_limit_octets (abfd, section);
bfd_size_type reloc_size = bfd_get_reloc_size (howto);
return octet <= octet_end && octet + reloc_size <= octet_end;
} | [
"bfd_boolean",
"bfd_reloc_offset_in_range",
"(",
"reloc_howto_type",
"*",
"howto",
",",
"bfd",
"*",
"abfd",
",",
"asection",
"*",
"section",
",",
"bfd_size_type",
"octet",
")",
"{",
"bfd_size_type",
"octet_end",
"=",
"bfd_get_section_limit_octets",
"(",
"abfd",
",",
"section",
")",
";",
"bfd_size_type",
"reloc_size",
"=",
"bfd_get_reloc_size",
"(",
"howto",
")",
";",
"return",
"octet",
"<=",
"octet_end",
"&&",
"octet",
"+",
"reloc_size",
"<=",
"octet_end",
";",
"}"
] | HOWTO describes a relocation, at offset OCTET. | [
"HOWTO",
"describes",
"a",
"relocation",
"at",
"offset",
"OCTET",
"."
] | [
"/* The reloc field must be contained entirely within the section.\n Allow zero length fields (marker relocs or NONE relocs where no\n relocation will be performed) at the end of the section. */"
] | [
{
"param": "howto",
"type": "reloc_howto_type"
},
{
"param": "abfd",
"type": "bfd"
},
{
"param": "section",
"type": "asection"
},
{
"param": "octet",
"type": "bfd_size_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "section",
"type": "asection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "octet",
"type": "bfd_size_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | read_reloc | bfd_vma | static bfd_vma
read_reloc (bfd *abfd, bfd_byte *data, reloc_howto_type *howto)
{
switch (howto->size)
{
case 0:
return bfd_get_8 (abfd, data);
case 1:
return bfd_get_16 (abfd, data);
case 2:
return bfd_get_32 (abfd, data);
case 3:
break;
#ifdef BFD64
case 4:
return bfd_get_64 (abfd, data);
#endif
case 5:
return bfd_get_24 (abfd, data);
default:
abort ();
}
return 0;
} | /* Read and return the section contents at DATA converted to a host
integer (bfd_vma). The number of bytes read is given by the HOWTO. */ | Read and return the section contents at DATA converted to a host
integer (bfd_vma). The number of bytes read is given by the HOWTO. | [
"Read",
"and",
"return",
"the",
"section",
"contents",
"at",
"DATA",
"converted",
"to",
"a",
"host",
"integer",
"(",
"bfd_vma",
")",
".",
"The",
"number",
"of",
"bytes",
"read",
"is",
"given",
"by",
"the",
"HOWTO",
"."
] | static bfd_vma
read_reloc (bfd *abfd, bfd_byte *data, reloc_howto_type *howto)
{
switch (howto->size)
{
case 0:
return bfd_get_8 (abfd, data);
case 1:
return bfd_get_16 (abfd, data);
case 2:
return bfd_get_32 (abfd, data);
case 3:
break;
#ifdef BFD64
case 4:
return bfd_get_64 (abfd, data);
#endif
case 5:
return bfd_get_24 (abfd, data);
default:
abort ();
}
return 0;
} | [
"static",
"bfd_vma",
"read_reloc",
"(",
"bfd",
"*",
"abfd",
",",
"bfd_byte",
"*",
"data",
",",
"reloc_howto_type",
"*",
"howto",
")",
"{",
"switch",
"(",
"howto",
"->",
"size",
")",
"{",
"case",
"0",
":",
"return",
"bfd_get_8",
"(",
"abfd",
",",
"data",
")",
";",
"case",
"1",
":",
"return",
"bfd_get_16",
"(",
"abfd",
",",
"data",
")",
";",
"case",
"2",
":",
"return",
"bfd_get_32",
"(",
"abfd",
",",
"data",
")",
";",
"case",
"3",
":",
"break",
";",
"#ifdef",
"BFD64",
"case",
"4",
":",
"return",
"bfd_get_64",
"(",
"abfd",
",",
"data",
")",
";",
"#endif",
"case",
"5",
":",
"return",
"bfd_get_24",
"(",
"abfd",
",",
"data",
")",
";",
"default",
":",
"abort",
"(",
")",
";",
"}",
"return",
"0",
";",
"}"
] | Read and return the section contents at DATA converted to a host
integer (bfd_vma). | [
"Read",
"and",
"return",
"the",
"section",
"contents",
"at",
"DATA",
"converted",
"to",
"a",
"host",
"integer",
"(",
"bfd_vma",
")",
"."
] | [] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "data",
"type": "bfd_byte"
},
{
"param": "howto",
"type": "reloc_howto_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | write_reloc | void | static void
write_reloc (bfd *abfd, bfd_vma val, bfd_byte *data, reloc_howto_type *howto)
{
switch (howto->size)
{
case 0:
bfd_put_8 (abfd, val, data);
break;
case 1:
bfd_put_16 (abfd, val, data);
break;
case 2:
bfd_put_32 (abfd, val, data);
break;
case 3:
break;
#ifdef BFD64
case 4:
bfd_put_64 (abfd, val, data);
break;
#endif
case 5:
bfd_put_24 (abfd, val, data);
break;
default:
abort ();
}
} | /* Convert VAL to target format and write to DATA. The number of
bytes written is given by the HOWTO. */ | Convert VAL to target format and write to DATA. The number of
bytes written is given by the HOWTO. | [
"Convert",
"VAL",
"to",
"target",
"format",
"and",
"write",
"to",
"DATA",
".",
"The",
"number",
"of",
"bytes",
"written",
"is",
"given",
"by",
"the",
"HOWTO",
"."
] | static void
write_reloc (bfd *abfd, bfd_vma val, bfd_byte *data, reloc_howto_type *howto)
{
switch (howto->size)
{
case 0:
bfd_put_8 (abfd, val, data);
break;
case 1:
bfd_put_16 (abfd, val, data);
break;
case 2:
bfd_put_32 (abfd, val, data);
break;
case 3:
break;
#ifdef BFD64
case 4:
bfd_put_64 (abfd, val, data);
break;
#endif
case 5:
bfd_put_24 (abfd, val, data);
break;
default:
abort ();
}
} | [
"static",
"void",
"write_reloc",
"(",
"bfd",
"*",
"abfd",
",",
"bfd_vma",
"val",
",",
"bfd_byte",
"*",
"data",
",",
"reloc_howto_type",
"*",
"howto",
")",
"{",
"switch",
"(",
"howto",
"->",
"size",
")",
"{",
"case",
"0",
":",
"bfd_put_8",
"(",
"abfd",
",",
"val",
",",
"data",
")",
";",
"break",
";",
"case",
"1",
":",
"bfd_put_16",
"(",
"abfd",
",",
"val",
",",
"data",
")",
";",
"break",
";",
"case",
"2",
":",
"bfd_put_32",
"(",
"abfd",
",",
"val",
",",
"data",
")",
";",
"break",
";",
"case",
"3",
":",
"break",
";",
"#ifdef",
"BFD64",
"case",
"4",
":",
"bfd_put_64",
"(",
"abfd",
",",
"val",
",",
"data",
")",
";",
"break",
";",
"#endif",
"case",
"5",
":",
"bfd_put_24",
"(",
"abfd",
",",
"val",
",",
"data",
")",
";",
"break",
";",
"default",
":",
"abort",
"(",
")",
";",
"}",
"}"
] | Convert VAL to target format and write to DATA. | [
"Convert",
"VAL",
"to",
"target",
"format",
"and",
"write",
"to",
"DATA",
"."
] | [] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "val",
"type": "bfd_vma"
},
{
"param": "data",
"type": "bfd_byte"
},
{
"param": "howto",
"type": "reloc_howto_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "val",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | apply_reloc | void | static void
apply_reloc (bfd *abfd, bfd_byte *data, reloc_howto_type *howto,
bfd_vma relocation)
{
bfd_vma val = read_reloc (abfd, data, howto);
if (howto->negate)
relocation = -relocation;
val = ((val & ~howto->dst_mask)
| (((val & howto->src_mask) + relocation) & howto->dst_mask));
write_reloc (abfd, val, data, howto);
} | /* Apply RELOCATION value to target bytes at DATA, according to
HOWTO. */ | Apply RELOCATION value to target bytes at DATA, according to
HOWTO. | [
"Apply",
"RELOCATION",
"value",
"to",
"target",
"bytes",
"at",
"DATA",
"according",
"to",
"HOWTO",
"."
] | static void
apply_reloc (bfd *abfd, bfd_byte *data, reloc_howto_type *howto,
bfd_vma relocation)
{
bfd_vma val = read_reloc (abfd, data, howto);
if (howto->negate)
relocation = -relocation;
val = ((val & ~howto->dst_mask)
| (((val & howto->src_mask) + relocation) & howto->dst_mask));
write_reloc (abfd, val, data, howto);
} | [
"static",
"void",
"apply_reloc",
"(",
"bfd",
"*",
"abfd",
",",
"bfd_byte",
"*",
"data",
",",
"reloc_howto_type",
"*",
"howto",
",",
"bfd_vma",
"relocation",
")",
"{",
"bfd_vma",
"val",
"=",
"read_reloc",
"(",
"abfd",
",",
"data",
",",
"howto",
")",
";",
"if",
"(",
"howto",
"->",
"negate",
")",
"relocation",
"=",
"-",
"relocation",
";",
"val",
"=",
"(",
"(",
"val",
"&",
"~",
"howto",
"->",
"dst_mask",
")",
"|",
"(",
"(",
"(",
"val",
"&",
"howto",
"->",
"src_mask",
")",
"+",
"relocation",
")",
"&",
"howto",
"->",
"dst_mask",
")",
")",
";",
"write_reloc",
"(",
"abfd",
",",
"val",
",",
"data",
",",
"howto",
")",
";",
"}"
] | Apply RELOCATION value to target bytes at DATA, according to
HOWTO. | [
"Apply",
"RELOCATION",
"value",
"to",
"target",
"bytes",
"at",
"DATA",
"according",
"to",
"HOWTO",
"."
] | [] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "data",
"type": "bfd_byte"
},
{
"param": "howto",
"type": "reloc_howto_type"
},
{
"param": "relocation",
"type": "bfd_vma"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "relocation",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_perform_relocation | bfd_reloc_status_type | bfd_reloc_status_type
bfd_perform_relocation (bfd *abfd,
arelent *reloc_entry,
void *data,
asection *input_section,
bfd *output_bfd,
char **error_message)
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_size_type octets;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
asection *reloc_target_output_section;
asymbol *symbol;
symbol = *(reloc_entry->sym_ptr_ptr);
/* If we are not producing relocatable output, return an error if
the symbol is not defined. An undefined weak symbol is
considered to have a value of zero (SVR4 ABI, p. 4-27). */
if (bfd_is_und_section (symbol->section)
&& (symbol->flags & BSF_WEAK) == 0
&& output_bfd == NULL)
flag = bfd_reloc_undefined;
/* If there is a function supplied to handle this relocation type,
call it. It'll return `bfd_reloc_continue' if further processing
can be done. */
if (howto && howto->special_function)
{
bfd_reloc_status_type cont;
/* Note - we do not call bfd_reloc_offset_in_range here as the
reloc_entry->address field might actually be valid for the
backend concerned. It is up to the special_function itself
to call bfd_reloc_offset_in_range if needed. */
cont = howto->special_function (abfd, reloc_entry, symbol, data,
input_section, output_bfd,
error_message);
if (cont != bfd_reloc_continue)
return cont;
}
if (bfd_is_abs_section (symbol->section)
&& output_bfd != NULL)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
/* PR 17512: file: 0f67f69d. */
if (howto == NULL)
return bfd_reloc_undefined;
/* Is the address of the relocation really within the section? */
octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section);
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
initial relocation command value. */
/* Get symbol value. (Common symbols are special.) */
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
if ((output_bfd && ! howto->partial_inplace)
|| reloc_target_output_section == NULL)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
output_base += symbol->section->output_offset;
/* If symbol addresses are in octets, convert to bytes. */
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (symbol->section->flags & SEC_ELF_OCTETS))
output_base *= bfd_octets_per_byte (abfd, input_section);
relocation += output_base;
/* Add in supplied addend. */
relocation += reloc_entry->addend;
/* Here the variable relocation holds the final address of the
symbol we are relocating against, plus any addend. */
if (howto->pc_relative)
{
/* This is a PC relative relocation. We want to set RELOCATION
to the distance between the address of the symbol and the
location. RELOCATION is already the address of the symbol.
We start by subtracting the address of the section containing
the location.
If pcrel_offset is set, we must further subtract the position
of the location within the section. Some targets arrange for
the addend to be the negative of the position of the location
within the section; for example, i386-aout does this. For
i386-aout, pcrel_offset is FALSE. Some other targets do not
include the position of the location; for example, ELF.
For those targets, pcrel_offset is TRUE.
If we are producing relocatable output, then we must ensure
that this reloc will be correctly computed when the final
relocation is done. If pcrel_offset is FALSE we want to wind
up with the negative of the location within the section,
which means we must adjust the existing addend by the change
in the location within the section. If pcrel_offset is TRUE
we do not want to adjust the existing addend at all.
FIXME: This seems logical to me, but for the case of
producing relocatable output it is not what the code
actually does. I don't want to change it, because it seems
far too likely that something will break. */
relocation -=
input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset)
relocation -= reloc_entry->address;
}
if (output_bfd != NULL)
{
if (! howto->partial_inplace)
{
/* This is a partial relocation, and we want to apply the relocation
to the reloc entry rather than the raw data. Modify the reloc
inplace to reflect what we now know. */
reloc_entry->addend = relocation;
reloc_entry->address += input_section->output_offset;
return flag;
}
else
{
/* This is a partial relocation, but inplace, so modify the
reloc record a bit.
If we've relocated with a symbol with a section, change
into a ref to the section belonging to the symbol. */
reloc_entry->address += input_section->output_offset;
/* WTF?? */
if (abfd->xvec->flavour == bfd_target_coff_flavour
&& strcmp (abfd->xvec->name, "coff-Intel-little") != 0
&& strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
{
/* For m68k-coff, the addend was being subtracted twice during
relocation with -r. Removing the line below this comment
fixes that problem; see PR 2953.
However, Ian wrote the following, regarding removing the line below,
which explains why it is still enabled: --djm
If you put a patch like that into BFD you need to check all the COFF
linkers. I am fairly certain that patch will break coff-i386 (e.g.,
SCO); see coff_i386_reloc in coff-i386.c where I worked around the
problem in a different way. There may very well be a reason that the
code works as it does.
Hmmm. The first obvious point is that bfd_perform_relocation should
not have any tests that depend upon the flavour. It's seem like
entirely the wrong place for such a thing. The second obvious point
is that the current code ignores the reloc addend when producing
relocatable output for COFF. That's peculiar. In fact, I really
have no idea what the point of the line you want to remove is.
A typical COFF reloc subtracts the old value of the symbol and adds in
the new value to the location in the object file (if it's a pc
relative reloc it adds the difference between the symbol value and the
location). When relocating we need to preserve that property.
BFD handles this by setting the addend to the negative of the old
value of the symbol. Unfortunately it handles common symbols in a
non-standard way (it doesn't subtract the old value) but that's a
different story (we can't change it without losing backward
compatibility with old object files) (coff-i386 does subtract the old
value, to be compatible with existing coff-i386 targets, like SCO).
So everything works fine when not producing relocatable output. When
we are producing relocatable output, logically we should do exactly
what we do when not producing relocatable output. Therefore, your
patch is correct. In fact, it should probably always just set
reloc_entry->addend to 0 for all cases, since it is, in fact, going to
add the value into the object file. This won't hurt the COFF code,
which doesn't use the addend; I'm not sure what it will do to other
formats (the thing to check for would be whether any formats both use
the addend and set partial_inplace).
When I wanted to make coff-i386 produce relocatable output, I ran
into the problem that you are running into: I wanted to remove that
line. Rather than risk it, I made the coff-i386 relocs use a special
function; it's coff_i386_reloc in coff-i386.c. The function
specifically adds the addend field into the object file, knowing that
bfd_perform_relocation is not going to. If you remove that line, then
coff-i386.c will wind up adding the addend field in twice. It's
trivial to fix; it just needs to be done.
The problem with removing the line is just that it may break some
working code. With BFD it's hard to be sure of anything. The right
way to deal with this is simply to build and test at least all the
supported COFF targets. It should be straightforward if time and disk
space consuming. For each target:
1) build the linker
2) generate some executable, and link it using -r (I would
probably use paranoia.o and link against newlib/libc.a, which
for all the supported targets would be available in
/usr/cygnus/progressive/H-host/target/lib/libc.a).
3) make the change to reloc.c
4) rebuild the linker
5) repeat step 2
6) if the resulting object files are the same, you have at least
made it no worse
7) if they are different you have to figure out which version is
right
*/
relocation -= reloc_entry->addend;
reloc_entry->addend = 0;
}
else
{
reloc_entry->addend = relocation;
}
}
}
/* FIXME: This overflow checking is incomplete, because the value
might have overflowed before we get here. For a correct check we
need to compute the value in a size larger than bitsize, but we
can't reasonably do that for a reloc the same size as a host
machine word.
FIXME: We should also do overflow checking on the result after
adding in the value contained in the object file. */
if (howto->complain_on_overflow != complain_overflow_dont
&& flag == bfd_reloc_ok)
flag = bfd_check_overflow (howto->complain_on_overflow,
howto->bitsize,
howto->rightshift,
bfd_arch_bits_per_address (abfd),
relocation);
/* Either we are relocating all the way, or we don't want to apply
the relocation to the reloc entry (probably because there isn't
any room in the output format to describe addends to relocs). */
/* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler
(OSF version 1.3, compiler version 3.11). It miscompiles the
following program:
struct str
{
unsigned int i0;
} s = { 0 };
int
main ()
{
unsigned long x;
x = 0x100000000;
x <<= (unsigned long) s.i0;
if (x == 0)
printf ("failed\n");
else
printf ("succeeded (%lx)\n", x);
}
*/
relocation >>= (bfd_vma) howto->rightshift;
/* Shift everything up to where it's going to be used. */
relocation <<= (bfd_vma) howto->bitpos;
/* Wait for the day when all have the mask in them. */
/* What we do:
i instruction to be left alone
o offset within instruction
r relocation offset to apply
S src mask
D dst mask
N ~dst mask
A part 1
B part 2
R result
Do this:
(( i i i i i o o o o o from bfd_get<size>
and S S S S S) to get the size offset we want
+ r r r r r r r r r r) to get the final value to place
and D D D D D to chop to right size
-----------------------
= A A A A A
And this:
( i i i i i o o o o o from bfd_get<size>
and N N N N N ) get instruction
-----------------------
= B B B B B
And then:
( B B B B B
or A A A A A)
-----------------------
= R R R R R R R R R R put into bfd_put<size>
*/
data = (bfd_byte *) data + octets;
apply_reloc (abfd, data, howto, relocation);
return flag;
} | /*
FUNCTION
bfd_perform_relocation
SYNOPSIS
bfd_reloc_status_type bfd_perform_relocation
(bfd *abfd,
arelent *reloc_entry,
void *data,
asection *input_section,
bfd *output_bfd,
char **error_message);
DESCRIPTION
If @var{output_bfd} is supplied to this function, the
generated image will be relocatable; the relocations are
copied to the output file after they have been changed to
reflect the new state of the world. There are two ways of
reflecting the results of partial linkage in an output file:
by modifying the output data in place, and by modifying the
relocation record. Some native formats (e.g., basic a.out and
basic coff) have no way of specifying an addend in the
relocation type, so the addend has to go in the output data.
This is no big deal since in these formats the output data
slot will always be big enough for the addend. Complex reloc
types with addends were invented to solve just this problem.
The @var{error_message} argument is set to an error message if
this return @code{bfd_reloc_dangerous}.
*/ |
DESCRIPTION
If @var{output_bfd} is supplied to this function, the
generated image will be relocatable; the relocations are
copied to the output file after they have been changed to
reflect the new state of the world. There are two ways of
reflecting the results of partial linkage in an output file:
by modifying the output data in place, and by modifying the
relocation record. Some native formats have no way of specifying an addend in the
relocation type, so the addend has to go in the output data.
This is no big deal since in these formats the output data
slot will always be big enough for the addend. Complex reloc
types with addends were invented to solve just this problem.
The @var{error_message} argument is set to an error message if
this return @code{bfd_reloc_dangerous}. | [
"DESCRIPTION",
"If",
"@var",
"{",
"output_bfd",
"}",
"is",
"supplied",
"to",
"this",
"function",
"the",
"generated",
"image",
"will",
"be",
"relocatable",
";",
"the",
"relocations",
"are",
"copied",
"to",
"the",
"output",
"file",
"after",
"they",
"have",
"been",
"changed",
"to",
"reflect",
"the",
"new",
"state",
"of",
"the",
"world",
".",
"There",
"are",
"two",
"ways",
"of",
"reflecting",
"the",
"results",
"of",
"partial",
"linkage",
"in",
"an",
"output",
"file",
":",
"by",
"modifying",
"the",
"output",
"data",
"in",
"place",
"and",
"by",
"modifying",
"the",
"relocation",
"record",
".",
"Some",
"native",
"formats",
"have",
"no",
"way",
"of",
"specifying",
"an",
"addend",
"in",
"the",
"relocation",
"type",
"so",
"the",
"addend",
"has",
"to",
"go",
"in",
"the",
"output",
"data",
".",
"This",
"is",
"no",
"big",
"deal",
"since",
"in",
"these",
"formats",
"the",
"output",
"data",
"slot",
"will",
"always",
"be",
"big",
"enough",
"for",
"the",
"addend",
".",
"Complex",
"reloc",
"types",
"with",
"addends",
"were",
"invented",
"to",
"solve",
"just",
"this",
"problem",
".",
"The",
"@var",
"{",
"error_message",
"}",
"argument",
"is",
"set",
"to",
"an",
"error",
"message",
"if",
"this",
"return",
"@code",
"{",
"bfd_reloc_dangerous",
"}",
"."
] | bfd_reloc_status_type
bfd_perform_relocation (bfd *abfd,
arelent *reloc_entry,
void *data,
asection *input_section,
bfd *output_bfd,
char **error_message)
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_size_type octets;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
asection *reloc_target_output_section;
asymbol *symbol;
symbol = *(reloc_entry->sym_ptr_ptr);
if (bfd_is_und_section (symbol->section)
&& (symbol->flags & BSF_WEAK) == 0
&& output_bfd == NULL)
flag = bfd_reloc_undefined;
if (howto && howto->special_function)
{
bfd_reloc_status_type cont;
cont = howto->special_function (abfd, reloc_entry, symbol, data,
input_section, output_bfd,
error_message);
if (cont != bfd_reloc_continue)
return cont;
}
if (bfd_is_abs_section (symbol->section)
&& output_bfd != NULL)
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
if (howto == NULL)
return bfd_reloc_undefined;
octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section);
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
reloc_target_output_section = symbol->section->output_section;
if ((output_bfd && ! howto->partial_inplace)
|| reloc_target_output_section == NULL)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
output_base += symbol->section->output_offset;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (symbol->section->flags & SEC_ELF_OCTETS))
output_base *= bfd_octets_per_byte (abfd, input_section);
relocation += output_base;
relocation += reloc_entry->addend;
if (howto->pc_relative)
{
relocation -=
input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset)
relocation -= reloc_entry->address;
}
if (output_bfd != NULL)
{
if (! howto->partial_inplace)
{
reloc_entry->addend = relocation;
reloc_entry->address += input_section->output_offset;
return flag;
}
else
{
reloc_entry->address += input_section->output_offset;
if (abfd->xvec->flavour == bfd_target_coff_flavour
&& strcmp (abfd->xvec->name, "coff-Intel-little") != 0
&& strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
{
relocation -= reloc_entry->addend;
reloc_entry->addend = 0;
}
else
{
reloc_entry->addend = relocation;
}
}
}
if (howto->complain_on_overflow != complain_overflow_dont
&& flag == bfd_reloc_ok)
flag = bfd_check_overflow (howto->complain_on_overflow,
howto->bitsize,
howto->rightshift,
bfd_arch_bits_per_address (abfd),
relocation);
relocation >>= (bfd_vma) howto->rightshift;
relocation <<= (bfd_vma) howto->bitpos;
data = (bfd_byte *) data + octets;
apply_reloc (abfd, data, howto, relocation);
return flag;
} | [
"bfd_reloc_status_type",
"bfd_perform_relocation",
"(",
"bfd",
"*",
"abfd",
",",
"arelent",
"*",
"reloc_entry",
",",
"void",
"*",
"data",
",",
"asection",
"*",
"input_section",
",",
"bfd",
"*",
"output_bfd",
",",
"char",
"*",
"*",
"error_message",
")",
"{",
"bfd_vma",
"relocation",
";",
"bfd_reloc_status_type",
"flag",
"=",
"bfd_reloc_ok",
";",
"bfd_size_type",
"octets",
";",
"bfd_vma",
"output_base",
"=",
"0",
";",
"reloc_howto_type",
"*",
"howto",
"=",
"reloc_entry",
"->",
"howto",
";",
"asection",
"*",
"reloc_target_output_section",
";",
"asymbol",
"*",
"symbol",
";",
"symbol",
"=",
"*",
"(",
"reloc_entry",
"->",
"sym_ptr_ptr",
")",
";",
"if",
"(",
"bfd_is_und_section",
"(",
"symbol",
"->",
"section",
")",
"&&",
"(",
"symbol",
"->",
"flags",
"&",
"BSF_WEAK",
")",
"==",
"0",
"&&",
"output_bfd",
"==",
"NULL",
")",
"flag",
"=",
"bfd_reloc_undefined",
";",
"if",
"(",
"howto",
"&&",
"howto",
"->",
"special_function",
")",
"{",
"bfd_reloc_status_type",
"cont",
";",
"cont",
"=",
"howto",
"->",
"special_function",
"(",
"abfd",
",",
"reloc_entry",
",",
"symbol",
",",
"data",
",",
"input_section",
",",
"output_bfd",
",",
"error_message",
")",
";",
"if",
"(",
"cont",
"!=",
"bfd_reloc_continue",
")",
"return",
"cont",
";",
"}",
"if",
"(",
"bfd_is_abs_section",
"(",
"symbol",
"->",
"section",
")",
"&&",
"output_bfd",
"!=",
"NULL",
")",
"{",
"reloc_entry",
"->",
"address",
"+=",
"input_section",
"->",
"output_offset",
";",
"return",
"bfd_reloc_ok",
";",
"}",
"if",
"(",
"howto",
"==",
"NULL",
")",
"return",
"bfd_reloc_undefined",
";",
"octets",
"=",
"reloc_entry",
"->",
"address",
"*",
"bfd_octets_per_byte",
"(",
"abfd",
",",
"input_section",
")",
";",
"if",
"(",
"!",
"bfd_reloc_offset_in_range",
"(",
"howto",
",",
"abfd",
",",
"input_section",
",",
"octets",
")",
")",
"return",
"bfd_reloc_outofrange",
";",
"if",
"(",
"bfd_is_com_section",
"(",
"symbol",
"->",
"section",
")",
")",
"relocation",
"=",
"0",
";",
"else",
"relocation",
"=",
"symbol",
"->",
"value",
";",
"reloc_target_output_section",
"=",
"symbol",
"->",
"section",
"->",
"output_section",
";",
"if",
"(",
"(",
"output_bfd",
"&&",
"!",
"howto",
"->",
"partial_inplace",
")",
"||",
"reloc_target_output_section",
"==",
"NULL",
")",
"output_base",
"=",
"0",
";",
"else",
"output_base",
"=",
"reloc_target_output_section",
"->",
"vma",
";",
"output_base",
"+=",
"symbol",
"->",
"section",
"->",
"output_offset",
";",
"if",
"(",
"bfd_get_flavour",
"(",
"abfd",
")",
"==",
"bfd_target_elf_flavour",
"&&",
"(",
"symbol",
"->",
"section",
"->",
"flags",
"&",
"SEC_ELF_OCTETS",
")",
")",
"output_base",
"*=",
"bfd_octets_per_byte",
"(",
"abfd",
",",
"input_section",
")",
";",
"relocation",
"+=",
"output_base",
";",
"relocation",
"+=",
"reloc_entry",
"->",
"addend",
";",
"if",
"(",
"howto",
"->",
"pc_relative",
")",
"{",
"relocation",
"-=",
"input_section",
"->",
"output_section",
"->",
"vma",
"+",
"input_section",
"->",
"output_offset",
";",
"if",
"(",
"howto",
"->",
"pcrel_offset",
")",
"relocation",
"-=",
"reloc_entry",
"->",
"address",
";",
"}",
"if",
"(",
"output_bfd",
"!=",
"NULL",
")",
"{",
"if",
"(",
"!",
"howto",
"->",
"partial_inplace",
")",
"{",
"reloc_entry",
"->",
"addend",
"=",
"relocation",
";",
"reloc_entry",
"->",
"address",
"+=",
"input_section",
"->",
"output_offset",
";",
"return",
"flag",
";",
"}",
"else",
"{",
"reloc_entry",
"->",
"address",
"+=",
"input_section",
"->",
"output_offset",
";",
"if",
"(",
"abfd",
"->",
"xvec",
"->",
"flavour",
"==",
"bfd_target_coff_flavour",
"&&",
"strcmp",
"(",
"abfd",
"->",
"xvec",
"->",
"name",
",",
"\"",
"\"",
")",
"!=",
"0",
"&&",
"strcmp",
"(",
"abfd",
"->",
"xvec",
"->",
"name",
",",
"\"",
"\"",
")",
"!=",
"0",
")",
"{",
"relocation",
"-=",
"reloc_entry",
"->",
"addend",
";",
"reloc_entry",
"->",
"addend",
"=",
"0",
";",
"}",
"else",
"{",
"reloc_entry",
"->",
"addend",
"=",
"relocation",
";",
"}",
"}",
"}",
"if",
"(",
"howto",
"->",
"complain_on_overflow",
"!=",
"complain_overflow_dont",
"&&",
"flag",
"==",
"bfd_reloc_ok",
")",
"flag",
"=",
"bfd_check_overflow",
"(",
"howto",
"->",
"complain_on_overflow",
",",
"howto",
"->",
"bitsize",
",",
"howto",
"->",
"rightshift",
",",
"bfd_arch_bits_per_address",
"(",
"abfd",
")",
",",
"relocation",
")",
";",
"relocation",
">>=",
"(",
"bfd_vma",
")",
"howto",
"->",
"rightshift",
";",
"relocation",
"<<=",
"(",
"bfd_vma",
")",
"howto",
"->",
"bitpos",
";",
"data",
"=",
"(",
"bfd_byte",
"*",
")",
"data",
"+",
"octets",
";",
"apply_reloc",
"(",
"abfd",
",",
"data",
",",
"howto",
",",
"relocation",
")",
";",
"return",
"flag",
";",
"}"
] | FUNCTION
bfd_perform_relocation | [
"FUNCTION",
"bfd_perform_relocation"
] | [
"/* If we are not producing relocatable output, return an error if\n the symbol is not defined. An undefined weak symbol is\n considered to have a value of zero (SVR4 ABI, p. 4-27). */",
"/* If there is a function supplied to handle this relocation type,\n call it. It'll return `bfd_reloc_continue' if further processing\n can be done. */",
"/* Note - we do not call bfd_reloc_offset_in_range here as the\n\t reloc_entry->address field might actually be valid for the\n\t backend concerned. It is up to the special_function itself\n\t to call bfd_reloc_offset_in_range if needed. */",
"/* PR 17512: file: 0f67f69d. */",
"/* Is the address of the relocation really within the section? */",
"/* Work out which section the relocation is targeted at and the\n initial relocation command value. */",
"/* Get symbol value. (Common symbols are special.) */",
"/* Convert input-section-relative symbol value to absolute. */",
"/* If symbol addresses are in octets, convert to bytes. */",
"/* Add in supplied addend. */",
"/* Here the variable relocation holds the final address of the\n symbol we are relocating against, plus any addend. */",
"/* This is a PC relative relocation. We want to set RELOCATION\n\t to the distance between the address of the symbol and the\n\t location. RELOCATION is already the address of the symbol.\n\n\t We start by subtracting the address of the section containing\n\t the location.\n\n\t If pcrel_offset is set, we must further subtract the position\n\t of the location within the section. Some targets arrange for\n\t the addend to be the negative of the position of the location\n\t within the section; for example, i386-aout does this. For\n\t i386-aout, pcrel_offset is FALSE. Some other targets do not\n\t include the position of the location; for example, ELF.\n\t For those targets, pcrel_offset is TRUE.\n\n\t If we are producing relocatable output, then we must ensure\n\t that this reloc will be correctly computed when the final\n\t relocation is done. If pcrel_offset is FALSE we want to wind\n\t up with the negative of the location within the section,\n\t which means we must adjust the existing addend by the change\n\t in the location within the section. If pcrel_offset is TRUE\n\t we do not want to adjust the existing addend at all.\n\n\t FIXME: This seems logical to me, but for the case of\n\t producing relocatable output it is not what the code\n\t actually does. I don't want to change it, because it seems\n\t far too likely that something will break. */",
"/* This is a partial relocation, and we want to apply the relocation\n\t to the reloc entry rather than the raw data. Modify the reloc\n\t inplace to reflect what we now know. */",
"/* This is a partial relocation, but inplace, so modify the\n\t reloc record a bit.\n\n\t If we've relocated with a symbol with a section, change\n\t into a ref to the section belonging to the symbol. */",
"/* WTF?? */",
"/* For m68k-coff, the addend was being subtracted twice during\n\t\t relocation with -r. Removing the line below this comment\n\t\t fixes that problem; see PR 2953.\n\nHowever, Ian wrote the following, regarding removing the line below,\nwhich explains why it is still enabled: --djm\n\nIf you put a patch like that into BFD you need to check all the COFF\nlinkers. I am fairly certain that patch will break coff-i386 (e.g.,\nSCO); see coff_i386_reloc in coff-i386.c where I worked around the\nproblem in a different way. There may very well be a reason that the\ncode works as it does.\n\nHmmm. The first obvious point is that bfd_perform_relocation should\nnot have any tests that depend upon the flavour. It's seem like\nentirely the wrong place for such a thing. The second obvious point\nis that the current code ignores the reloc addend when producing\nrelocatable output for COFF. That's peculiar. In fact, I really\nhave no idea what the point of the line you want to remove is.\n\nA typical COFF reloc subtracts the old value of the symbol and adds in\nthe new value to the location in the object file (if it's a pc\nrelative reloc it adds the difference between the symbol value and the\nlocation). When relocating we need to preserve that property.\n\nBFD handles this by setting the addend to the negative of the old\nvalue of the symbol. Unfortunately it handles common symbols in a\nnon-standard way (it doesn't subtract the old value) but that's a\ndifferent story (we can't change it without losing backward\ncompatibility with old object files) (coff-i386 does subtract the old\nvalue, to be compatible with existing coff-i386 targets, like SCO).\n\nSo everything works fine when not producing relocatable output. When\nwe are producing relocatable output, logically we should do exactly\nwhat we do when not producing relocatable output. Therefore, your\npatch is correct. In fact, it should probably always just set\nreloc_entry->addend to 0 for all cases, since it is, in fact, going to\nadd the value into the object file. This won't hurt the COFF code,\nwhich doesn't use the addend; I'm not sure what it will do to other\nformats (the thing to check for would be whether any formats both use\nthe addend and set partial_inplace).\n\nWhen I wanted to make coff-i386 produce relocatable output, I ran\ninto the problem that you are running into: I wanted to remove that\nline. Rather than risk it, I made the coff-i386 relocs use a special\nfunction; it's coff_i386_reloc in coff-i386.c. The function\nspecifically adds the addend field into the object file, knowing that\nbfd_perform_relocation is not going to. If you remove that line, then\ncoff-i386.c will wind up adding the addend field in twice. It's\ntrivial to fix; it just needs to be done.\n\nThe problem with removing the line is just that it may break some\nworking code. With BFD it's hard to be sure of anything. The right\nway to deal with this is simply to build and test at least all the\nsupported COFF targets. It should be straightforward if time and disk\nspace consuming. For each target:\n 1) build the linker\n 2) generate some executable, and link it using -r (I would\n probably use paranoia.o and link against newlib/libc.a, which\n for all the supported targets would be available in\n /usr/cygnus/progressive/H-host/target/lib/libc.a).\n 3) make the change to reloc.c\n 4) rebuild the linker\n 5) repeat step 2\n 6) if the resulting object files are the same, you have at least\n made it no worse\n 7) if they are different you have to figure out which version is\n right\n*/",
"/* FIXME: This overflow checking is incomplete, because the value\n might have overflowed before we get here. For a correct check we\n need to compute the value in a size larger than bitsize, but we\n can't reasonably do that for a reloc the same size as a host\n machine word.\n FIXME: We should also do overflow checking on the result after\n adding in the value contained in the object file. */",
"/* Either we are relocating all the way, or we don't want to apply\n the relocation to the reloc entry (probably because there isn't\n any room in the output format to describe addends to relocs). */",
"/* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler\n (OSF version 1.3, compiler version 3.11). It miscompiles the\n following program:\n\n struct str\n {\n unsigned int i0;\n } s = { 0 };\n\n int\n main ()\n {\n unsigned long x;\n\n x = 0x100000000;\n x <<= (unsigned long) s.i0;\n if (x == 0)\n\t printf (\"failed\\n\");\n else\n\t printf (\"succeeded (%lx)\\n\", x);\n }\n */",
"/* Shift everything up to where it's going to be used. */",
"/* Wait for the day when all have the mask in them. */",
"/* What we do:\n i instruction to be left alone\n o offset within instruction\n r relocation offset to apply\n S src mask\n D dst mask\n N ~dst mask\n A part 1\n B part 2\n R result\n\n Do this:\n ((\t i i i i i o o o o o from bfd_get<size>\n and\t S S S S S) to get the size offset we want\n +\t r r r r r r r r r r) to get the final value to place\n and\t D D D D D to chop to right size\n -----------------------\n =\t\t A A A A A\n And this:\n (\t i i i i i o o o o o from bfd_get<size>\n and N N N N N\t ) get instruction\n -----------------------\n =\t B B B B B\n\n And then:\n (\t B B B B B\n or\t\t A A A A A)\n -----------------------\n =\t R R R R R R R R R R put into bfd_put<size>\n */"
] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "reloc_entry",
"type": "arelent"
},
{
"param": "data",
"type": "void"
},
{
"param": "input_section",
"type": "asection"
},
{
"param": "output_bfd",
"type": "bfd"
},
{
"param": "error_message",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reloc_entry",
"type": "arelent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_section",
"type": "asection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "output_bfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error_message",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_install_relocation | bfd_reloc_status_type | bfd_reloc_status_type
bfd_install_relocation (bfd *abfd,
arelent *reloc_entry,
void *data_start,
bfd_vma data_start_offset,
asection *input_section,
char **error_message)
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_size_type octets;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
asection *reloc_target_output_section;
asymbol *symbol;
bfd_byte *data;
symbol = *(reloc_entry->sym_ptr_ptr);
/* If there is a function supplied to handle this relocation type,
call it. It'll return `bfd_reloc_continue' if further processing
can be done. */
if (howto && howto->special_function)
{
bfd_reloc_status_type cont;
/* Note - we do not call bfd_reloc_offset_in_range here as the
reloc_entry->address field might actually be valid for the
backend concerned. It is up to the special_function itself
to call bfd_reloc_offset_in_range if needed. */
/* XXX - The special_function calls haven't been fixed up to deal
with creating new relocations and section contents. */
cont = howto->special_function (abfd, reloc_entry, symbol,
/* XXX - Non-portable! */
((bfd_byte *) data_start
- data_start_offset),
input_section, abfd, error_message);
if (cont != bfd_reloc_continue)
return cont;
}
if (bfd_is_abs_section (symbol->section))
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
/* No need to check for howto != NULL if !bfd_is_abs_section as
it will have been checked in `bfd_perform_relocation already'. */
/* Is the address of the relocation really within the section? */
octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section);
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
/* Work out which section the relocation is targeted at and the
initial relocation command value. */
/* Get symbol value. (Common symbols are special.) */
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
reloc_target_output_section = symbol->section->output_section;
/* Convert input-section-relative symbol value to absolute. */
if (! howto->partial_inplace)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
output_base += symbol->section->output_offset;
/* If symbol addresses are in octets, convert to bytes. */
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (symbol->section->flags & SEC_ELF_OCTETS))
output_base *= bfd_octets_per_byte (abfd, input_section);
relocation += output_base;
/* Add in supplied addend. */
relocation += reloc_entry->addend;
/* Here the variable relocation holds the final address of the
symbol we are relocating against, plus any addend. */
if (howto->pc_relative)
{
/* This is a PC relative relocation. We want to set RELOCATION
to the distance between the address of the symbol and the
location. RELOCATION is already the address of the symbol.
We start by subtracting the address of the section containing
the location.
If pcrel_offset is set, we must further subtract the position
of the location within the section. Some targets arrange for
the addend to be the negative of the position of the location
within the section; for example, i386-aout does this. For
i386-aout, pcrel_offset is FALSE. Some other targets do not
include the position of the location; for example, ELF.
For those targets, pcrel_offset is TRUE.
If we are producing relocatable output, then we must ensure
that this reloc will be correctly computed when the final
relocation is done. If pcrel_offset is FALSE we want to wind
up with the negative of the location within the section,
which means we must adjust the existing addend by the change
in the location within the section. If pcrel_offset is TRUE
we do not want to adjust the existing addend at all.
FIXME: This seems logical to me, but for the case of
producing relocatable output it is not what the code
actually does. I don't want to change it, because it seems
far too likely that something will break. */
relocation -=
input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset && howto->partial_inplace)
relocation -= reloc_entry->address;
}
if (! howto->partial_inplace)
{
/* This is a partial relocation, and we want to apply the relocation
to the reloc entry rather than the raw data. Modify the reloc
inplace to reflect what we now know. */
reloc_entry->addend = relocation;
reloc_entry->address += input_section->output_offset;
return flag;
}
else
{
/* This is a partial relocation, but inplace, so modify the
reloc record a bit.
If we've relocated with a symbol with a section, change
into a ref to the section belonging to the symbol. */
reloc_entry->address += input_section->output_offset;
/* WTF?? */
if (abfd->xvec->flavour == bfd_target_coff_flavour
&& strcmp (abfd->xvec->name, "coff-Intel-little") != 0
&& strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
{
/* For m68k-coff, the addend was being subtracted twice during
relocation with -r. Removing the line below this comment
fixes that problem; see PR 2953.
However, Ian wrote the following, regarding removing the line below,
which explains why it is still enabled: --djm
If you put a patch like that into BFD you need to check all the COFF
linkers. I am fairly certain that patch will break coff-i386 (e.g.,
SCO); see coff_i386_reloc in coff-i386.c where I worked around the
problem in a different way. There may very well be a reason that the
code works as it does.
Hmmm. The first obvious point is that bfd_install_relocation should
not have any tests that depend upon the flavour. It's seem like
entirely the wrong place for such a thing. The second obvious point
is that the current code ignores the reloc addend when producing
relocatable output for COFF. That's peculiar. In fact, I really
have no idea what the point of the line you want to remove is.
A typical COFF reloc subtracts the old value of the symbol and adds in
the new value to the location in the object file (if it's a pc
relative reloc it adds the difference between the symbol value and the
location). When relocating we need to preserve that property.
BFD handles this by setting the addend to the negative of the old
value of the symbol. Unfortunately it handles common symbols in a
non-standard way (it doesn't subtract the old value) but that's a
different story (we can't change it without losing backward
compatibility with old object files) (coff-i386 does subtract the old
value, to be compatible with existing coff-i386 targets, like SCO).
So everything works fine when not producing relocatable output. When
we are producing relocatable output, logically we should do exactly
what we do when not producing relocatable output. Therefore, your
patch is correct. In fact, it should probably always just set
reloc_entry->addend to 0 for all cases, since it is, in fact, going to
add the value into the object file. This won't hurt the COFF code,
which doesn't use the addend; I'm not sure what it will do to other
formats (the thing to check for would be whether any formats both use
the addend and set partial_inplace).
When I wanted to make coff-i386 produce relocatable output, I ran
into the problem that you are running into: I wanted to remove that
line. Rather than risk it, I made the coff-i386 relocs use a special
function; it's coff_i386_reloc in coff-i386.c. The function
specifically adds the addend field into the object file, knowing that
bfd_install_relocation is not going to. If you remove that line, then
coff-i386.c will wind up adding the addend field in twice. It's
trivial to fix; it just needs to be done.
The problem with removing the line is just that it may break some
working code. With BFD it's hard to be sure of anything. The right
way to deal with this is simply to build and test at least all the
supported COFF targets. It should be straightforward if time and disk
space consuming. For each target:
1) build the linker
2) generate some executable, and link it using -r (I would
probably use paranoia.o and link against newlib/libc.a, which
for all the supported targets would be available in
/usr/cygnus/progressive/H-host/target/lib/libc.a).
3) make the change to reloc.c
4) rebuild the linker
5) repeat step 2
6) if the resulting object files are the same, you have at least
made it no worse
7) if they are different you have to figure out which version is
right. */
relocation -= reloc_entry->addend;
/* FIXME: There should be no target specific code here... */
if (strcmp (abfd->xvec->name, "coff-z8k") != 0)
reloc_entry->addend = 0;
}
else
{
reloc_entry->addend = relocation;
}
}
/* FIXME: This overflow checking is incomplete, because the value
might have overflowed before we get here. For a correct check we
need to compute the value in a size larger than bitsize, but we
can't reasonably do that for a reloc the same size as a host
machine word.
FIXME: We should also do overflow checking on the result after
adding in the value contained in the object file. */
if (howto->complain_on_overflow != complain_overflow_dont)
flag = bfd_check_overflow (howto->complain_on_overflow,
howto->bitsize,
howto->rightshift,
bfd_arch_bits_per_address (abfd),
relocation);
/* Either we are relocating all the way, or we don't want to apply
the relocation to the reloc entry (probably because there isn't
any room in the output format to describe addends to relocs). */
/* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler
(OSF version 1.3, compiler version 3.11). It miscompiles the
following program:
struct str
{
unsigned int i0;
} s = { 0 };
int
main ()
{
unsigned long x;
x = 0x100000000;
x <<= (unsigned long) s.i0;
if (x == 0)
printf ("failed\n");
else
printf ("succeeded (%lx)\n", x);
}
*/
relocation >>= (bfd_vma) howto->rightshift;
/* Shift everything up to where it's going to be used. */
relocation <<= (bfd_vma) howto->bitpos;
/* Wait for the day when all have the mask in them. */
/* What we do:
i instruction to be left alone
o offset within instruction
r relocation offset to apply
S src mask
D dst mask
N ~dst mask
A part 1
B part 2
R result
Do this:
(( i i i i i o o o o o from bfd_get<size>
and S S S S S) to get the size offset we want
+ r r r r r r r r r r) to get the final value to place
and D D D D D to chop to right size
-----------------------
= A A A A A
And this:
( i i i i i o o o o o from bfd_get<size>
and N N N N N ) get instruction
-----------------------
= B B B B B
And then:
( B B B B B
or A A A A A)
-----------------------
= R R R R R R R R R R put into bfd_put<size>
*/
data = (bfd_byte *) data_start + (octets - data_start_offset);
apply_reloc (abfd, data, howto, relocation);
return flag;
} | /*
FUNCTION
bfd_install_relocation
SYNOPSIS
bfd_reloc_status_type bfd_install_relocation
(bfd *abfd,
arelent *reloc_entry,
void *data, bfd_vma data_start,
asection *input_section,
char **error_message);
DESCRIPTION
This looks remarkably like <<bfd_perform_relocation>>, except it
does not expect that the section contents have been filled in.
I.e., it's suitable for use when creating, rather than applying
a relocation.
For now, this function should be considered reserved for the
assembler.
*/ |
DESCRIPTION
This looks remarkably like <>, except it
does not expect that the section contents have been filled in.
I.e., it's suitable for use when creating, rather than applying
a relocation.
For now, this function should be considered reserved for the
assembler. | [
"DESCRIPTION",
"This",
"looks",
"remarkably",
"like",
"<",
">",
"except",
"it",
"does",
"not",
"expect",
"that",
"the",
"section",
"contents",
"have",
"been",
"filled",
"in",
".",
"I",
".",
"e",
".",
"it",
"'",
"s",
"suitable",
"for",
"use",
"when",
"creating",
"rather",
"than",
"applying",
"a",
"relocation",
".",
"For",
"now",
"this",
"function",
"should",
"be",
"considered",
"reserved",
"for",
"the",
"assembler",
"."
] | bfd_reloc_status_type
bfd_install_relocation (bfd *abfd,
arelent *reloc_entry,
void *data_start,
bfd_vma data_start_offset,
asection *input_section,
char **error_message)
{
bfd_vma relocation;
bfd_reloc_status_type flag = bfd_reloc_ok;
bfd_size_type octets;
bfd_vma output_base = 0;
reloc_howto_type *howto = reloc_entry->howto;
asection *reloc_target_output_section;
asymbol *symbol;
bfd_byte *data;
symbol = *(reloc_entry->sym_ptr_ptr);
if (howto && howto->special_function)
{
bfd_reloc_status_type cont;
cont = howto->special_function (abfd, reloc_entry, symbol,
((bfd_byte *) data_start
- data_start_offset),
input_section, abfd, error_message);
if (cont != bfd_reloc_continue)
return cont;
}
if (bfd_is_abs_section (symbol->section))
{
reloc_entry->address += input_section->output_offset;
return bfd_reloc_ok;
}
octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section);
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
if (bfd_is_com_section (symbol->section))
relocation = 0;
else
relocation = symbol->value;
reloc_target_output_section = symbol->section->output_section;
if (! howto->partial_inplace)
output_base = 0;
else
output_base = reloc_target_output_section->vma;
output_base += symbol->section->output_offset;
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& (symbol->section->flags & SEC_ELF_OCTETS))
output_base *= bfd_octets_per_byte (abfd, input_section);
relocation += output_base;
relocation += reloc_entry->addend;
if (howto->pc_relative)
{
relocation -=
input_section->output_section->vma + input_section->output_offset;
if (howto->pcrel_offset && howto->partial_inplace)
relocation -= reloc_entry->address;
}
if (! howto->partial_inplace)
{
reloc_entry->addend = relocation;
reloc_entry->address += input_section->output_offset;
return flag;
}
else
{
reloc_entry->address += input_section->output_offset;
if (abfd->xvec->flavour == bfd_target_coff_flavour
&& strcmp (abfd->xvec->name, "coff-Intel-little") != 0
&& strcmp (abfd->xvec->name, "coff-Intel-big") != 0)
{
relocation -= reloc_entry->addend;
if (strcmp (abfd->xvec->name, "coff-z8k") != 0)
reloc_entry->addend = 0;
}
else
{
reloc_entry->addend = relocation;
}
}
if (howto->complain_on_overflow != complain_overflow_dont)
flag = bfd_check_overflow (howto->complain_on_overflow,
howto->bitsize,
howto->rightshift,
bfd_arch_bits_per_address (abfd),
relocation);
relocation >>= (bfd_vma) howto->rightshift;
relocation <<= (bfd_vma) howto->bitpos;
data = (bfd_byte *) data_start + (octets - data_start_offset);
apply_reloc (abfd, data, howto, relocation);
return flag;
} | [
"bfd_reloc_status_type",
"bfd_install_relocation",
"(",
"bfd",
"*",
"abfd",
",",
"arelent",
"*",
"reloc_entry",
",",
"void",
"*",
"data_start",
",",
"bfd_vma",
"data_start_offset",
",",
"asection",
"*",
"input_section",
",",
"char",
"*",
"*",
"error_message",
")",
"{",
"bfd_vma",
"relocation",
";",
"bfd_reloc_status_type",
"flag",
"=",
"bfd_reloc_ok",
";",
"bfd_size_type",
"octets",
";",
"bfd_vma",
"output_base",
"=",
"0",
";",
"reloc_howto_type",
"*",
"howto",
"=",
"reloc_entry",
"->",
"howto",
";",
"asection",
"*",
"reloc_target_output_section",
";",
"asymbol",
"*",
"symbol",
";",
"bfd_byte",
"*",
"data",
";",
"symbol",
"=",
"*",
"(",
"reloc_entry",
"->",
"sym_ptr_ptr",
")",
";",
"if",
"(",
"howto",
"&&",
"howto",
"->",
"special_function",
")",
"{",
"bfd_reloc_status_type",
"cont",
";",
"cont",
"=",
"howto",
"->",
"special_function",
"(",
"abfd",
",",
"reloc_entry",
",",
"symbol",
",",
"(",
"(",
"bfd_byte",
"*",
")",
"data_start",
"-",
"data_start_offset",
")",
",",
"input_section",
",",
"abfd",
",",
"error_message",
")",
";",
"if",
"(",
"cont",
"!=",
"bfd_reloc_continue",
")",
"return",
"cont",
";",
"}",
"if",
"(",
"bfd_is_abs_section",
"(",
"symbol",
"->",
"section",
")",
")",
"{",
"reloc_entry",
"->",
"address",
"+=",
"input_section",
"->",
"output_offset",
";",
"return",
"bfd_reloc_ok",
";",
"}",
"octets",
"=",
"reloc_entry",
"->",
"address",
"*",
"bfd_octets_per_byte",
"(",
"abfd",
",",
"input_section",
")",
";",
"if",
"(",
"!",
"bfd_reloc_offset_in_range",
"(",
"howto",
",",
"abfd",
",",
"input_section",
",",
"octets",
")",
")",
"return",
"bfd_reloc_outofrange",
";",
"if",
"(",
"bfd_is_com_section",
"(",
"symbol",
"->",
"section",
")",
")",
"relocation",
"=",
"0",
";",
"else",
"relocation",
"=",
"symbol",
"->",
"value",
";",
"reloc_target_output_section",
"=",
"symbol",
"->",
"section",
"->",
"output_section",
";",
"if",
"(",
"!",
"howto",
"->",
"partial_inplace",
")",
"output_base",
"=",
"0",
";",
"else",
"output_base",
"=",
"reloc_target_output_section",
"->",
"vma",
";",
"output_base",
"+=",
"symbol",
"->",
"section",
"->",
"output_offset",
";",
"if",
"(",
"bfd_get_flavour",
"(",
"abfd",
")",
"==",
"bfd_target_elf_flavour",
"&&",
"(",
"symbol",
"->",
"section",
"->",
"flags",
"&",
"SEC_ELF_OCTETS",
")",
")",
"output_base",
"*=",
"bfd_octets_per_byte",
"(",
"abfd",
",",
"input_section",
")",
";",
"relocation",
"+=",
"output_base",
";",
"relocation",
"+=",
"reloc_entry",
"->",
"addend",
";",
"if",
"(",
"howto",
"->",
"pc_relative",
")",
"{",
"relocation",
"-=",
"input_section",
"->",
"output_section",
"->",
"vma",
"+",
"input_section",
"->",
"output_offset",
";",
"if",
"(",
"howto",
"->",
"pcrel_offset",
"&&",
"howto",
"->",
"partial_inplace",
")",
"relocation",
"-=",
"reloc_entry",
"->",
"address",
";",
"}",
"if",
"(",
"!",
"howto",
"->",
"partial_inplace",
")",
"{",
"reloc_entry",
"->",
"addend",
"=",
"relocation",
";",
"reloc_entry",
"->",
"address",
"+=",
"input_section",
"->",
"output_offset",
";",
"return",
"flag",
";",
"}",
"else",
"{",
"reloc_entry",
"->",
"address",
"+=",
"input_section",
"->",
"output_offset",
";",
"if",
"(",
"abfd",
"->",
"xvec",
"->",
"flavour",
"==",
"bfd_target_coff_flavour",
"&&",
"strcmp",
"(",
"abfd",
"->",
"xvec",
"->",
"name",
",",
"\"",
"\"",
")",
"!=",
"0",
"&&",
"strcmp",
"(",
"abfd",
"->",
"xvec",
"->",
"name",
",",
"\"",
"\"",
")",
"!=",
"0",
")",
"{",
"relocation",
"-=",
"reloc_entry",
"->",
"addend",
";",
"if",
"(",
"strcmp",
"(",
"abfd",
"->",
"xvec",
"->",
"name",
",",
"\"",
"\"",
")",
"!=",
"0",
")",
"reloc_entry",
"->",
"addend",
"=",
"0",
";",
"}",
"else",
"{",
"reloc_entry",
"->",
"addend",
"=",
"relocation",
";",
"}",
"}",
"if",
"(",
"howto",
"->",
"complain_on_overflow",
"!=",
"complain_overflow_dont",
")",
"flag",
"=",
"bfd_check_overflow",
"(",
"howto",
"->",
"complain_on_overflow",
",",
"howto",
"->",
"bitsize",
",",
"howto",
"->",
"rightshift",
",",
"bfd_arch_bits_per_address",
"(",
"abfd",
")",
",",
"relocation",
")",
";",
"relocation",
">>=",
"(",
"bfd_vma",
")",
"howto",
"->",
"rightshift",
";",
"relocation",
"<<=",
"(",
"bfd_vma",
")",
"howto",
"->",
"bitpos",
";",
"data",
"=",
"(",
"bfd_byte",
"*",
")",
"data_start",
"+",
"(",
"octets",
"-",
"data_start_offset",
")",
";",
"apply_reloc",
"(",
"abfd",
",",
"data",
",",
"howto",
",",
"relocation",
")",
";",
"return",
"flag",
";",
"}"
] | FUNCTION
bfd_install_relocation | [
"FUNCTION",
"bfd_install_relocation"
] | [
"/* If there is a function supplied to handle this relocation type,\n call it. It'll return `bfd_reloc_continue' if further processing\n can be done. */",
"/* Note - we do not call bfd_reloc_offset_in_range here as the\n\t reloc_entry->address field might actually be valid for the\n\t backend concerned. It is up to the special_function itself\n\t to call bfd_reloc_offset_in_range if needed. */",
"/* XXX - The special_function calls haven't been fixed up to deal\n\t with creating new relocations and section contents. */",
"/* XXX - Non-portable! */",
"/* No need to check for howto != NULL if !bfd_is_abs_section as\n it will have been checked in `bfd_perform_relocation already'. */",
"/* Is the address of the relocation really within the section? */",
"/* Work out which section the relocation is targeted at and the\n initial relocation command value. */",
"/* Get symbol value. (Common symbols are special.) */",
"/* Convert input-section-relative symbol value to absolute. */",
"/* If symbol addresses are in octets, convert to bytes. */",
"/* Add in supplied addend. */",
"/* Here the variable relocation holds the final address of the\n symbol we are relocating against, plus any addend. */",
"/* This is a PC relative relocation. We want to set RELOCATION\n\t to the distance between the address of the symbol and the\n\t location. RELOCATION is already the address of the symbol.\n\n\t We start by subtracting the address of the section containing\n\t the location.\n\n\t If pcrel_offset is set, we must further subtract the position\n\t of the location within the section. Some targets arrange for\n\t the addend to be the negative of the position of the location\n\t within the section; for example, i386-aout does this. For\n\t i386-aout, pcrel_offset is FALSE. Some other targets do not\n\t include the position of the location; for example, ELF.\n\t For those targets, pcrel_offset is TRUE.\n\n\t If we are producing relocatable output, then we must ensure\n\t that this reloc will be correctly computed when the final\n\t relocation is done. If pcrel_offset is FALSE we want to wind\n\t up with the negative of the location within the section,\n\t which means we must adjust the existing addend by the change\n\t in the location within the section. If pcrel_offset is TRUE\n\t we do not want to adjust the existing addend at all.\n\n\t FIXME: This seems logical to me, but for the case of\n\t producing relocatable output it is not what the code\n\t actually does. I don't want to change it, because it seems\n\t far too likely that something will break. */",
"/* This is a partial relocation, and we want to apply the relocation\n\t to the reloc entry rather than the raw data. Modify the reloc\n\t inplace to reflect what we now know. */",
"/* This is a partial relocation, but inplace, so modify the\n\t reloc record a bit.\n\n\t If we've relocated with a symbol with a section, change\n\t into a ref to the section belonging to the symbol. */",
"/* WTF?? */",
"/* For m68k-coff, the addend was being subtracted twice during\n\t relocation with -r. Removing the line below this comment\n\t fixes that problem; see PR 2953.\n\nHowever, Ian wrote the following, regarding removing the line below,\nwhich explains why it is still enabled: --djm\n\nIf you put a patch like that into BFD you need to check all the COFF\nlinkers. I am fairly certain that patch will break coff-i386 (e.g.,\nSCO); see coff_i386_reloc in coff-i386.c where I worked around the\nproblem in a different way. There may very well be a reason that the\ncode works as it does.\n\nHmmm. The first obvious point is that bfd_install_relocation should\nnot have any tests that depend upon the flavour. It's seem like\nentirely the wrong place for such a thing. The second obvious point\nis that the current code ignores the reloc addend when producing\nrelocatable output for COFF. That's peculiar. In fact, I really\nhave no idea what the point of the line you want to remove is.\n\nA typical COFF reloc subtracts the old value of the symbol and adds in\nthe new value to the location in the object file (if it's a pc\nrelative reloc it adds the difference between the symbol value and the\nlocation). When relocating we need to preserve that property.\n\nBFD handles this by setting the addend to the negative of the old\nvalue of the symbol. Unfortunately it handles common symbols in a\nnon-standard way (it doesn't subtract the old value) but that's a\ndifferent story (we can't change it without losing backward\ncompatibility with old object files) (coff-i386 does subtract the old\nvalue, to be compatible with existing coff-i386 targets, like SCO).\n\nSo everything works fine when not producing relocatable output. When\nwe are producing relocatable output, logically we should do exactly\nwhat we do when not producing relocatable output. Therefore, your\npatch is correct. In fact, it should probably always just set\nreloc_entry->addend to 0 for all cases, since it is, in fact, going to\nadd the value into the object file. This won't hurt the COFF code,\nwhich doesn't use the addend; I'm not sure what it will do to other\nformats (the thing to check for would be whether any formats both use\nthe addend and set partial_inplace).\n\nWhen I wanted to make coff-i386 produce relocatable output, I ran\ninto the problem that you are running into: I wanted to remove that\nline. Rather than risk it, I made the coff-i386 relocs use a special\nfunction; it's coff_i386_reloc in coff-i386.c. The function\nspecifically adds the addend field into the object file, knowing that\nbfd_install_relocation is not going to. If you remove that line, then\ncoff-i386.c will wind up adding the addend field in twice. It's\ntrivial to fix; it just needs to be done.\n\nThe problem with removing the line is just that it may break some\nworking code. With BFD it's hard to be sure of anything. The right\nway to deal with this is simply to build and test at least all the\nsupported COFF targets. It should be straightforward if time and disk\nspace consuming. For each target:\n 1) build the linker\n 2) generate some executable, and link it using -r (I would\n probably use paranoia.o and link against newlib/libc.a, which\n for all the supported targets would be available in\n /usr/cygnus/progressive/H-host/target/lib/libc.a).\n 3) make the change to reloc.c\n 4) rebuild the linker\n 5) repeat step 2\n 6) if the resulting object files are the same, you have at least\n made it no worse\n 7) if they are different you have to figure out which version is\n right. */",
"/* FIXME: There should be no target specific code here... */",
"/* FIXME: This overflow checking is incomplete, because the value\n might have overflowed before we get here. For a correct check we\n need to compute the value in a size larger than bitsize, but we\n can't reasonably do that for a reloc the same size as a host\n machine word.\n FIXME: We should also do overflow checking on the result after\n adding in the value contained in the object file. */",
"/* Either we are relocating all the way, or we don't want to apply\n the relocation to the reloc entry (probably because there isn't\n any room in the output format to describe addends to relocs). */",
"/* The cast to bfd_vma avoids a bug in the Alpha OSF/1 C compiler\n (OSF version 1.3, compiler version 3.11). It miscompiles the\n following program:\n\n struct str\n {\n unsigned int i0;\n } s = { 0 };\n\n int\n main ()\n {\n unsigned long x;\n\n x = 0x100000000;\n x <<= (unsigned long) s.i0;\n if (x == 0)\n\t printf (\"failed\\n\");\n else\n\t printf (\"succeeded (%lx)\\n\", x);\n }\n */",
"/* Shift everything up to where it's going to be used. */",
"/* Wait for the day when all have the mask in them. */",
"/* What we do:\n i instruction to be left alone\n o offset within instruction\n r relocation offset to apply\n S src mask\n D dst mask\n N ~dst mask\n A part 1\n B part 2\n R result\n\n Do this:\n ((\t i i i i i o o o o o from bfd_get<size>\n and\t S S S S S) to get the size offset we want\n +\t r r r r r r r r r r) to get the final value to place\n and\t D D D D D to chop to right size\n -----------------------\n =\t\t A A A A A\n And this:\n (\t i i i i i o o o o o from bfd_get<size>\n and N N N N N\t ) get instruction\n -----------------------\n =\t B B B B B\n\n And then:\n (\t B B B B B\n or\t\t A A A A A)\n -----------------------\n =\t R R R R R R R R R R put into bfd_put<size>\n */"
] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "reloc_entry",
"type": "arelent"
},
{
"param": "data_start",
"type": "void"
},
{
"param": "data_start_offset",
"type": "bfd_vma"
},
{
"param": "input_section",
"type": "asection"
},
{
"param": "error_message",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "reloc_entry",
"type": "arelent",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data_start",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data_start_offset",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_section",
"type": "asection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "error_message",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | _bfd_final_link_relocate | bfd_reloc_status_type | bfd_reloc_status_type
_bfd_final_link_relocate (reloc_howto_type *howto,
bfd *input_bfd,
asection *input_section,
bfd_byte *contents,
bfd_vma address,
bfd_vma value,
bfd_vma addend)
{
bfd_vma relocation;
bfd_size_type octets = (address
* bfd_octets_per_byte (input_bfd, input_section));
/* Sanity check the address. */
if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, octets))
return bfd_reloc_outofrange;
/* This function assumes that we are dealing with a basic relocation
against a symbol. We want to compute the value of the symbol to
relocate to. This is just VALUE, the value of the symbol, plus
ADDEND, any addend associated with the reloc. */
relocation = value + addend;
/* If the relocation is PC relative, we want to set RELOCATION to
the distance between the symbol (currently in RELOCATION) and the
location we are relocating. Some targets (e.g., i386-aout)
arrange for the contents of the section to be the negative of the
offset of the location within the section; for such targets
pcrel_offset is FALSE. Other targets (e.g., ELF) simply leave
the contents of the section as zero; for such targets
pcrel_offset is TRUE. If pcrel_offset is FALSE we do not need to
subtract out the offset of the location within the section (which
is just ADDRESS). */
if (howto->pc_relative)
{
relocation -= (input_section->output_section->vma
+ input_section->output_offset);
if (howto->pcrel_offset)
relocation -= address;
}
return _bfd_relocate_contents (howto, input_bfd, relocation,
contents + octets);
} | /* This relocation routine is used by some of the backend linkers.
They do not construct asymbol or arelent structures, so there is no
reason for them to use bfd_perform_relocation. Also,
bfd_perform_relocation is so hacked up it is easier to write a new
function than to try to deal with it.
This routine does a final relocation. Whether it is useful for a
relocatable link depends upon how the object format defines
relocations.
FIXME: This routine ignores any special_function in the HOWTO,
since the existing special_function values have been written for
bfd_perform_relocation.
HOWTO is the reloc howto information.
INPUT_BFD is the BFD which the reloc applies to.
INPUT_SECTION is the section which the reloc applies to.
CONTENTS is the contents of the section.
ADDRESS is the address of the reloc within INPUT_SECTION.
VALUE is the value of the symbol the reloc refers to.
ADDEND is the addend of the reloc. */ | This relocation routine is used by some of the backend linkers.
They do not construct asymbol or arelent structures, so there is no
reason for them to use bfd_perform_relocation. Also,
bfd_perform_relocation is so hacked up it is easier to write a new
function than to try to deal with it.
This routine does a final relocation. Whether it is useful for a
relocatable link depends upon how the object format defines
relocations.
This routine ignores any special_function in the HOWTO,
since the existing special_function values have been written for
bfd_perform_relocation.
HOWTO is the reloc howto information.
INPUT_BFD is the BFD which the reloc applies to.
INPUT_SECTION is the section which the reloc applies to.
CONTENTS is the contents of the section.
ADDRESS is the address of the reloc within INPUT_SECTION.
VALUE is the value of the symbol the reloc refers to.
ADDEND is the addend of the reloc. | [
"This",
"relocation",
"routine",
"is",
"used",
"by",
"some",
"of",
"the",
"backend",
"linkers",
".",
"They",
"do",
"not",
"construct",
"asymbol",
"or",
"arelent",
"structures",
"so",
"there",
"is",
"no",
"reason",
"for",
"them",
"to",
"use",
"bfd_perform_relocation",
".",
"Also",
"bfd_perform_relocation",
"is",
"so",
"hacked",
"up",
"it",
"is",
"easier",
"to",
"write",
"a",
"new",
"function",
"than",
"to",
"try",
"to",
"deal",
"with",
"it",
".",
"This",
"routine",
"does",
"a",
"final",
"relocation",
".",
"Whether",
"it",
"is",
"useful",
"for",
"a",
"relocatable",
"link",
"depends",
"upon",
"how",
"the",
"object",
"format",
"defines",
"relocations",
".",
"This",
"routine",
"ignores",
"any",
"special_function",
"in",
"the",
"HOWTO",
"since",
"the",
"existing",
"special_function",
"values",
"have",
"been",
"written",
"for",
"bfd_perform_relocation",
".",
"HOWTO",
"is",
"the",
"reloc",
"howto",
"information",
".",
"INPUT_BFD",
"is",
"the",
"BFD",
"which",
"the",
"reloc",
"applies",
"to",
".",
"INPUT_SECTION",
"is",
"the",
"section",
"which",
"the",
"reloc",
"applies",
"to",
".",
"CONTENTS",
"is",
"the",
"contents",
"of",
"the",
"section",
".",
"ADDRESS",
"is",
"the",
"address",
"of",
"the",
"reloc",
"within",
"INPUT_SECTION",
".",
"VALUE",
"is",
"the",
"value",
"of",
"the",
"symbol",
"the",
"reloc",
"refers",
"to",
".",
"ADDEND",
"is",
"the",
"addend",
"of",
"the",
"reloc",
"."
] | bfd_reloc_status_type
_bfd_final_link_relocate (reloc_howto_type *howto,
bfd *input_bfd,
asection *input_section,
bfd_byte *contents,
bfd_vma address,
bfd_vma value,
bfd_vma addend)
{
bfd_vma relocation;
bfd_size_type octets = (address
* bfd_octets_per_byte (input_bfd, input_section));
if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, octets))
return bfd_reloc_outofrange;
relocation = value + addend;
if (howto->pc_relative)
{
relocation -= (input_section->output_section->vma
+ input_section->output_offset);
if (howto->pcrel_offset)
relocation -= address;
}
return _bfd_relocate_contents (howto, input_bfd, relocation,
contents + octets);
} | [
"bfd_reloc_status_type",
"_bfd_final_link_relocate",
"(",
"reloc_howto_type",
"*",
"howto",
",",
"bfd",
"*",
"input_bfd",
",",
"asection",
"*",
"input_section",
",",
"bfd_byte",
"*",
"contents",
",",
"bfd_vma",
"address",
",",
"bfd_vma",
"value",
",",
"bfd_vma",
"addend",
")",
"{",
"bfd_vma",
"relocation",
";",
"bfd_size_type",
"octets",
"=",
"(",
"address",
"*",
"bfd_octets_per_byte",
"(",
"input_bfd",
",",
"input_section",
")",
")",
";",
"if",
"(",
"!",
"bfd_reloc_offset_in_range",
"(",
"howto",
",",
"input_bfd",
",",
"input_section",
",",
"octets",
")",
")",
"return",
"bfd_reloc_outofrange",
";",
"relocation",
"=",
"value",
"+",
"addend",
";",
"if",
"(",
"howto",
"->",
"pc_relative",
")",
"{",
"relocation",
"-=",
"(",
"input_section",
"->",
"output_section",
"->",
"vma",
"+",
"input_section",
"->",
"output_offset",
")",
";",
"if",
"(",
"howto",
"->",
"pcrel_offset",
")",
"relocation",
"-=",
"address",
";",
"}",
"return",
"_bfd_relocate_contents",
"(",
"howto",
",",
"input_bfd",
",",
"relocation",
",",
"contents",
"+",
"octets",
")",
";",
"}"
] | This relocation routine is used by some of the backend linkers. | [
"This",
"relocation",
"routine",
"is",
"used",
"by",
"some",
"of",
"the",
"backend",
"linkers",
"."
] | [
"/* Sanity check the address. */",
"/* This function assumes that we are dealing with a basic relocation\n against a symbol. We want to compute the value of the symbol to\n relocate to. This is just VALUE, the value of the symbol, plus\n ADDEND, any addend associated with the reloc. */",
"/* If the relocation is PC relative, we want to set RELOCATION to\n the distance between the symbol (currently in RELOCATION) and the\n location we are relocating. Some targets (e.g., i386-aout)\n arrange for the contents of the section to be the negative of the\n offset of the location within the section; for such targets\n pcrel_offset is FALSE. Other targets (e.g., ELF) simply leave\n the contents of the section as zero; for such targets\n pcrel_offset is TRUE. If pcrel_offset is FALSE we do not need to\n subtract out the offset of the location within the section (which\n is just ADDRESS). */"
] | [
{
"param": "howto",
"type": "reloc_howto_type"
},
{
"param": "input_bfd",
"type": "bfd"
},
{
"param": "input_section",
"type": "asection"
},
{
"param": "contents",
"type": "bfd_byte"
},
{
"param": "address",
"type": "bfd_vma"
},
{
"param": "value",
"type": "bfd_vma"
},
{
"param": "addend",
"type": "bfd_vma"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_bfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_section",
"type": "asection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "contents",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "address",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "value",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "addend",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | _bfd_relocate_contents | bfd_reloc_status_type | bfd_reloc_status_type
_bfd_relocate_contents (reloc_howto_type *howto,
bfd *input_bfd,
bfd_vma relocation,
bfd_byte *location)
{
bfd_vma x;
bfd_reloc_status_type flag;
unsigned int rightshift = howto->rightshift;
unsigned int bitpos = howto->bitpos;
if (howto->negate)
relocation = -relocation;
/* Get the value we are going to relocate. */
x = read_reloc (input_bfd, location, howto);
/* Check for overflow. FIXME: We may drop bits during the addition
which we don't check for. We must either check at every single
operation, which would be tedious, or we must do the computations
in a type larger than bfd_vma, which would be inefficient. */
flag = bfd_reloc_ok;
if (howto->complain_on_overflow != complain_overflow_dont)
{
bfd_vma addrmask, fieldmask, signmask, ss;
bfd_vma a, b, sum;
/* Get the values to be added together. For signed and unsigned
relocations, we assume that all values should be truncated to
the size of an address. For bitfields, all the bits matter.
See also bfd_check_overflow. */
fieldmask = N_ONES (howto->bitsize);
signmask = ~fieldmask;
addrmask = (N_ONES (bfd_arch_bits_per_address (input_bfd))
| (fieldmask << rightshift));
a = (relocation & addrmask) >> rightshift;
b = (x & howto->src_mask & addrmask) >> bitpos;
addrmask >>= rightshift;
switch (howto->complain_on_overflow)
{
case complain_overflow_signed:
/* If any sign bits are set, all sign bits must be set.
That is, A must be a valid negative address after
shifting. */
signmask = ~(fieldmask >> 1);
/* Fall thru */
case complain_overflow_bitfield:
/* Much like the signed check, but for a field one bit
wider. We allow a bitfield to represent numbers in the
range -2**n to 2**n-1, where n is the number of bits in the
field. Note that when bfd_vma is 32 bits, a 32-bit reloc
can't overflow, which is exactly what we want. */
ss = a & signmask;
if (ss != 0 && ss != (addrmask & signmask))
flag = bfd_reloc_overflow;
/* We only need this next bit of code if the sign bit of B
is below the sign bit of A. This would only happen if
SRC_MASK had fewer bits than BITSIZE. Note that if
SRC_MASK has more bits than BITSIZE, we can get into
trouble; we would need to verify that B is in range, as
we do for A above. */
ss = ((~howto->src_mask) >> 1) & howto->src_mask;
ss >>= bitpos;
/* Set all the bits above the sign bit. */
b = (b ^ ss) - ss;
/* Now we can do the addition. */
sum = a + b;
/* See if the result has the correct sign. Bits above the
sign bit are junk now; ignore them. If the sum is
positive, make sure we did not have all negative inputs;
if the sum is negative, make sure we did not have all
positive inputs. The test below looks only at the sign
bits, and it really just
SIGN (A) == SIGN (B) && SIGN (A) != SIGN (SUM)
We mask with addrmask here to explicitly allow an address
wrap-around. The Linux kernel relies on it, and it is
the only way to write assembler code which can run when
loaded at a location 0x80000000 away from the location at
which it is linked. */
if (((~(a ^ b)) & (a ^ sum)) & signmask & addrmask)
flag = bfd_reloc_overflow;
break;
case complain_overflow_unsigned:
/* Checking for an unsigned overflow is relatively easy:
trim the addresses and add, and trim the result as well.
Overflow is normally indicated when the result does not
fit in the field. However, we also need to consider the
case when, e.g., fieldmask is 0x7fffffff or smaller, an
input is 0x80000000, and bfd_vma is only 32 bits; then we
will get sum == 0, but there is an overflow, since the
inputs did not fit in the field. Instead of doing a
separate test, we can check for this by or-ing in the
operands when testing for the sum overflowing its final
field. */
sum = (a + b) & addrmask;
if ((a | b | sum) & signmask)
flag = bfd_reloc_overflow;
break;
default:
abort ();
}
}
/* Put RELOCATION in the right bits. */
relocation >>= (bfd_vma) rightshift;
relocation <<= (bfd_vma) bitpos;
/* Add RELOCATION to the right bits of X. */
x = ((x & ~howto->dst_mask)
| (((x & howto->src_mask) + relocation) & howto->dst_mask));
/* Put the relocated value back in the object file. */
write_reloc (input_bfd, x, location, howto);
return flag;
} | /* Relocate a given location using a given value and howto. */ | Relocate a given location using a given value and howto. | [
"Relocate",
"a",
"given",
"location",
"using",
"a",
"given",
"value",
"and",
"howto",
"."
] | bfd_reloc_status_type
_bfd_relocate_contents (reloc_howto_type *howto,
bfd *input_bfd,
bfd_vma relocation,
bfd_byte *location)
{
bfd_vma x;
bfd_reloc_status_type flag;
unsigned int rightshift = howto->rightshift;
unsigned int bitpos = howto->bitpos;
if (howto->negate)
relocation = -relocation;
x = read_reloc (input_bfd, location, howto);
flag = bfd_reloc_ok;
if (howto->complain_on_overflow != complain_overflow_dont)
{
bfd_vma addrmask, fieldmask, signmask, ss;
bfd_vma a, b, sum;
fieldmask = N_ONES (howto->bitsize);
signmask = ~fieldmask;
addrmask = (N_ONES (bfd_arch_bits_per_address (input_bfd))
| (fieldmask << rightshift));
a = (relocation & addrmask) >> rightshift;
b = (x & howto->src_mask & addrmask) >> bitpos;
addrmask >>= rightshift;
switch (howto->complain_on_overflow)
{
case complain_overflow_signed:
signmask = ~(fieldmask >> 1);
case complain_overflow_bitfield:
ss = a & signmask;
if (ss != 0 && ss != (addrmask & signmask))
flag = bfd_reloc_overflow;
ss = ((~howto->src_mask) >> 1) & howto->src_mask;
ss >>= bitpos;
b = (b ^ ss) - ss;
sum = a + b;
if (((~(a ^ b)) & (a ^ sum)) & signmask & addrmask)
flag = bfd_reloc_overflow;
break;
case complain_overflow_unsigned:
sum = (a + b) & addrmask;
if ((a | b | sum) & signmask)
flag = bfd_reloc_overflow;
break;
default:
abort ();
}
}
relocation >>= (bfd_vma) rightshift;
relocation <<= (bfd_vma) bitpos;
x = ((x & ~howto->dst_mask)
| (((x & howto->src_mask) + relocation) & howto->dst_mask));
write_reloc (input_bfd, x, location, howto);
return flag;
} | [
"bfd_reloc_status_type",
"_bfd_relocate_contents",
"(",
"reloc_howto_type",
"*",
"howto",
",",
"bfd",
"*",
"input_bfd",
",",
"bfd_vma",
"relocation",
",",
"bfd_byte",
"*",
"location",
")",
"{",
"bfd_vma",
"x",
";",
"bfd_reloc_status_type",
"flag",
";",
"unsigned",
"int",
"rightshift",
"=",
"howto",
"->",
"rightshift",
";",
"unsigned",
"int",
"bitpos",
"=",
"howto",
"->",
"bitpos",
";",
"if",
"(",
"howto",
"->",
"negate",
")",
"relocation",
"=",
"-",
"relocation",
";",
"x",
"=",
"read_reloc",
"(",
"input_bfd",
",",
"location",
",",
"howto",
")",
";",
"flag",
"=",
"bfd_reloc_ok",
";",
"if",
"(",
"howto",
"->",
"complain_on_overflow",
"!=",
"complain_overflow_dont",
")",
"{",
"bfd_vma",
"addrmask",
",",
"fieldmask",
",",
"signmask",
",",
"ss",
";",
"bfd_vma",
"a",
",",
"b",
",",
"sum",
";",
"fieldmask",
"=",
"N_ONES",
"(",
"howto",
"->",
"bitsize",
")",
";",
"signmask",
"=",
"~",
"fieldmask",
";",
"addrmask",
"=",
"(",
"N_ONES",
"(",
"bfd_arch_bits_per_address",
"(",
"input_bfd",
")",
")",
"|",
"(",
"fieldmask",
"<<",
"rightshift",
")",
")",
";",
"a",
"=",
"(",
"relocation",
"&",
"addrmask",
")",
">>",
"rightshift",
";",
"b",
"=",
"(",
"x",
"&",
"howto",
"->",
"src_mask",
"&",
"addrmask",
")",
">>",
"bitpos",
";",
"addrmask",
">>=",
"rightshift",
";",
"switch",
"(",
"howto",
"->",
"complain_on_overflow",
")",
"{",
"case",
"complain_overflow_signed",
":",
"signmask",
"=",
"~",
"(",
"fieldmask",
">>",
"1",
")",
";",
"case",
"complain_overflow_bitfield",
":",
"ss",
"=",
"a",
"&",
"signmask",
";",
"if",
"(",
"ss",
"!=",
"0",
"&&",
"ss",
"!=",
"(",
"addrmask",
"&",
"signmask",
")",
")",
"flag",
"=",
"bfd_reloc_overflow",
";",
"ss",
"=",
"(",
"(",
"~",
"howto",
"->",
"src_mask",
")",
">>",
"1",
")",
"&",
"howto",
"->",
"src_mask",
";",
"ss",
">>=",
"bitpos",
";",
"b",
"=",
"(",
"b",
"^",
"ss",
")",
"-",
"ss",
";",
"sum",
"=",
"a",
"+",
"b",
";",
"if",
"(",
"(",
"(",
"~",
"(",
"a",
"^",
"b",
")",
")",
"&",
"(",
"a",
"^",
"sum",
")",
")",
"&",
"signmask",
"&",
"addrmask",
")",
"flag",
"=",
"bfd_reloc_overflow",
";",
"break",
";",
"case",
"complain_overflow_unsigned",
":",
"sum",
"=",
"(",
"a",
"+",
"b",
")",
"&",
"addrmask",
";",
"if",
"(",
"(",
"a",
"|",
"b",
"|",
"sum",
")",
"&",
"signmask",
")",
"flag",
"=",
"bfd_reloc_overflow",
";",
"break",
";",
"default",
":",
"abort",
"(",
")",
";",
"}",
"}",
"relocation",
">>=",
"(",
"bfd_vma",
")",
"rightshift",
";",
"relocation",
"<<=",
"(",
"bfd_vma",
")",
"bitpos",
";",
"x",
"=",
"(",
"(",
"x",
"&",
"~",
"howto",
"->",
"dst_mask",
")",
"|",
"(",
"(",
"(",
"x",
"&",
"howto",
"->",
"src_mask",
")",
"+",
"relocation",
")",
"&",
"howto",
"->",
"dst_mask",
")",
")",
";",
"write_reloc",
"(",
"input_bfd",
",",
"x",
",",
"location",
",",
"howto",
")",
";",
"return",
"flag",
";",
"}"
] | Relocate a given location using a given value and howto. | [
"Relocate",
"a",
"given",
"location",
"using",
"a",
"given",
"value",
"and",
"howto",
"."
] | [
"/* Get the value we are going to relocate. */",
"/* Check for overflow. FIXME: We may drop bits during the addition\n which we don't check for. We must either check at every single\n operation, which would be tedious, or we must do the computations\n in a type larger than bfd_vma, which would be inefficient. */",
"/* Get the values to be added together. For signed and unsigned\n\t relocations, we assume that all values should be truncated to\n\t the size of an address. For bitfields, all the bits matter.\n\t See also bfd_check_overflow. */",
"/* If any sign bits are set, all sign bits must be set.\n\t That is, A must be a valid negative address after\n\t shifting. */",
"/* Fall thru */",
"/* Much like the signed check, but for a field one bit\n\t wider. We allow a bitfield to represent numbers in the\n\t range -2**n to 2**n-1, where n is the number of bits in the\n\t field. Note that when bfd_vma is 32 bits, a 32-bit reloc\n\t can't overflow, which is exactly what we want. */",
"/* We only need this next bit of code if the sign bit of B\n\t is below the sign bit of A. This would only happen if\n\t SRC_MASK had fewer bits than BITSIZE. Note that if\n\t SRC_MASK has more bits than BITSIZE, we can get into\n\t trouble; we would need to verify that B is in range, as\n\t we do for A above. */",
"/* Set all the bits above the sign bit. */",
"/* Now we can do the addition. */",
"/* See if the result has the correct sign. Bits above the\n\t sign bit are junk now; ignore them. If the sum is\n\t positive, make sure we did not have all negative inputs;\n\t if the sum is negative, make sure we did not have all\n\t positive inputs. The test below looks only at the sign\n\t bits, and it really just\n\t\t SIGN (A) == SIGN (B) && SIGN (A) != SIGN (SUM)\n\n\t We mask with addrmask here to explicitly allow an address\n\t wrap-around. The Linux kernel relies on it, and it is\n\t the only way to write assembler code which can run when\n\t loaded at a location 0x80000000 away from the location at\n\t which it is linked. */",
"/* Checking for an unsigned overflow is relatively easy:\n\t trim the addresses and add, and trim the result as well.\n\t Overflow is normally indicated when the result does not\n\t fit in the field. However, we also need to consider the\n\t case when, e.g., fieldmask is 0x7fffffff or smaller, an\n\t input is 0x80000000, and bfd_vma is only 32 bits; then we\n\t will get sum == 0, but there is an overflow, since the\n\t inputs did not fit in the field. Instead of doing a\n\t separate test, we can check for this by or-ing in the\n\t operands when testing for the sum overflowing its final\n\t field. */",
"/* Put RELOCATION in the right bits. */",
"/* Add RELOCATION to the right bits of X. */",
"/* Put the relocated value back in the object file. */"
] | [
{
"param": "howto",
"type": "reloc_howto_type"
},
{
"param": "input_bfd",
"type": "bfd"
},
{
"param": "relocation",
"type": "bfd_vma"
},
{
"param": "location",
"type": "bfd_byte"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_bfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "relocation",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "location",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | _bfd_clear_contents | bfd_reloc_status_type | bfd_reloc_status_type
_bfd_clear_contents (reloc_howto_type *howto,
bfd *input_bfd,
asection *input_section,
bfd_byte *buf,
bfd_vma off)
{
bfd_vma x;
bfd_byte *location;
if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, off))
return bfd_reloc_outofrange;
/* Get the value we are going to relocate. */
location = buf + off;
x = read_reloc (input_bfd, location, howto);
/* Zero out the unwanted bits of X. */
x &= ~howto->dst_mask;
/* For a range list, use 1 instead of 0 as placeholder. 0
would terminate the list, hiding any later entries. */
if (strcmp (bfd_section_name (input_section), ".debug_ranges") == 0
&& (howto->dst_mask & 1) != 0)
x |= 1;
/* Put the relocated value back in the object file. */
write_reloc (input_bfd, x, location, howto);
return bfd_reloc_ok;
} | /* Clear a given location using a given howto, by applying a fixed relocation
value and discarding any in-place addend. This is used for fixed-up
relocations against discarded symbols, to make ignorable debug or unwind
information more obvious. */ | Clear a given location using a given howto, by applying a fixed relocation
value and discarding any in-place addend. This is used for fixed-up
relocations against discarded symbols, to make ignorable debug or unwind
information more obvious. | [
"Clear",
"a",
"given",
"location",
"using",
"a",
"given",
"howto",
"by",
"applying",
"a",
"fixed",
"relocation",
"value",
"and",
"discarding",
"any",
"in",
"-",
"place",
"addend",
".",
"This",
"is",
"used",
"for",
"fixed",
"-",
"up",
"relocations",
"against",
"discarded",
"symbols",
"to",
"make",
"ignorable",
"debug",
"or",
"unwind",
"information",
"more",
"obvious",
"."
] | bfd_reloc_status_type
_bfd_clear_contents (reloc_howto_type *howto,
bfd *input_bfd,
asection *input_section,
bfd_byte *buf,
bfd_vma off)
{
bfd_vma x;
bfd_byte *location;
if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, off))
return bfd_reloc_outofrange;
location = buf + off;
x = read_reloc (input_bfd, location, howto);
x &= ~howto->dst_mask;
if (strcmp (bfd_section_name (input_section), ".debug_ranges") == 0
&& (howto->dst_mask & 1) != 0)
x |= 1;
write_reloc (input_bfd, x, location, howto);
return bfd_reloc_ok;
} | [
"bfd_reloc_status_type",
"_bfd_clear_contents",
"(",
"reloc_howto_type",
"*",
"howto",
",",
"bfd",
"*",
"input_bfd",
",",
"asection",
"*",
"input_section",
",",
"bfd_byte",
"*",
"buf",
",",
"bfd_vma",
"off",
")",
"{",
"bfd_vma",
"x",
";",
"bfd_byte",
"*",
"location",
";",
"if",
"(",
"!",
"bfd_reloc_offset_in_range",
"(",
"howto",
",",
"input_bfd",
",",
"input_section",
",",
"off",
")",
")",
"return",
"bfd_reloc_outofrange",
";",
"location",
"=",
"buf",
"+",
"off",
";",
"x",
"=",
"read_reloc",
"(",
"input_bfd",
",",
"location",
",",
"howto",
")",
";",
"x",
"&=",
"~",
"howto",
"->",
"dst_mask",
";",
"if",
"(",
"strcmp",
"(",
"bfd_section_name",
"(",
"input_section",
")",
",",
"\"",
"\"",
")",
"==",
"0",
"&&",
"(",
"howto",
"->",
"dst_mask",
"&",
"1",
")",
"!=",
"0",
")",
"x",
"|=",
"1",
";",
"write_reloc",
"(",
"input_bfd",
",",
"x",
",",
"location",
",",
"howto",
")",
";",
"return",
"bfd_reloc_ok",
";",
"}"
] | Clear a given location using a given howto, by applying a fixed relocation
value and discarding any in-place addend. | [
"Clear",
"a",
"given",
"location",
"using",
"a",
"given",
"howto",
"by",
"applying",
"a",
"fixed",
"relocation",
"value",
"and",
"discarding",
"any",
"in",
"-",
"place",
"addend",
"."
] | [
"/* Get the value we are going to relocate. */",
"/* Zero out the unwanted bits of X. */",
"/* For a range list, use 1 instead of 0 as placeholder. 0\n would terminate the list, hiding any later entries. */",
"/* Put the relocated value back in the object file. */"
] | [
{
"param": "howto",
"type": "reloc_howto_type"
},
{
"param": "input_bfd",
"type": "bfd"
},
{
"param": "input_section",
"type": "asection"
},
{
"param": "buf",
"type": "bfd_byte"
},
{
"param": "off",
"type": "bfd_vma"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "howto",
"type": "reloc_howto_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_bfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "input_section",
"type": "asection",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "buf",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "off",
"type": "bfd_vma",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_reloc_type_lookup | reloc_howto_type | reloc_howto_type *
bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
} | /*
FUNCTION
bfd_reloc_type_lookup
bfd_reloc_name_lookup
SYNOPSIS
reloc_howto_type *bfd_reloc_type_lookup
(bfd *abfd, bfd_reloc_code_real_type code);
reloc_howto_type *bfd_reloc_name_lookup
(bfd *abfd, const char *reloc_name);
DESCRIPTION
Return a pointer to a howto structure which, when
invoked, will perform the relocation @var{code} on data from the
architecture noted.
*/ |
DESCRIPTION
Return a pointer to a howto structure which, when
invoked, will perform the relocation @var{code} on data from the
architecture noted. | [
"DESCRIPTION",
"Return",
"a",
"pointer",
"to",
"a",
"howto",
"structure",
"which",
"when",
"invoked",
"will",
"perform",
"the",
"relocation",
"@var",
"{",
"code",
"}",
"on",
"data",
"from",
"the",
"architecture",
"noted",
"."
] | reloc_howto_type *
bfd_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
return BFD_SEND (abfd, reloc_type_lookup, (abfd, code));
} | [
"reloc_howto_type",
"*",
"bfd_reloc_type_lookup",
"(",
"bfd",
"*",
"abfd",
",",
"bfd_reloc_code_real_type",
"code",
")",
"{",
"return",
"BFD_SEND",
"(",
"abfd",
",",
"reloc_type_lookup",
",",
"(",
"abfd",
",",
"code",
")",
")",
";",
"}"
] | FUNCTION
bfd_reloc_type_lookup
bfd_reloc_name_lookup | [
"FUNCTION",
"bfd_reloc_type_lookup",
"bfd_reloc_name_lookup"
] | [] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "code",
"type": "bfd_reloc_code_real_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "bfd_reloc_code_real_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_default_reloc_type_lookup | reloc_howto_type | reloc_howto_type *
bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
/* Very limited support is provided for relocs in generic targets
such as elf32-little. FIXME: Should we always return NULL? */
if (code == BFD_RELOC_CTOR
&& bfd_arch_bits_per_address (abfd) == 32)
return &bfd_howto_32;
return NULL;
} | /*
INTERNAL_FUNCTION
bfd_default_reloc_type_lookup
SYNOPSIS
reloc_howto_type *bfd_default_reloc_type_lookup
(bfd *abfd, bfd_reloc_code_real_type code);
DESCRIPTION
Provides a default relocation lookup routine for any architecture.
*/ |
DESCRIPTION
Provides a default relocation lookup routine for any architecture. | [
"DESCRIPTION",
"Provides",
"a",
"default",
"relocation",
"lookup",
"routine",
"for",
"any",
"architecture",
"."
] | reloc_howto_type *
bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code)
{
if (code == BFD_RELOC_CTOR
&& bfd_arch_bits_per_address (abfd) == 32)
return &bfd_howto_32;
return NULL;
} | [
"reloc_howto_type",
"*",
"bfd_default_reloc_type_lookup",
"(",
"bfd",
"*",
"abfd",
",",
"bfd_reloc_code_real_type",
"code",
")",
"{",
"if",
"(",
"code",
"==",
"BFD_RELOC_CTOR",
"&&",
"bfd_arch_bits_per_address",
"(",
"abfd",
")",
"==",
"32",
")",
"return",
"&",
"bfd_howto_32",
";",
"return",
"NULL",
";",
"}"
] | INTERNAL_FUNCTION
bfd_default_reloc_type_lookup | [
"INTERNAL_FUNCTION",
"bfd_default_reloc_type_lookup"
] | [
"/* Very limited support is provided for relocs in generic targets\n such as elf32-little. FIXME: Should we always return NULL? */"
] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "code",
"type": "bfd_reloc_code_real_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "code",
"type": "bfd_reloc_code_real_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_get_reloc_code_name | char | const char *
bfd_get_reloc_code_name (bfd_reloc_code_real_type code)
{
if (code > BFD_RELOC_UNUSED)
return 0;
return bfd_reloc_code_real_names[code];
} | /*
FUNCTION
bfd_get_reloc_code_name
SYNOPSIS
const char *bfd_get_reloc_code_name (bfd_reloc_code_real_type code);
DESCRIPTION
Provides a printable name for the supplied relocation code.
Useful mainly for printing error messages.
*/ |
DESCRIPTION
Provides a printable name for the supplied relocation code.
Useful mainly for printing error messages. | [
"DESCRIPTION",
"Provides",
"a",
"printable",
"name",
"for",
"the",
"supplied",
"relocation",
"code",
".",
"Useful",
"mainly",
"for",
"printing",
"error",
"messages",
"."
] | const char *
bfd_get_reloc_code_name (bfd_reloc_code_real_type code)
{
if (code > BFD_RELOC_UNUSED)
return 0;
return bfd_reloc_code_real_names[code];
} | [
"const",
"char",
"*",
"bfd_get_reloc_code_name",
"(",
"bfd_reloc_code_real_type",
"code",
")",
"{",
"if",
"(",
"code",
">",
"BFD_RELOC_UNUSED",
")",
"return",
"0",
";",
"return",
"bfd_reloc_code_real_names",
"[",
"code",
"]",
";",
"}"
] | FUNCTION
bfd_get_reloc_code_name | [
"FUNCTION",
"bfd_get_reloc_code_name"
] | [] | [
{
"param": "code",
"type": "bfd_reloc_code_real_type"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "bfd_reloc_code_real_type",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | bfd_generic_get_relocated_section_contents | bfd_byte | bfd_byte *
bfd_generic_get_relocated_section_contents (bfd *abfd,
struct bfd_link_info *link_info,
struct bfd_link_order *link_order,
bfd_byte *data,
bfd_boolean relocatable,
asymbol **symbols)
{
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
long reloc_size;
arelent **reloc_vector;
long reloc_count;
reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
if (reloc_size < 0)
return NULL;
/* Read in the section. */
if (!bfd_get_full_section_contents (input_bfd, input_section, &data))
return NULL;
if (data == NULL)
return NULL;
if (reloc_size == 0)
return data;
reloc_vector = (arelent **) bfd_malloc (reloc_size);
if (reloc_vector == NULL)
return NULL;
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
reloc_vector,
symbols);
if (reloc_count < 0)
goto error_return;
if (reloc_count > 0)
{
arelent **parent;
for (parent = reloc_vector; *parent != NULL; parent++)
{
char *error_message = NULL;
asymbol *symbol;
bfd_reloc_status_type r;
symbol = *(*parent)->sym_ptr_ptr;
/* PR ld/19628: A specially crafted input file
can result in a NULL symbol pointer here. */
if (symbol == NULL)
{
link_info->callbacks->einfo
/* xgettext:c-format */
(_("%X%P: %pB(%pA): error: relocation for offset %V has no value\n"),
abfd, input_section, (* parent)->address);
goto error_return;
}
/* Zap reloc field when the symbol is from a discarded
section, ignoring any addend. Do the same when called
from bfd_simple_get_relocated_section_contents for
undefined symbols in debug sections. This is to keep
debug info reasonably sane, in particular so that
DW_FORM_ref_addr to another file's .debug_info isn't
confused with an offset into the current file's
.debug_info. */
if ((symbol->section != NULL && discarded_section (symbol->section))
|| (symbol->section == bfd_und_section_ptr
&& (input_section->flags & SEC_DEBUGGING) != 0
&& link_info->input_bfds == link_info->output_bfd))
{
bfd_vma off;
static reloc_howto_type none_howto
= HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
"unused", FALSE, 0, 0, FALSE);
off = ((*parent)->address
* bfd_octets_per_byte (input_bfd, input_section));
_bfd_clear_contents ((*parent)->howto, input_bfd,
input_section, data, off);
(*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
(*parent)->addend = 0;
(*parent)->howto = &none_howto;
r = bfd_reloc_ok;
}
else
r = bfd_perform_relocation (input_bfd,
*parent,
data,
input_section,
relocatable ? abfd : NULL,
&error_message);
if (relocatable)
{
asection *os = input_section->output_section;
/* A partial link, so keep the relocs. */
os->orelocation[os->reloc_count] = *parent;
os->reloc_count++;
}
if (r != bfd_reloc_ok)
{
switch (r)
{
case bfd_reloc_undefined:
(*link_info->callbacks->undefined_symbol)
(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
input_bfd, input_section, (*parent)->address, TRUE);
break;
case bfd_reloc_dangerous:
BFD_ASSERT (error_message != NULL);
(*link_info->callbacks->reloc_dangerous)
(link_info, error_message,
input_bfd, input_section, (*parent)->address);
break;
case bfd_reloc_overflow:
(*link_info->callbacks->reloc_overflow)
(link_info, NULL,
bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
(*parent)->howto->name, (*parent)->addend,
input_bfd, input_section, (*parent)->address);
break;
case bfd_reloc_outofrange:
/* PR ld/13730:
This error can result when processing some partially
complete binaries. Do not abort, but issue an error
message instead. */
link_info->callbacks->einfo
/* xgettext:c-format */
(_("%X%P: %pB(%pA): relocation \"%pR\" goes out of range\n"),
abfd, input_section, * parent);
goto error_return;
case bfd_reloc_notsupported:
/* PR ld/17512
This error can result when processing a corrupt binary.
Do not abort. Issue an error message instead. */
link_info->callbacks->einfo
/* xgettext:c-format */
(_("%X%P: %pB(%pA): relocation \"%pR\" is not supported\n"),
abfd, input_section, * parent);
goto error_return;
default:
/* PR 17512; file: 90c2a92e.
Report unexpected results, without aborting. */
link_info->callbacks->einfo
/* xgettext:c-format */
(_("%X%P: %pB(%pA): relocation \"%pR\" returns an unrecognized value %x\n"),
abfd, input_section, * parent, r);
break;
}
}
}
}
free (reloc_vector);
return data;
error_return:
free (reloc_vector);
return NULL;
} | /*
INTERNAL_FUNCTION
bfd_generic_get_relocated_section_contents
SYNOPSIS
bfd_byte *bfd_generic_get_relocated_section_contents
(bfd *abfd,
struct bfd_link_info *link_info,
struct bfd_link_order *link_order,
bfd_byte *data,
bfd_boolean relocatable,
asymbol **symbols);
DESCRIPTION
Provides default handling of relocation effort for back ends
which can't be bothered to do it efficiently.
*/ |
DESCRIPTION
Provides default handling of relocation effort for back ends
which can't be bothered to do it efficiently. | [
"DESCRIPTION",
"Provides",
"default",
"handling",
"of",
"relocation",
"effort",
"for",
"back",
"ends",
"which",
"can",
"'",
"t",
"be",
"bothered",
"to",
"do",
"it",
"efficiently",
"."
] | bfd_byte *
bfd_generic_get_relocated_section_contents (bfd *abfd,
struct bfd_link_info *link_info,
struct bfd_link_order *link_order,
bfd_byte *data,
bfd_boolean relocatable,
asymbol **symbols)
{
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
long reloc_size;
arelent **reloc_vector;
long reloc_count;
reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
if (reloc_size < 0)
return NULL;
if (!bfd_get_full_section_contents (input_bfd, input_section, &data))
return NULL;
if (data == NULL)
return NULL;
if (reloc_size == 0)
return data;
reloc_vector = (arelent **) bfd_malloc (reloc_size);
if (reloc_vector == NULL)
return NULL;
reloc_count = bfd_canonicalize_reloc (input_bfd,
input_section,
reloc_vector,
symbols);
if (reloc_count < 0)
goto error_return;
if (reloc_count > 0)
{
arelent **parent;
for (parent = reloc_vector; *parent != NULL; parent++)
{
char *error_message = NULL;
asymbol *symbol;
bfd_reloc_status_type r;
symbol = *(*parent)->sym_ptr_ptr;
if (symbol == NULL)
{
link_info->callbacks->einfo
(_("%X%P: %pB(%pA): error: relocation for offset %V has no value\n"),
abfd, input_section, (* parent)->address);
goto error_return;
}
if ((symbol->section != NULL && discarded_section (symbol->section))
|| (symbol->section == bfd_und_section_ptr
&& (input_section->flags & SEC_DEBUGGING) != 0
&& link_info->input_bfds == link_info->output_bfd))
{
bfd_vma off;
static reloc_howto_type none_howto
= HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL,
"unused", FALSE, 0, 0, FALSE);
off = ((*parent)->address
* bfd_octets_per_byte (input_bfd, input_section));
_bfd_clear_contents ((*parent)->howto, input_bfd,
input_section, data, off);
(*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
(*parent)->addend = 0;
(*parent)->howto = &none_howto;
r = bfd_reloc_ok;
}
else
r = bfd_perform_relocation (input_bfd,
*parent,
data,
input_section,
relocatable ? abfd : NULL,
&error_message);
if (relocatable)
{
asection *os = input_section->output_section;
os->orelocation[os->reloc_count] = *parent;
os->reloc_count++;
}
if (r != bfd_reloc_ok)
{
switch (r)
{
case bfd_reloc_undefined:
(*link_info->callbacks->undefined_symbol)
(link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
input_bfd, input_section, (*parent)->address, TRUE);
break;
case bfd_reloc_dangerous:
BFD_ASSERT (error_message != NULL);
(*link_info->callbacks->reloc_dangerous)
(link_info, error_message,
input_bfd, input_section, (*parent)->address);
break;
case bfd_reloc_overflow:
(*link_info->callbacks->reloc_overflow)
(link_info, NULL,
bfd_asymbol_name (*(*parent)->sym_ptr_ptr),
(*parent)->howto->name, (*parent)->addend,
input_bfd, input_section, (*parent)->address);
break;
case bfd_reloc_outofrange:
link_info->callbacks->einfo
(_("%X%P: %pB(%pA): relocation \"%pR\" goes out of range\n"),
abfd, input_section, * parent);
goto error_return;
case bfd_reloc_notsupported:
link_info->callbacks->einfo
(_("%X%P: %pB(%pA): relocation \"%pR\" is not supported\n"),
abfd, input_section, * parent);
goto error_return;
default:
link_info->callbacks->einfo
(_("%X%P: %pB(%pA): relocation \"%pR\" returns an unrecognized value %x\n"),
abfd, input_section, * parent, r);
break;
}
}
}
}
free (reloc_vector);
return data;
error_return:
free (reloc_vector);
return NULL;
} | [
"bfd_byte",
"*",
"bfd_generic_get_relocated_section_contents",
"(",
"bfd",
"*",
"abfd",
",",
"struct",
"bfd_link_info",
"*",
"link_info",
",",
"struct",
"bfd_link_order",
"*",
"link_order",
",",
"bfd_byte",
"*",
"data",
",",
"bfd_boolean",
"relocatable",
",",
"asymbol",
"*",
"*",
"symbols",
")",
"{",
"bfd",
"*",
"input_bfd",
"=",
"link_order",
"->",
"u",
".",
"indirect",
".",
"section",
"->",
"owner",
";",
"asection",
"*",
"input_section",
"=",
"link_order",
"->",
"u",
".",
"indirect",
".",
"section",
";",
"long",
"reloc_size",
";",
"arelent",
"*",
"*",
"reloc_vector",
";",
"long",
"reloc_count",
";",
"reloc_size",
"=",
"bfd_get_reloc_upper_bound",
"(",
"input_bfd",
",",
"input_section",
")",
";",
"if",
"(",
"reloc_size",
"<",
"0",
")",
"return",
"NULL",
";",
"if",
"(",
"!",
"bfd_get_full_section_contents",
"(",
"input_bfd",
",",
"input_section",
",",
"&",
"data",
")",
")",
"return",
"NULL",
";",
"if",
"(",
"data",
"==",
"NULL",
")",
"return",
"NULL",
";",
"if",
"(",
"reloc_size",
"==",
"0",
")",
"return",
"data",
";",
"reloc_vector",
"=",
"(",
"arelent",
"*",
"*",
")",
"bfd_malloc",
"(",
"reloc_size",
")",
";",
"if",
"(",
"reloc_vector",
"==",
"NULL",
")",
"return",
"NULL",
";",
"reloc_count",
"=",
"bfd_canonicalize_reloc",
"(",
"input_bfd",
",",
"input_section",
",",
"reloc_vector",
",",
"symbols",
")",
";",
"if",
"(",
"reloc_count",
"<",
"0",
")",
"goto",
"error_return",
";",
"if",
"(",
"reloc_count",
">",
"0",
")",
"{",
"arelent",
"*",
"*",
"parent",
";",
"for",
"(",
"parent",
"=",
"reloc_vector",
";",
"*",
"parent",
"!=",
"NULL",
";",
"parent",
"++",
")",
"{",
"char",
"*",
"error_message",
"=",
"NULL",
";",
"asymbol",
"*",
"symbol",
";",
"bfd_reloc_status_type",
"r",
";",
"symbol",
"=",
"*",
"(",
"*",
"parent",
")",
"->",
"sym_ptr_ptr",
";",
"if",
"(",
"symbol",
"==",
"NULL",
")",
"{",
"link_info",
"->",
"callbacks",
"->",
"einfo",
"(",
"_",
"(",
"\"",
"\\n",
"\"",
")",
",",
"abfd",
",",
"input_section",
",",
"(",
"*",
"parent",
")",
"->",
"address",
")",
";",
"goto",
"error_return",
";",
"}",
"if",
"(",
"(",
"symbol",
"->",
"section",
"!=",
"NULL",
"&&",
"discarded_section",
"(",
"symbol",
"->",
"section",
")",
")",
"||",
"(",
"symbol",
"->",
"section",
"==",
"bfd_und_section_ptr",
"&&",
"(",
"input_section",
"->",
"flags",
"&",
"SEC_DEBUGGING",
")",
"!=",
"0",
"&&",
"link_info",
"->",
"input_bfds",
"==",
"link_info",
"->",
"output_bfd",
")",
")",
"{",
"bfd_vma",
"off",
";",
"static",
"reloc_howto_type",
"none_howto",
"=",
"HOWTO",
"(",
"0",
",",
"0",
",",
"0",
",",
"0",
",",
"FALSE",
",",
"0",
",",
"complain_overflow_dont",
",",
"NULL",
",",
"\"",
"\"",
",",
"FALSE",
",",
"0",
",",
"0",
",",
"FALSE",
")",
";",
"off",
"=",
"(",
"(",
"*",
"parent",
")",
"->",
"address",
"*",
"bfd_octets_per_byte",
"(",
"input_bfd",
",",
"input_section",
")",
")",
";",
"_bfd_clear_contents",
"(",
"(",
"*",
"parent",
")",
"->",
"howto",
",",
"input_bfd",
",",
"input_section",
",",
"data",
",",
"off",
")",
";",
"(",
"*",
"parent",
")",
"->",
"sym_ptr_ptr",
"=",
"bfd_abs_section_ptr",
"->",
"symbol_ptr_ptr",
";",
"(",
"*",
"parent",
")",
"->",
"addend",
"=",
"0",
";",
"(",
"*",
"parent",
")",
"->",
"howto",
"=",
"&",
"none_howto",
";",
"r",
"=",
"bfd_reloc_ok",
";",
"}",
"else",
"r",
"=",
"bfd_perform_relocation",
"(",
"input_bfd",
",",
"*",
"parent",
",",
"data",
",",
"input_section",
",",
"relocatable",
"?",
"abfd",
":",
"NULL",
",",
"&",
"error_message",
")",
";",
"if",
"(",
"relocatable",
")",
"{",
"asection",
"*",
"os",
"=",
"input_section",
"->",
"output_section",
";",
"os",
"->",
"orelocation",
"[",
"os",
"->",
"reloc_count",
"]",
"=",
"*",
"parent",
";",
"os",
"->",
"reloc_count",
"++",
";",
"}",
"if",
"(",
"r",
"!=",
"bfd_reloc_ok",
")",
"{",
"switch",
"(",
"r",
")",
"{",
"case",
"bfd_reloc_undefined",
":",
"(",
"*",
"link_info",
"->",
"callbacks",
"->",
"undefined_symbol",
")",
"(",
"link_info",
",",
"bfd_asymbol_name",
"(",
"*",
"(",
"*",
"parent",
")",
"->",
"sym_ptr_ptr",
")",
",",
"input_bfd",
",",
"input_section",
",",
"(",
"*",
"parent",
")",
"->",
"address",
",",
"TRUE",
")",
";",
"break",
";",
"case",
"bfd_reloc_dangerous",
":",
"BFD_ASSERT",
"(",
"error_message",
"!=",
"NULL",
")",
";",
"(",
"*",
"link_info",
"->",
"callbacks",
"->",
"reloc_dangerous",
")",
"(",
"link_info",
",",
"error_message",
",",
"input_bfd",
",",
"input_section",
",",
"(",
"*",
"parent",
")",
"->",
"address",
")",
";",
"break",
";",
"case",
"bfd_reloc_overflow",
":",
"(",
"*",
"link_info",
"->",
"callbacks",
"->",
"reloc_overflow",
")",
"(",
"link_info",
",",
"NULL",
",",
"bfd_asymbol_name",
"(",
"*",
"(",
"*",
"parent",
")",
"->",
"sym_ptr_ptr",
")",
",",
"(",
"*",
"parent",
")",
"->",
"howto",
"->",
"name",
",",
"(",
"*",
"parent",
")",
"->",
"addend",
",",
"input_bfd",
",",
"input_section",
",",
"(",
"*",
"parent",
")",
"->",
"address",
")",
";",
"break",
";",
"case",
"bfd_reloc_outofrange",
":",
"link_info",
"->",
"callbacks",
"->",
"einfo",
"(",
"_",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
",",
"abfd",
",",
"input_section",
",",
"*",
"parent",
")",
";",
"goto",
"error_return",
";",
"case",
"bfd_reloc_notsupported",
":",
"link_info",
"->",
"callbacks",
"->",
"einfo",
"(",
"_",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
",",
"abfd",
",",
"input_section",
",",
"*",
"parent",
")",
";",
"goto",
"error_return",
";",
"default",
":",
"link_info",
"->",
"callbacks",
"->",
"einfo",
"(",
"_",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
")",
",",
"abfd",
",",
"input_section",
",",
"*",
"parent",
",",
"r",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"free",
"(",
"reloc_vector",
")",
";",
"return",
"data",
";",
"error_return",
":",
"free",
"(",
"reloc_vector",
")",
";",
"return",
"NULL",
";",
"}"
] | INTERNAL_FUNCTION
bfd_generic_get_relocated_section_contents | [
"INTERNAL_FUNCTION",
"bfd_generic_get_relocated_section_contents"
] | [
"/* Read in the section. */",
"/* PR ld/19628: A specially crafted input file\n\t can result in a NULL symbol pointer here. */",
"/* xgettext:c-format */",
"/* Zap reloc field when the symbol is from a discarded\n\t section, ignoring any addend. Do the same when called\n\t from bfd_simple_get_relocated_section_contents for\n\t undefined symbols in debug sections. This is to keep\n\t debug info reasonably sane, in particular so that\n\t DW_FORM_ref_addr to another file's .debug_info isn't\n\t confused with an offset into the current file's\n\t .debug_info. */",
"/* A partial link, so keep the relocs. */",
"/* PR ld/13730:\n\t\t This error can result when processing some partially\n\t\t complete binaries. Do not abort, but issue an error\n\t\t message instead. */",
"/* xgettext:c-format */",
"/* PR ld/17512\n\t\t This error can result when processing a corrupt binary.\n\t\t Do not abort. Issue an error message instead. */",
"/* xgettext:c-format */",
"/* PR 17512; file: 90c2a92e.\n\t\t Report unexpected results, without aborting. */",
"/* xgettext:c-format */"
] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "link_info",
"type": "struct bfd_link_info"
},
{
"param": "link_order",
"type": "struct bfd_link_order"
},
{
"param": "data",
"type": "bfd_byte"
},
{
"param": "relocatable",
"type": "bfd_boolean"
},
{
"param": "symbols",
"type": "asymbol"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "link_info",
"type": "struct bfd_link_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "link_order",
"type": "struct bfd_link_order",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "data",
"type": "bfd_byte",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "relocatable",
"type": "bfd_boolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "symbols",
"type": "asymbol",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
33cd67150cfdeeab3be0014b97380fcb8658ec57 | atrens/DragonFlyBSD-src | contrib/binutils-2.34/bfd/reloc.c | [
"BSD-3-Clause"
] | C | _bfd_unrecognized_reloc | bfd_boolean | bfd_boolean
_bfd_unrecognized_reloc (bfd * abfd, sec_ptr section, unsigned int r_type)
{
/* xgettext:c-format */
_bfd_error_handler (_("%pB: unrecognized relocation type %#x in section `%pA'"),
abfd, r_type, section);
/* PR 21803: Suggest the most likely cause of this error. */
_bfd_error_handler (_("is this version of the linker - %s - out of date ?"),
BFD_VERSION_STRING);
bfd_set_error (bfd_error_bad_value);
return FALSE;
} | /*
INTERNAL_FUNCTION
_bfd_unrecognized_reloc
SYNOPSIS
bfd_boolean _bfd_unrecognized_reloc
(bfd * abfd,
sec_ptr section,
unsigned int r_type);
DESCRIPTION
Reports an unrecognized reloc.
Written as a function in order to reduce code duplication.
Returns FALSE so that it can be called from a return statement.
*/ |
DESCRIPTION
Reports an unrecognized reloc.
Written as a function in order to reduce code duplication.
Returns FALSE so that it can be called from a return statement. | [
"DESCRIPTION",
"Reports",
"an",
"unrecognized",
"reloc",
".",
"Written",
"as",
"a",
"function",
"in",
"order",
"to",
"reduce",
"code",
"duplication",
".",
"Returns",
"FALSE",
"so",
"that",
"it",
"can",
"be",
"called",
"from",
"a",
"return",
"statement",
"."
] | bfd_boolean
_bfd_unrecognized_reloc (bfd * abfd, sec_ptr section, unsigned int r_type)
{
_bfd_error_handler (_("%pB: unrecognized relocation type %#x in section `%pA'"),
abfd, r_type, section);
_bfd_error_handler (_("is this version of the linker - %s - out of date ?"),
BFD_VERSION_STRING);
bfd_set_error (bfd_error_bad_value);
return FALSE;
} | [
"bfd_boolean",
"_bfd_unrecognized_reloc",
"(",
"bfd",
"*",
"abfd",
",",
"sec_ptr",
"section",
",",
"unsigned",
"int",
"r_type",
")",
"{",
"_bfd_error_handler",
"(",
"_",
"(",
"\"",
"\"",
")",
",",
"abfd",
",",
"r_type",
",",
"section",
")",
";",
"_bfd_error_handler",
"(",
"_",
"(",
"\"",
"\"",
")",
",",
"BFD_VERSION_STRING",
")",
";",
"bfd_set_error",
"(",
"bfd_error_bad_value",
")",
";",
"return",
"FALSE",
";",
"}"
] | INTERNAL_FUNCTION
_bfd_unrecognized_reloc | [
"INTERNAL_FUNCTION",
"_bfd_unrecognized_reloc"
] | [
"/* xgettext:c-format */",
"/* PR 21803: Suggest the most likely cause of this error. */"
] | [
{
"param": "abfd",
"type": "bfd"
},
{
"param": "section",
"type": "sec_ptr"
},
{
"param": "r_type",
"type": "unsigned int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "abfd",
"type": "bfd",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "section",
"type": "sec_ptr",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "r_type",
"type": "unsigned int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | do_niy | void | static void
do_niy (pretty_printer *buffer, const_tree node)
{
int i, len;
pp_string (buffer, "<<< Unknown tree: ");
pp_string (buffer, tree_code_name[(int) TREE_CODE (node)]);
if (EXPR_P (node))
{
len = TREE_OPERAND_LENGTH (node);
for (i = 0; i < len; ++i)
{
newline_and_indent (buffer, 2);
dump_generic_node (buffer, TREE_OPERAND (node, i), 2, 0, false);
}
}
pp_string (buffer, " >>>");
} | /* Try to print something for an unknown tree code. */ | Try to print something for an unknown tree code. | [
"Try",
"to",
"print",
"something",
"for",
"an",
"unknown",
"tree",
"code",
"."
] | static void
do_niy (pretty_printer *buffer, const_tree node)
{
int i, len;
pp_string (buffer, "<<< Unknown tree: ");
pp_string (buffer, tree_code_name[(int) TREE_CODE (node)]);
if (EXPR_P (node))
{
len = TREE_OPERAND_LENGTH (node);
for (i = 0; i < len; ++i)
{
newline_and_indent (buffer, 2);
dump_generic_node (buffer, TREE_OPERAND (node, i), 2, 0, false);
}
}
pp_string (buffer, " >>>");
} | [
"static",
"void",
"do_niy",
"(",
"pretty_printer",
"*",
"buffer",
",",
"const_tree",
"node",
")",
"{",
"int",
"i",
",",
"len",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"pp_string",
"(",
"buffer",
",",
"tree_code_name",
"[",
"(",
"int",
")",
"TREE_CODE",
"(",
"node",
")",
"]",
")",
";",
"if",
"(",
"EXPR_P",
"(",
"node",
")",
")",
"{",
"len",
"=",
"TREE_OPERAND_LENGTH",
"(",
"node",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"++",
"i",
")",
"{",
"newline_and_indent",
"(",
"buffer",
",",
"2",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_OPERAND",
"(",
"node",
",",
"i",
")",
",",
"2",
",",
"0",
",",
"false",
")",
";",
"}",
"}",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}"
] | Try to print something for an unknown tree code. | [
"Try",
"to",
"print",
"something",
"for",
"an",
"unknown",
"tree",
"code",
"."
] | [] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "node",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | print_generic_decl | void | void
print_generic_decl (FILE *file, tree decl, int flags)
{
maybe_init_pretty_print (file);
print_declaration (&buffer, decl, 2, flags);
pp_write_text_to_stream (&buffer);
} | /* Prints declaration DECL to the FILE with details specified by FLAGS. */ | Prints declaration DECL to the FILE with details specified by FLAGS. | [
"Prints",
"declaration",
"DECL",
"to",
"the",
"FILE",
"with",
"details",
"specified",
"by",
"FLAGS",
"."
] | void
print_generic_decl (FILE *file, tree decl, int flags)
{
maybe_init_pretty_print (file);
print_declaration (&buffer, decl, 2, flags);
pp_write_text_to_stream (&buffer);
} | [
"void",
"print_generic_decl",
"(",
"FILE",
"*",
"file",
",",
"tree",
"decl",
",",
"int",
"flags",
")",
"{",
"maybe_init_pretty_print",
"(",
"file",
")",
";",
"print_declaration",
"(",
"&",
"buffer",
",",
"decl",
",",
"2",
",",
"flags",
")",
";",
"pp_write_text_to_stream",
"(",
"&",
"buffer",
")",
";",
"}"
] | Prints declaration DECL to the FILE with details specified by FLAGS. | [
"Prints",
"declaration",
"DECL",
"to",
"the",
"FILE",
"with",
"details",
"specified",
"by",
"FLAGS",
"."
] | [] | [
{
"param": "file",
"type": "FILE"
},
{
"param": "decl",
"type": "tree"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "decl",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | print_generic_stmt | void | void
print_generic_stmt (FILE *file, tree t, int flags)
{
maybe_init_pretty_print (file);
dump_generic_node (&buffer, t, 0, flags, true);
pp_flush (&buffer);
} | /* Print tree T, and its successors, on file FILE. FLAGS specifies details
to show in the dump. See TDF_* in tree-pass.h. */ | Print tree T, and its successors, on file FILE. FLAGS specifies details
to show in the dump. | [
"Print",
"tree",
"T",
"and",
"its",
"successors",
"on",
"file",
"FILE",
".",
"FLAGS",
"specifies",
"details",
"to",
"show",
"in",
"the",
"dump",
"."
] | void
print_generic_stmt (FILE *file, tree t, int flags)
{
maybe_init_pretty_print (file);
dump_generic_node (&buffer, t, 0, flags, true);
pp_flush (&buffer);
} | [
"void",
"print_generic_stmt",
"(",
"FILE",
"*",
"file",
",",
"tree",
"t",
",",
"int",
"flags",
")",
"{",
"maybe_init_pretty_print",
"(",
"file",
")",
";",
"dump_generic_node",
"(",
"&",
"buffer",
",",
"t",
",",
"0",
",",
"flags",
",",
"true",
")",
";",
"pp_flush",
"(",
"&",
"buffer",
")",
";",
"}"
] | Print tree T, and its successors, on file FILE. | [
"Print",
"tree",
"T",
"and",
"its",
"successors",
"on",
"file",
"FILE",
"."
] | [] | [
{
"param": "file",
"type": "FILE"
},
{
"param": "t",
"type": "tree"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | print_generic_stmt_indented | void | void
print_generic_stmt_indented (FILE *file, tree t, int flags, int indent)
{
int i;
maybe_init_pretty_print (file);
for (i = 0; i < indent; i++)
pp_space (&buffer);
dump_generic_node (&buffer, t, indent, flags, true);
pp_flush (&buffer);
} | /* Print tree T, and its successors, on file FILE. FLAGS specifies details
to show in the dump. See TDF_* in tree-pass.h. The output is indented by
INDENT spaces. */ | Print tree T, and its successors, on file FILE. FLAGS specifies details
to show in the dump. | [
"Print",
"tree",
"T",
"and",
"its",
"successors",
"on",
"file",
"FILE",
".",
"FLAGS",
"specifies",
"details",
"to",
"show",
"in",
"the",
"dump",
"."
] | void
print_generic_stmt_indented (FILE *file, tree t, int flags, int indent)
{
int i;
maybe_init_pretty_print (file);
for (i = 0; i < indent; i++)
pp_space (&buffer);
dump_generic_node (&buffer, t, indent, flags, true);
pp_flush (&buffer);
} | [
"void",
"print_generic_stmt_indented",
"(",
"FILE",
"*",
"file",
",",
"tree",
"t",
",",
"int",
"flags",
",",
"int",
"indent",
")",
"{",
"int",
"i",
";",
"maybe_init_pretty_print",
"(",
"file",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"indent",
";",
"i",
"++",
")",
"pp_space",
"(",
"&",
"buffer",
")",
";",
"dump_generic_node",
"(",
"&",
"buffer",
",",
"t",
",",
"indent",
",",
"flags",
",",
"true",
")",
";",
"pp_flush",
"(",
"&",
"buffer",
")",
";",
"}"
] | Print tree T, and its successors, on file FILE. | [
"Print",
"tree",
"T",
"and",
"its",
"successors",
"on",
"file",
"FILE",
"."
] | [] | [
{
"param": "file",
"type": "FILE"
},
{
"param": "t",
"type": "tree"
},
{
"param": "flags",
"type": "int"
},
{
"param": "indent",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "indent",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | print_generic_expr | void | void
print_generic_expr (FILE *file, tree t, int flags)
{
maybe_init_pretty_print (file);
dump_generic_node (&buffer, t, 0, flags, false);
} | /* Print a single expression T on file FILE. FLAGS specifies details to show
in the dump. See TDF_* in tree-pass.h. */ | Print a single expression T on file FILE. FLAGS specifies details to show
in the dump. | [
"Print",
"a",
"single",
"expression",
"T",
"on",
"file",
"FILE",
".",
"FLAGS",
"specifies",
"details",
"to",
"show",
"in",
"the",
"dump",
"."
] | void
print_generic_expr (FILE *file, tree t, int flags)
{
maybe_init_pretty_print (file);
dump_generic_node (&buffer, t, 0, flags, false);
} | [
"void",
"print_generic_expr",
"(",
"FILE",
"*",
"file",
",",
"tree",
"t",
",",
"int",
"flags",
")",
"{",
"maybe_init_pretty_print",
"(",
"file",
")",
";",
"dump_generic_node",
"(",
"&",
"buffer",
",",
"t",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"}"
] | Print a single expression T on file FILE. | [
"Print",
"a",
"single",
"expression",
"T",
"on",
"file",
"FILE",
"."
] | [] | [
{
"param": "file",
"type": "FILE"
},
{
"param": "t",
"type": "tree"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_decl_name | void | static void
dump_decl_name (pretty_printer *buffer, tree node, int flags)
{
if (DECL_NAME (node))
{
if ((flags & TDF_ASMNAME) && DECL_ASSEMBLER_NAME_SET_P (node))
pp_tree_identifier (buffer, DECL_ASSEMBLER_NAME (node));
else
pp_tree_identifier (buffer, DECL_NAME (node));
}
if ((flags & TDF_UID) || DECL_NAME (node) == NULL_TREE)
{
if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1)
pp_printf (buffer, "L.%d", (int) LABEL_DECL_UID (node));
else if (TREE_CODE (node) == DEBUG_EXPR_DECL)
{
if (flags & TDF_NOUID)
pp_string (buffer, "D#xxxx");
else
pp_printf (buffer, "D#%i", DEBUG_TEMP_UID (node));
}
else
{
char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
if (flags & TDF_NOUID)
pp_printf (buffer, "%c.xxxx", c);
else
pp_printf (buffer, "%c.%u", c, DECL_UID (node));
}
}
if ((flags & TDF_ALIAS) && DECL_PT_UID (node) != DECL_UID (node))
{
if (flags & TDF_NOUID)
pp_printf (buffer, "ptD.xxxx");
else
pp_printf (buffer, "ptD.%u", DECL_PT_UID (node));
}
} | /* Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
in FLAGS. */ | Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
in FLAGS. | [
"Dump",
"the",
"name",
"of",
"a",
"_DECL",
"node",
"and",
"its",
"DECL_UID",
"if",
"TDF_UID",
"is",
"set",
"in",
"FLAGS",
"."
] | static void
dump_decl_name (pretty_printer *buffer, tree node, int flags)
{
if (DECL_NAME (node))
{
if ((flags & TDF_ASMNAME) && DECL_ASSEMBLER_NAME_SET_P (node))
pp_tree_identifier (buffer, DECL_ASSEMBLER_NAME (node));
else
pp_tree_identifier (buffer, DECL_NAME (node));
}
if ((flags & TDF_UID) || DECL_NAME (node) == NULL_TREE)
{
if (TREE_CODE (node) == LABEL_DECL && LABEL_DECL_UID (node) != -1)
pp_printf (buffer, "L.%d", (int) LABEL_DECL_UID (node));
else if (TREE_CODE (node) == DEBUG_EXPR_DECL)
{
if (flags & TDF_NOUID)
pp_string (buffer, "D#xxxx");
else
pp_printf (buffer, "D#%i", DEBUG_TEMP_UID (node));
}
else
{
char c = TREE_CODE (node) == CONST_DECL ? 'C' : 'D';
if (flags & TDF_NOUID)
pp_printf (buffer, "%c.xxxx", c);
else
pp_printf (buffer, "%c.%u", c, DECL_UID (node));
}
}
if ((flags & TDF_ALIAS) && DECL_PT_UID (node) != DECL_UID (node))
{
if (flags & TDF_NOUID)
pp_printf (buffer, "ptD.xxxx");
else
pp_printf (buffer, "ptD.%u", DECL_PT_UID (node));
}
} | [
"static",
"void",
"dump_decl_name",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"node",
",",
"int",
"flags",
")",
"{",
"if",
"(",
"DECL_NAME",
"(",
"node",
")",
")",
"{",
"if",
"(",
"(",
"flags",
"&",
"TDF_ASMNAME",
")",
"&&",
"DECL_ASSEMBLER_NAME_SET_P",
"(",
"node",
")",
")",
"pp_tree_identifier",
"(",
"buffer",
",",
"DECL_ASSEMBLER_NAME",
"(",
"node",
")",
")",
";",
"else",
"pp_tree_identifier",
"(",
"buffer",
",",
"DECL_NAME",
"(",
"node",
")",
")",
";",
"}",
"if",
"(",
"(",
"flags",
"&",
"TDF_UID",
")",
"||",
"DECL_NAME",
"(",
"node",
")",
"==",
"NULL_TREE",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"node",
")",
"==",
"LABEL_DECL",
"&&",
"LABEL_DECL_UID",
"(",
"node",
")",
"!=",
"-1",
")",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"(",
"int",
")",
"LABEL_DECL_UID",
"(",
"node",
")",
")",
";",
"else",
"if",
"(",
"TREE_CODE",
"(",
"node",
")",
"==",
"DEBUG_EXPR_DECL",
")",
"{",
"if",
"(",
"flags",
"&",
"TDF_NOUID",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"else",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"DEBUG_TEMP_UID",
"(",
"node",
")",
")",
";",
"}",
"else",
"{",
"char",
"c",
"=",
"TREE_CODE",
"(",
"node",
")",
"==",
"CONST_DECL",
"?",
"'",
"'",
":",
"'",
"'",
";",
"if",
"(",
"flags",
"&",
"TDF_NOUID",
")",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"c",
")",
";",
"else",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"c",
",",
"DECL_UID",
"(",
"node",
")",
")",
";",
"}",
"}",
"if",
"(",
"(",
"flags",
"&",
"TDF_ALIAS",
")",
"&&",
"DECL_PT_UID",
"(",
"node",
")",
"!=",
"DECL_UID",
"(",
"node",
")",
")",
"{",
"if",
"(",
"flags",
"&",
"TDF_NOUID",
")",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"else",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"DECL_PT_UID",
"(",
"node",
")",
")",
";",
"}",
"}"
] | Dump the name of a _DECL node and its DECL_UID if TDF_UID is set
in FLAGS. | [
"Dump",
"the",
"name",
"of",
"a",
"_DECL",
"node",
"and",
"its",
"DECL_UID",
"if",
"TDF_UID",
"is",
"set",
"in",
"FLAGS",
"."
] | [] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "node",
"type": "tree"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_function_name | void | static void
dump_function_name (pretty_printer *buffer, tree node, int flags)
{
if (TREE_CODE (node) == NOP_EXPR)
node = TREE_OPERAND (node, 0);
if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
else
dump_decl_name (buffer, node, flags);
} | /* Like the above, but used for pretty printing function calls. */ | Like the above, but used for pretty printing function calls. | [
"Like",
"the",
"above",
"but",
"used",
"for",
"pretty",
"printing",
"function",
"calls",
"."
] | static void
dump_function_name (pretty_printer *buffer, tree node, int flags)
{
if (TREE_CODE (node) == NOP_EXPR)
node = TREE_OPERAND (node, 0);
if (DECL_NAME (node) && (flags & TDF_ASMNAME) == 0)
pp_string (buffer, lang_hooks.decl_printable_name (node, 1));
else
dump_decl_name (buffer, node, flags);
} | [
"static",
"void",
"dump_function_name",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"node",
",",
"int",
"flags",
")",
"{",
"if",
"(",
"TREE_CODE",
"(",
"node",
")",
"==",
"NOP_EXPR",
")",
"node",
"=",
"TREE_OPERAND",
"(",
"node",
",",
"0",
")",
";",
"if",
"(",
"DECL_NAME",
"(",
"node",
")",
"&&",
"(",
"flags",
"&",
"TDF_ASMNAME",
")",
"==",
"0",
")",
"pp_string",
"(",
"buffer",
",",
"lang_hooks",
".",
"decl_printable_name",
"(",
"node",
",",
"1",
")",
")",
";",
"else",
"dump_decl_name",
"(",
"buffer",
",",
"node",
",",
"flags",
")",
";",
"}"
] | Like the above, but used for pretty printing function calls. | [
"Like",
"the",
"above",
"but",
"used",
"for",
"pretty",
"printing",
"function",
"calls",
"."
] | [] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "node",
"type": "tree"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_function_declaration | void | static void
dump_function_declaration (pretty_printer *buffer, tree node,
int spc, int flags)
{
bool wrote_arg = false;
tree arg;
pp_space (buffer);
pp_character (buffer, '(');
/* Print the argument types. */
arg = TYPE_ARG_TYPES (node);
while (arg && arg != void_list_node && arg != error_mark_node)
{
if (wrote_arg)
{
pp_character (buffer, ',');
pp_space (buffer);
}
wrote_arg = true;
dump_generic_node (buffer, TREE_VALUE (arg), spc, flags, false);
arg = TREE_CHAIN (arg);
}
/* Drop the trailing void_type_node if we had any previous argument. */
if (arg == void_list_node && !wrote_arg)
pp_string (buffer, "void");
/* Properly dump vararg function types. */
else if (!arg && wrote_arg)
pp_string (buffer, ", ...");
/* Avoid printing any arg for unprototyped functions. */
pp_character (buffer, ')');
} | /* Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
FLAGS are as in dump_generic_node. */ | Dump a function declaration. NODE is the FUNCTION_TYPE. BUFFER, SPC and
FLAGS are as in dump_generic_node. | [
"Dump",
"a",
"function",
"declaration",
".",
"NODE",
"is",
"the",
"FUNCTION_TYPE",
".",
"BUFFER",
"SPC",
"and",
"FLAGS",
"are",
"as",
"in",
"dump_generic_node",
"."
] | static void
dump_function_declaration (pretty_printer *buffer, tree node,
int spc, int flags)
{
bool wrote_arg = false;
tree arg;
pp_space (buffer);
pp_character (buffer, '(');
arg = TYPE_ARG_TYPES (node);
while (arg && arg != void_list_node && arg != error_mark_node)
{
if (wrote_arg)
{
pp_character (buffer, ',');
pp_space (buffer);
}
wrote_arg = true;
dump_generic_node (buffer, TREE_VALUE (arg), spc, flags, false);
arg = TREE_CHAIN (arg);
}
if (arg == void_list_node && !wrote_arg)
pp_string (buffer, "void");
else if (!arg && wrote_arg)
pp_string (buffer, ", ...");
pp_character (buffer, ')');
} | [
"static",
"void",
"dump_function_declaration",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"node",
",",
"int",
"spc",
",",
"int",
"flags",
")",
"{",
"bool",
"wrote_arg",
"=",
"false",
";",
"tree",
"arg",
";",
"pp_space",
"(",
"buffer",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"arg",
"=",
"TYPE_ARG_TYPES",
"(",
"node",
")",
";",
"while",
"(",
"arg",
"&&",
"arg",
"!=",
"void_list_node",
"&&",
"arg",
"!=",
"error_mark_node",
")",
"{",
"if",
"(",
"wrote_arg",
")",
"{",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"pp_space",
"(",
"buffer",
")",
";",
"}",
"wrote_arg",
"=",
"true",
";",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_VALUE",
"(",
"arg",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"arg",
"=",
"TREE_CHAIN",
"(",
"arg",
")",
";",
"}",
"if",
"(",
"arg",
"==",
"void_list_node",
"&&",
"!",
"wrote_arg",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"else",
"if",
"(",
"!",
"arg",
"&&",
"wrote_arg",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"}"
] | Dump a function declaration. | [
"Dump",
"a",
"function",
"declaration",
"."
] | [
"/* Print the argument types. */",
"/* Drop the trailing void_type_node if we had any previous argument. */",
"/* Properly dump vararg function types. */",
"/* Avoid printing any arg for unprototyped functions. */"
] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "node",
"type": "tree"
},
{
"param": "spc",
"type": "int"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_omp_clause | void | static void
dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
{
const char *name;
switch (OMP_CLAUSE_CODE (clause))
{
case OMP_CLAUSE_PRIVATE:
name = "private";
goto print_remap;
case OMP_CLAUSE_SHARED:
name = "shared";
goto print_remap;
case OMP_CLAUSE_FIRSTPRIVATE:
name = "firstprivate";
goto print_remap;
case OMP_CLAUSE_LASTPRIVATE:
name = "lastprivate";
goto print_remap;
case OMP_CLAUSE_COPYIN:
name = "copyin";
goto print_remap;
case OMP_CLAUSE_COPYPRIVATE:
name = "copyprivate";
goto print_remap;
print_remap:
pp_string (buffer, name);
pp_character (buffer, '(');
dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_REDUCTION:
pp_string (buffer, "reduction(");
pp_string (buffer, op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause)));
pp_character (buffer, ':');
dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_IF:
pp_string (buffer, "if(");
dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_NUM_THREADS:
pp_string (buffer, "num_threads(");
dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_NOWAIT:
pp_string (buffer, "nowait");
break;
case OMP_CLAUSE_ORDERED:
pp_string (buffer, "ordered");
break;
case OMP_CLAUSE_DEFAULT:
pp_string (buffer, "default(");
switch (OMP_CLAUSE_DEFAULT_KIND (clause))
{
case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
break;
case OMP_CLAUSE_DEFAULT_SHARED:
pp_string (buffer, "shared");
break;
case OMP_CLAUSE_DEFAULT_NONE:
pp_string (buffer, "none");
break;
case OMP_CLAUSE_DEFAULT_PRIVATE:
pp_string (buffer, "private");
break;
case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
pp_string (buffer, "firstprivate");
break;
default:
gcc_unreachable ();
}
pp_character (buffer, ')');
break;
case OMP_CLAUSE_SCHEDULE:
pp_string (buffer, "schedule(");
switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
{
case OMP_CLAUSE_SCHEDULE_STATIC:
pp_string (buffer, "static");
break;
case OMP_CLAUSE_SCHEDULE_DYNAMIC:
pp_string (buffer, "dynamic");
break;
case OMP_CLAUSE_SCHEDULE_GUIDED:
pp_string (buffer, "guided");
break;
case OMP_CLAUSE_SCHEDULE_RUNTIME:
pp_string (buffer, "runtime");
break;
case OMP_CLAUSE_SCHEDULE_AUTO:
pp_string (buffer, "auto");
break;
default:
gcc_unreachable ();
}
if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
{
pp_character (buffer, ',');
dump_generic_node (buffer,
OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
spc, flags, false);
}
pp_character (buffer, ')');
break;
case OMP_CLAUSE_UNTIED:
pp_string (buffer, "untied");
break;
case OMP_CLAUSE_COLLAPSE:
pp_string (buffer, "collapse(");
dump_generic_node (buffer,
OMP_CLAUSE_COLLAPSE_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_FINAL:
pp_string (buffer, "final(");
dump_generic_node (buffer, OMP_CLAUSE_FINAL_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_MERGEABLE:
pp_string (buffer, "mergeable");
break;
default:
/* Should never happen. */
dump_generic_node (buffer, clause, spc, flags, false);
break;
}
} | /* Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
dump_generic_node. */ | Dump OpenMP clause CLAUSE. BUFFER, CLAUSE, SPC and FLAGS are as in
dump_generic_node. | [
"Dump",
"OpenMP",
"clause",
"CLAUSE",
".",
"BUFFER",
"CLAUSE",
"SPC",
"and",
"FLAGS",
"are",
"as",
"in",
"dump_generic_node",
"."
] | static void
dump_omp_clause (pretty_printer *buffer, tree clause, int spc, int flags)
{
const char *name;
switch (OMP_CLAUSE_CODE (clause))
{
case OMP_CLAUSE_PRIVATE:
name = "private";
goto print_remap;
case OMP_CLAUSE_SHARED:
name = "shared";
goto print_remap;
case OMP_CLAUSE_FIRSTPRIVATE:
name = "firstprivate";
goto print_remap;
case OMP_CLAUSE_LASTPRIVATE:
name = "lastprivate";
goto print_remap;
case OMP_CLAUSE_COPYIN:
name = "copyin";
goto print_remap;
case OMP_CLAUSE_COPYPRIVATE:
name = "copyprivate";
goto print_remap;
print_remap:
pp_string (buffer, name);
pp_character (buffer, '(');
dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_REDUCTION:
pp_string (buffer, "reduction(");
pp_string (buffer, op_symbol_code (OMP_CLAUSE_REDUCTION_CODE (clause)));
pp_character (buffer, ':');
dump_generic_node (buffer, OMP_CLAUSE_DECL (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_IF:
pp_string (buffer, "if(");
dump_generic_node (buffer, OMP_CLAUSE_IF_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_NUM_THREADS:
pp_string (buffer, "num_threads(");
dump_generic_node (buffer, OMP_CLAUSE_NUM_THREADS_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_NOWAIT:
pp_string (buffer, "nowait");
break;
case OMP_CLAUSE_ORDERED:
pp_string (buffer, "ordered");
break;
case OMP_CLAUSE_DEFAULT:
pp_string (buffer, "default(");
switch (OMP_CLAUSE_DEFAULT_KIND (clause))
{
case OMP_CLAUSE_DEFAULT_UNSPECIFIED:
break;
case OMP_CLAUSE_DEFAULT_SHARED:
pp_string (buffer, "shared");
break;
case OMP_CLAUSE_DEFAULT_NONE:
pp_string (buffer, "none");
break;
case OMP_CLAUSE_DEFAULT_PRIVATE:
pp_string (buffer, "private");
break;
case OMP_CLAUSE_DEFAULT_FIRSTPRIVATE:
pp_string (buffer, "firstprivate");
break;
default:
gcc_unreachable ();
}
pp_character (buffer, ')');
break;
case OMP_CLAUSE_SCHEDULE:
pp_string (buffer, "schedule(");
switch (OMP_CLAUSE_SCHEDULE_KIND (clause))
{
case OMP_CLAUSE_SCHEDULE_STATIC:
pp_string (buffer, "static");
break;
case OMP_CLAUSE_SCHEDULE_DYNAMIC:
pp_string (buffer, "dynamic");
break;
case OMP_CLAUSE_SCHEDULE_GUIDED:
pp_string (buffer, "guided");
break;
case OMP_CLAUSE_SCHEDULE_RUNTIME:
pp_string (buffer, "runtime");
break;
case OMP_CLAUSE_SCHEDULE_AUTO:
pp_string (buffer, "auto");
break;
default:
gcc_unreachable ();
}
if (OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause))
{
pp_character (buffer, ',');
dump_generic_node (buffer,
OMP_CLAUSE_SCHEDULE_CHUNK_EXPR (clause),
spc, flags, false);
}
pp_character (buffer, ')');
break;
case OMP_CLAUSE_UNTIED:
pp_string (buffer, "untied");
break;
case OMP_CLAUSE_COLLAPSE:
pp_string (buffer, "collapse(");
dump_generic_node (buffer,
OMP_CLAUSE_COLLAPSE_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_FINAL:
pp_string (buffer, "final(");
dump_generic_node (buffer, OMP_CLAUSE_FINAL_EXPR (clause),
spc, flags, false);
pp_character (buffer, ')');
break;
case OMP_CLAUSE_MERGEABLE:
pp_string (buffer, "mergeable");
break;
default:
dump_generic_node (buffer, clause, spc, flags, false);
break;
}
} | [
"static",
"void",
"dump_omp_clause",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"clause",
",",
"int",
"spc",
",",
"int",
"flags",
")",
"{",
"const",
"char",
"*",
"name",
";",
"switch",
"(",
"OMP_CLAUSE_CODE",
"(",
"clause",
")",
")",
"{",
"case",
"OMP_CLAUSE_PRIVATE",
":",
"name",
"=",
"\"",
"\"",
";",
"goto",
"print_remap",
";",
"case",
"OMP_CLAUSE_SHARED",
":",
"name",
"=",
"\"",
"\"",
";",
"goto",
"print_remap",
";",
"case",
"OMP_CLAUSE_FIRSTPRIVATE",
":",
"name",
"=",
"\"",
"\"",
";",
"goto",
"print_remap",
";",
"case",
"OMP_CLAUSE_LASTPRIVATE",
":",
"name",
"=",
"\"",
"\"",
";",
"goto",
"print_remap",
";",
"case",
"OMP_CLAUSE_COPYIN",
":",
"name",
"=",
"\"",
"\"",
";",
"goto",
"print_remap",
";",
"case",
"OMP_CLAUSE_COPYPRIVATE",
":",
"name",
"=",
"\"",
"\"",
";",
"goto",
"print_remap",
";",
"print_remap",
":",
"pp_string",
"(",
"buffer",
",",
"name",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"OMP_CLAUSE_DECL",
"(",
"clause",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_REDUCTION",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"pp_string",
"(",
"buffer",
",",
"op_symbol_code",
"(",
"OMP_CLAUSE_REDUCTION_CODE",
"(",
"clause",
")",
")",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"OMP_CLAUSE_DECL",
"(",
"clause",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_IF",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"OMP_CLAUSE_IF_EXPR",
"(",
"clause",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_NUM_THREADS",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"OMP_CLAUSE_NUM_THREADS_EXPR",
"(",
"clause",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_NOWAIT",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_ORDERED",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_DEFAULT",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"switch",
"(",
"OMP_CLAUSE_DEFAULT_KIND",
"(",
"clause",
")",
")",
"{",
"case",
"OMP_CLAUSE_DEFAULT_UNSPECIFIED",
":",
"break",
";",
"case",
"OMP_CLAUSE_DEFAULT_SHARED",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_DEFAULT_NONE",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_DEFAULT_PRIVATE",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_DEFAULT_FIRSTPRIVATE",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_SCHEDULE",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"switch",
"(",
"OMP_CLAUSE_SCHEDULE_KIND",
"(",
"clause",
")",
")",
"{",
"case",
"OMP_CLAUSE_SCHEDULE_STATIC",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_SCHEDULE_DYNAMIC",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_SCHEDULE_GUIDED",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_SCHEDULE_RUNTIME",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_SCHEDULE_AUTO",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"if",
"(",
"OMP_CLAUSE_SCHEDULE_CHUNK_EXPR",
"(",
"clause",
")",
")",
"{",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"OMP_CLAUSE_SCHEDULE_CHUNK_EXPR",
"(",
"clause",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"}",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_UNTIED",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_COLLAPSE",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"OMP_CLAUSE_COLLAPSE_EXPR",
"(",
"clause",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_FINAL",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"OMP_CLAUSE_FINAL_EXPR",
"(",
"clause",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"break",
";",
"case",
"OMP_CLAUSE_MERGEABLE",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"break",
";",
"default",
":",
"dump_generic_node",
"(",
"buffer",
",",
"clause",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"break",
";",
"}",
"}"
] | Dump OpenMP clause CLAUSE. | [
"Dump",
"OpenMP",
"clause",
"CLAUSE",
"."
] | [
"/* Should never happen. */"
] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "clause",
"type": "tree"
},
{
"param": "spc",
"type": "int"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clause",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_omp_clauses | void | void
dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
{
if (clause == NULL)
return;
pp_space (buffer);
while (1)
{
dump_omp_clause (buffer, clause, spc, flags);
clause = OMP_CLAUSE_CHAIN (clause);
if (clause == NULL)
return;
pp_space (buffer);
}
} | /* Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
dump_generic_node. */ | Dump the list of OpenMP clauses. BUFFER, SPC and FLAGS are as in
dump_generic_node. | [
"Dump",
"the",
"list",
"of",
"OpenMP",
"clauses",
".",
"BUFFER",
"SPC",
"and",
"FLAGS",
"are",
"as",
"in",
"dump_generic_node",
"."
] | void
dump_omp_clauses (pretty_printer *buffer, tree clause, int spc, int flags)
{
if (clause == NULL)
return;
pp_space (buffer);
while (1)
{
dump_omp_clause (buffer, clause, spc, flags);
clause = OMP_CLAUSE_CHAIN (clause);
if (clause == NULL)
return;
pp_space (buffer);
}
} | [
"void",
"dump_omp_clauses",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"clause",
",",
"int",
"spc",
",",
"int",
"flags",
")",
"{",
"if",
"(",
"clause",
"==",
"NULL",
")",
"return",
";",
"pp_space",
"(",
"buffer",
")",
";",
"while",
"(",
"1",
")",
"{",
"dump_omp_clause",
"(",
"buffer",
",",
"clause",
",",
"spc",
",",
"flags",
")",
";",
"clause",
"=",
"OMP_CLAUSE_CHAIN",
"(",
"clause",
")",
";",
"if",
"(",
"clause",
"==",
"NULL",
")",
"return",
";",
"pp_space",
"(",
"buffer",
")",
";",
"}",
"}"
] | Dump the list of OpenMP clauses. | [
"Dump",
"the",
"list",
"of",
"OpenMP",
"clauses",
"."
] | [] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "clause",
"type": "tree"
},
{
"param": "spc",
"type": "int"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "clause",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_location | void | static void
dump_location (pretty_printer *buffer, location_t loc)
{
expanded_location xloc = expand_location (loc);
pp_character (buffer, '[');
if (xloc.file)
{
pp_string (buffer, xloc.file);
pp_string (buffer, " : ");
}
pp_decimal_int (buffer, xloc.line);
pp_string (buffer, "] ");
} | /* Dump location LOC to BUFFER. */ | Dump location LOC to BUFFER. | [
"Dump",
"location",
"LOC",
"to",
"BUFFER",
"."
] | static void
dump_location (pretty_printer *buffer, location_t loc)
{
expanded_location xloc = expand_location (loc);
pp_character (buffer, '[');
if (xloc.file)
{
pp_string (buffer, xloc.file);
pp_string (buffer, " : ");
}
pp_decimal_int (buffer, xloc.line);
pp_string (buffer, "] ");
} | [
"static",
"void",
"dump_location",
"(",
"pretty_printer",
"*",
"buffer",
",",
"location_t",
"loc",
")",
"{",
"expanded_location",
"xloc",
"=",
"expand_location",
"(",
"loc",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"if",
"(",
"xloc",
".",
"file",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"xloc",
".",
"file",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}",
"pp_decimal_int",
"(",
"buffer",
",",
"xloc",
".",
"line",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}"
] | Dump location LOC to BUFFER. | [
"Dump",
"location",
"LOC",
"to",
"BUFFER",
"."
] | [] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "loc",
"type": "location_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "loc",
"type": "location_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_block_node | void | static void
dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
{
tree t;
pp_printf (buffer, "BLOCK #%d ", BLOCK_NUMBER (block));
if (flags & TDF_ADDRESS)
pp_printf (buffer, "[%p] ", (void *) block);
if (BLOCK_ABSTRACT (block))
pp_string (buffer, "[abstract] ");
if (TREE_ASM_WRITTEN (block))
pp_string (buffer, "[written] ");
if (flags & TDF_SLIM)
return;
if (BLOCK_SOURCE_LOCATION (block))
dump_location (buffer, BLOCK_SOURCE_LOCATION (block));
newline_and_indent (buffer, spc + 2);
if (BLOCK_SUPERCONTEXT (block))
{
pp_string (buffer, "SUPERCONTEXT: ");
dump_generic_node (buffer, BLOCK_SUPERCONTEXT (block), 0,
flags | TDF_SLIM, false);
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_SUBBLOCKS (block))
{
pp_string (buffer, "SUBBLOCKS: ");
for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_CHAIN (block))
{
pp_string (buffer, "SIBLINGS: ");
for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_VARS (block))
{
pp_string (buffer, "VARS: ");
for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (VEC_length (tree, BLOCK_NONLOCALIZED_VARS (block)) > 0)
{
unsigned i;
VEC(tree,gc) *nlv = BLOCK_NONLOCALIZED_VARS (block);
pp_string (buffer, "NONLOCALIZED_VARS: ");
FOR_EACH_VEC_ELT (tree, nlv, i, t)
{
dump_generic_node (buffer, t, 0, flags, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_ABSTRACT_ORIGIN (block))
{
pp_string (buffer, "ABSTRACT_ORIGIN: ");
dump_generic_node (buffer, BLOCK_ABSTRACT_ORIGIN (block), 0,
flags | TDF_SLIM, false);
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_FRAGMENT_ORIGIN (block))
{
pp_string (buffer, "FRAGMENT_ORIGIN: ");
dump_generic_node (buffer, BLOCK_FRAGMENT_ORIGIN (block), 0,
flags | TDF_SLIM, false);
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_FRAGMENT_CHAIN (block))
{
pp_string (buffer, "FRAGMENT_CHAIN: ");
for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
} | /* Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
dump_generic_node. */ | Dump lexical block BLOCK. BUFFER, SPC and FLAGS are as in
dump_generic_node. | [
"Dump",
"lexical",
"block",
"BLOCK",
".",
"BUFFER",
"SPC",
"and",
"FLAGS",
"are",
"as",
"in",
"dump_generic_node",
"."
] | static void
dump_block_node (pretty_printer *buffer, tree block, int spc, int flags)
{
tree t;
pp_printf (buffer, "BLOCK #%d ", BLOCK_NUMBER (block));
if (flags & TDF_ADDRESS)
pp_printf (buffer, "[%p] ", (void *) block);
if (BLOCK_ABSTRACT (block))
pp_string (buffer, "[abstract] ");
if (TREE_ASM_WRITTEN (block))
pp_string (buffer, "[written] ");
if (flags & TDF_SLIM)
return;
if (BLOCK_SOURCE_LOCATION (block))
dump_location (buffer, BLOCK_SOURCE_LOCATION (block));
newline_and_indent (buffer, spc + 2);
if (BLOCK_SUPERCONTEXT (block))
{
pp_string (buffer, "SUPERCONTEXT: ");
dump_generic_node (buffer, BLOCK_SUPERCONTEXT (block), 0,
flags | TDF_SLIM, false);
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_SUBBLOCKS (block))
{
pp_string (buffer, "SUBBLOCKS: ");
for (t = BLOCK_SUBBLOCKS (block); t; t = BLOCK_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_CHAIN (block))
{
pp_string (buffer, "SIBLINGS: ");
for (t = BLOCK_CHAIN (block); t; t = BLOCK_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_VARS (block))
{
pp_string (buffer, "VARS: ");
for (t = BLOCK_VARS (block); t; t = TREE_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (VEC_length (tree, BLOCK_NONLOCALIZED_VARS (block)) > 0)
{
unsigned i;
VEC(tree,gc) *nlv = BLOCK_NONLOCALIZED_VARS (block);
pp_string (buffer, "NONLOCALIZED_VARS: ");
FOR_EACH_VEC_ELT (tree, nlv, i, t)
{
dump_generic_node (buffer, t, 0, flags, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_ABSTRACT_ORIGIN (block))
{
pp_string (buffer, "ABSTRACT_ORIGIN: ");
dump_generic_node (buffer, BLOCK_ABSTRACT_ORIGIN (block), 0,
flags | TDF_SLIM, false);
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_FRAGMENT_ORIGIN (block))
{
pp_string (buffer, "FRAGMENT_ORIGIN: ");
dump_generic_node (buffer, BLOCK_FRAGMENT_ORIGIN (block), 0,
flags | TDF_SLIM, false);
newline_and_indent (buffer, spc + 2);
}
if (BLOCK_FRAGMENT_CHAIN (block))
{
pp_string (buffer, "FRAGMENT_CHAIN: ");
for (t = BLOCK_FRAGMENT_CHAIN (block); t; t = BLOCK_FRAGMENT_CHAIN (t))
{
dump_generic_node (buffer, t, 0, flags | TDF_SLIM, false);
pp_string (buffer, " ");
}
newline_and_indent (buffer, spc + 2);
}
} | [
"static",
"void",
"dump_block_node",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"block",
",",
"int",
"spc",
",",
"int",
"flags",
")",
"{",
"tree",
"t",
";",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"BLOCK_NUMBER",
"(",
"block",
")",
")",
";",
"if",
"(",
"flags",
"&",
"TDF_ADDRESS",
")",
"pp_printf",
"(",
"buffer",
",",
"\"",
"\"",
",",
"(",
"void",
"*",
")",
"block",
")",
";",
"if",
"(",
"BLOCK_ABSTRACT",
"(",
"block",
")",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"TREE_ASM_WRITTEN",
"(",
"block",
")",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"flags",
"&",
"TDF_SLIM",
")",
"return",
";",
"if",
"(",
"BLOCK_SOURCE_LOCATION",
"(",
"block",
")",
")",
"dump_location",
"(",
"buffer",
",",
"BLOCK_SOURCE_LOCATION",
"(",
"block",
")",
")",
";",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"if",
"(",
"BLOCK_SUPERCONTEXT",
"(",
"block",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"BLOCK_SUPERCONTEXT",
"(",
"block",
")",
",",
"0",
",",
"flags",
"|",
"TDF_SLIM",
",",
"false",
")",
";",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"if",
"(",
"BLOCK_SUBBLOCKS",
"(",
"block",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"for",
"(",
"t",
"=",
"BLOCK_SUBBLOCKS",
"(",
"block",
")",
";",
"t",
";",
"t",
"=",
"BLOCK_CHAIN",
"(",
"t",
")",
")",
"{",
"dump_generic_node",
"(",
"buffer",
",",
"t",
",",
"0",
",",
"flags",
"|",
"TDF_SLIM",
",",
"false",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"if",
"(",
"BLOCK_CHAIN",
"(",
"block",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"for",
"(",
"t",
"=",
"BLOCK_CHAIN",
"(",
"block",
")",
";",
"t",
";",
"t",
"=",
"BLOCK_CHAIN",
"(",
"t",
")",
")",
"{",
"dump_generic_node",
"(",
"buffer",
",",
"t",
",",
"0",
",",
"flags",
"|",
"TDF_SLIM",
",",
"false",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"if",
"(",
"BLOCK_VARS",
"(",
"block",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"for",
"(",
"t",
"=",
"BLOCK_VARS",
"(",
"block",
")",
";",
"t",
";",
"t",
"=",
"TREE_CHAIN",
"(",
"t",
")",
")",
"{",
"dump_generic_node",
"(",
"buffer",
",",
"t",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"if",
"(",
"VEC_length",
"(",
"tree",
",",
"BLOCK_NONLOCALIZED_VARS",
"(",
"block",
")",
")",
">",
"0",
")",
"{",
"unsigned",
"i",
";",
"VEC",
"(",
"tree",
",",
"gc",
")",
"*",
"nlv",
"=",
"BLOCK_NONLOCALIZED_VARS",
"(",
"block",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"FOR_EACH_VEC_ELT",
"(",
"tree",
",",
"nlv",
",",
"i",
",",
"t",
")",
"",
"{",
"dump_generic_node",
"(",
"buffer",
",",
"t",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"if",
"(",
"BLOCK_ABSTRACT_ORIGIN",
"(",
"block",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"BLOCK_ABSTRACT_ORIGIN",
"(",
"block",
")",
",",
"0",
",",
"flags",
"|",
"TDF_SLIM",
",",
"false",
")",
";",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"if",
"(",
"BLOCK_FRAGMENT_ORIGIN",
"(",
"block",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"BLOCK_FRAGMENT_ORIGIN",
"(",
"block",
")",
",",
"0",
",",
"flags",
"|",
"TDF_SLIM",
",",
"false",
")",
";",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"if",
"(",
"BLOCK_FRAGMENT_CHAIN",
"(",
"block",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"for",
"(",
"t",
"=",
"BLOCK_FRAGMENT_CHAIN",
"(",
"block",
")",
";",
"t",
";",
"t",
"=",
"BLOCK_FRAGMENT_CHAIN",
"(",
"t",
")",
")",
"{",
"dump_generic_node",
"(",
"buffer",
",",
"t",
",",
"0",
",",
"flags",
"|",
"TDF_SLIM",
",",
"false",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"}",
"newline_and_indent",
"(",
"buffer",
",",
"spc",
"+",
"2",
")",
";",
"}",
"}"
] | Dump lexical block BLOCK. | [
"Dump",
"lexical",
"block",
"BLOCK",
"."
] | [] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "block",
"type": "tree"
},
{
"param": "spc",
"type": "int"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | print_declaration | void | void
print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
{
INDENT (spc);
if (TREE_CODE (t) == TYPE_DECL)
pp_string (buffer, "typedef ");
if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
pp_string (buffer, "register ");
if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
pp_string (buffer, "extern ");
else if (TREE_STATIC (t))
pp_string (buffer, "static ");
/* Print the type and name. */
if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
{
tree tmp;
/* Print array's type. */
tmp = TREE_TYPE (t);
while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
tmp = TREE_TYPE (tmp);
dump_generic_node (buffer, TREE_TYPE (tmp), spc, flags, false);
/* Print variable's name. */
pp_space (buffer);
dump_generic_node (buffer, t, spc, flags, false);
/* Print the dimensions. */
tmp = TREE_TYPE (t);
while (TREE_CODE (tmp) == ARRAY_TYPE)
{
dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
tmp = TREE_TYPE (tmp);
}
}
else if (TREE_CODE (t) == FUNCTION_DECL)
{
dump_generic_node (buffer, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
pp_space (buffer);
dump_decl_name (buffer, t, flags);
dump_function_declaration (buffer, TREE_TYPE (t), spc, flags);
}
else
{
/* Print type declaration. */
dump_generic_node (buffer, TREE_TYPE (t), spc, flags, false);
/* Print variable's name. */
pp_space (buffer);
dump_generic_node (buffer, t, spc, flags, false);
}
if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
{
pp_string (buffer, " __asm__ ");
pp_character (buffer, '(');
dump_generic_node (buffer, DECL_ASSEMBLER_NAME (t), spc, flags, false);
pp_character (buffer, ')');
}
/* The initial value of a function serves to determine whether the function
is declared or defined. So the following does not apply to function
nodes. */
if (TREE_CODE (t) != FUNCTION_DECL)
{
/* Print the initial value. */
if (DECL_INITIAL (t))
{
pp_space (buffer);
pp_character (buffer, '=');
pp_space (buffer);
dump_generic_node (buffer, DECL_INITIAL (t), spc, flags, false);
}
}
if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
{
pp_string (buffer, " [value-expr: ");
dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
pp_character (buffer, ']');
}
pp_character (buffer, ';');
} | /* Print the declaration of a variable. */ | Print the declaration of a variable. | [
"Print",
"the",
"declaration",
"of",
"a",
"variable",
"."
] | void
print_declaration (pretty_printer *buffer, tree t, int spc, int flags)
{
INDENT (spc);
if (TREE_CODE (t) == TYPE_DECL)
pp_string (buffer, "typedef ");
if (CODE_CONTAINS_STRUCT (TREE_CODE (t), TS_DECL_WRTL) && DECL_REGISTER (t))
pp_string (buffer, "register ");
if (TREE_PUBLIC (t) && DECL_EXTERNAL (t))
pp_string (buffer, "extern ");
else if (TREE_STATIC (t))
pp_string (buffer, "static ");
if (TREE_TYPE (t) && TREE_CODE (TREE_TYPE (t)) == ARRAY_TYPE)
{
tree tmp;
tmp = TREE_TYPE (t);
while (TREE_CODE (TREE_TYPE (tmp)) == ARRAY_TYPE)
tmp = TREE_TYPE (tmp);
dump_generic_node (buffer, TREE_TYPE (tmp), spc, flags, false);
pp_space (buffer);
dump_generic_node (buffer, t, spc, flags, false);
tmp = TREE_TYPE (t);
while (TREE_CODE (tmp) == ARRAY_TYPE)
{
dump_array_domain (buffer, TYPE_DOMAIN (tmp), spc, flags);
tmp = TREE_TYPE (tmp);
}
}
else if (TREE_CODE (t) == FUNCTION_DECL)
{
dump_generic_node (buffer, TREE_TYPE (TREE_TYPE (t)), spc, flags, false);
pp_space (buffer);
dump_decl_name (buffer, t, flags);
dump_function_declaration (buffer, TREE_TYPE (t), spc, flags);
}
else
{
dump_generic_node (buffer, TREE_TYPE (t), spc, flags, false);
pp_space (buffer);
dump_generic_node (buffer, t, spc, flags, false);
}
if (TREE_CODE (t) == VAR_DECL && DECL_HARD_REGISTER (t))
{
pp_string (buffer, " __asm__ ");
pp_character (buffer, '(');
dump_generic_node (buffer, DECL_ASSEMBLER_NAME (t), spc, flags, false);
pp_character (buffer, ')');
}
if (TREE_CODE (t) != FUNCTION_DECL)
{
if (DECL_INITIAL (t))
{
pp_space (buffer);
pp_character (buffer, '=');
pp_space (buffer);
dump_generic_node (buffer, DECL_INITIAL (t), spc, flags, false);
}
}
if (TREE_CODE (t) == VAR_DECL && DECL_HAS_VALUE_EXPR_P (t))
{
pp_string (buffer, " [value-expr: ");
dump_generic_node (buffer, DECL_VALUE_EXPR (t), spc, flags, false);
pp_character (buffer, ']');
}
pp_character (buffer, ';');
} | [
"void",
"print_declaration",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"t",
",",
"int",
"spc",
",",
"int",
"flags",
")",
"{",
"INDENT",
"(",
"spc",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"TYPE_DECL",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"CODE_CONTAINS_STRUCT",
"(",
"TREE_CODE",
"(",
"t",
")",
",",
"TS_DECL_WRTL",
")",
"&&",
"DECL_REGISTER",
"(",
"t",
")",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"TREE_PUBLIC",
"(",
"t",
")",
"&&",
"DECL_EXTERNAL",
"(",
"t",
")",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"else",
"if",
"(",
"TREE_STATIC",
"(",
"t",
")",
")",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"TREE_TYPE",
"(",
"t",
")",
"&&",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
"==",
"ARRAY_TYPE",
")",
"{",
"tree",
"tmp",
";",
"tmp",
"=",
"TREE_TYPE",
"(",
"t",
")",
";",
"while",
"(",
"TREE_CODE",
"(",
"TREE_TYPE",
"(",
"tmp",
")",
")",
"==",
"ARRAY_TYPE",
")",
"tmp",
"=",
"TREE_TYPE",
"(",
"tmp",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_TYPE",
"(",
"tmp",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_space",
"(",
"buffer",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"t",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"tmp",
"=",
"TREE_TYPE",
"(",
"t",
")",
";",
"while",
"(",
"TREE_CODE",
"(",
"tmp",
")",
"==",
"ARRAY_TYPE",
")",
"{",
"dump_array_domain",
"(",
"buffer",
",",
"TYPE_DOMAIN",
"(",
"tmp",
")",
",",
"spc",
",",
"flags",
")",
";",
"tmp",
"=",
"TREE_TYPE",
"(",
"tmp",
")",
";",
"}",
"}",
"else",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"FUNCTION_DECL",
")",
"{",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_TYPE",
"(",
"TREE_TYPE",
"(",
"t",
")",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_space",
"(",
"buffer",
")",
";",
"dump_decl_name",
"(",
"buffer",
",",
"t",
",",
"flags",
")",
";",
"dump_function_declaration",
"(",
"buffer",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"spc",
",",
"flags",
")",
";",
"}",
"else",
"{",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_TYPE",
"(",
"t",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_space",
"(",
"buffer",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"t",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"VAR_DECL",
"&&",
"DECL_HARD_REGISTER",
"(",
"t",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"DECL_ASSEMBLER_NAME",
"(",
"t",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"}",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"!=",
"FUNCTION_DECL",
")",
"{",
"if",
"(",
"DECL_INITIAL",
"(",
"t",
")",
")",
"{",
"pp_space",
"(",
"buffer",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"pp_space",
"(",
"buffer",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"DECL_INITIAL",
"(",
"t",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"}",
"}",
"if",
"(",
"TREE_CODE",
"(",
"t",
")",
"==",
"VAR_DECL",
"&&",
"DECL_HAS_VALUE_EXPR_P",
"(",
"t",
")",
")",
"{",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"DECL_VALUE_EXPR",
"(",
"t",
")",
",",
"spc",
",",
"flags",
",",
"false",
")",
";",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"}",
"pp_character",
"(",
"buffer",
",",
"'",
"'",
")",
";",
"}"
] | Print the declaration of a variable. | [
"Print",
"the",
"declaration",
"of",
"a",
"variable",
"."
] | [
"/* Print the type and name. */",
"/* Print array's type. */",
"/* Print variable's name. */",
"/* Print the dimensions. */",
"/* Print type declaration. */",
"/* Print variable's name. */",
"/* The initial value of a function serves to determine whether the function\n is declared or defined. So the following does not apply to function\n nodes. */",
"/* Print the initial value. */"
] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "t",
"type": "tree"
},
{
"param": "spc",
"type": "int"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "t",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "spc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | op_prio | int | int
op_prio (const_tree op)
{
enum tree_code code;
if (op == NULL)
return 9999;
code = TREE_CODE (op);
if (code == SAVE_EXPR || code == NON_LVALUE_EXPR)
return op_prio (TREE_OPERAND (op, 0));
return op_code_prio (code);
} | /* Return the priority of the operator OP. */ | Return the priority of the operator OP. | [
"Return",
"the",
"priority",
"of",
"the",
"operator",
"OP",
"."
] | int
op_prio (const_tree op)
{
enum tree_code code;
if (op == NULL)
return 9999;
code = TREE_CODE (op);
if (code == SAVE_EXPR || code == NON_LVALUE_EXPR)
return op_prio (TREE_OPERAND (op, 0));
return op_code_prio (code);
} | [
"int",
"op_prio",
"(",
"const_tree",
"op",
")",
"{",
"enum",
"tree_code",
"code",
";",
"if",
"(",
"op",
"==",
"NULL",
")",
"return",
"9999",
";",
"code",
"=",
"TREE_CODE",
"(",
"op",
")",
";",
"if",
"(",
"code",
"==",
"SAVE_EXPR",
"||",
"code",
"==",
"NON_LVALUE_EXPR",
")",
"return",
"op_prio",
"(",
"TREE_OPERAND",
"(",
"op",
",",
"0",
")",
")",
";",
"return",
"op_code_prio",
"(",
"code",
")",
";",
"}"
] | Return the priority of the operator OP. | [
"Return",
"the",
"priority",
"of",
"the",
"operator",
"OP",
"."
] | [] | [
{
"param": "op",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | op_symbol_code | char | const char *
op_symbol_code (enum tree_code code)
{
switch (code)
{
case MODIFY_EXPR:
return "=";
case TRUTH_OR_EXPR:
case TRUTH_ORIF_EXPR:
return "||";
case TRUTH_AND_EXPR:
case TRUTH_ANDIF_EXPR:
return "&&";
case BIT_IOR_EXPR:
return "|";
case TRUTH_XOR_EXPR:
case BIT_XOR_EXPR:
return "^";
case ADDR_EXPR:
case BIT_AND_EXPR:
return "&";
case ORDERED_EXPR:
return "ord";
case UNORDERED_EXPR:
return "unord";
case EQ_EXPR:
return "==";
case UNEQ_EXPR:
return "u==";
case NE_EXPR:
return "!=";
case LT_EXPR:
return "<";
case UNLT_EXPR:
return "u<";
case LE_EXPR:
return "<=";
case UNLE_EXPR:
return "u<=";
case GT_EXPR:
return ">";
case UNGT_EXPR:
return "u>";
case GE_EXPR:
return ">=";
case UNGE_EXPR:
return "u>=";
case LTGT_EXPR:
return "<>";
case LSHIFT_EXPR:
return "<<";
case RSHIFT_EXPR:
return ">>";
case LROTATE_EXPR:
return "r<<";
case RROTATE_EXPR:
return "r>>";
case VEC_LSHIFT_EXPR:
return "v<<";
case VEC_RSHIFT_EXPR:
return "v>>";
case WIDEN_LSHIFT_EXPR:
return "w<<";
case POINTER_PLUS_EXPR:
return "+";
case PLUS_EXPR:
return "+";
case REDUC_PLUS_EXPR:
return "r+";
case WIDEN_SUM_EXPR:
return "w+";
case WIDEN_MULT_EXPR:
return "w*";
case NEGATE_EXPR:
case MINUS_EXPR:
return "-";
case BIT_NOT_EXPR:
return "~";
case TRUTH_NOT_EXPR:
return "!";
case MULT_EXPR:
case INDIRECT_REF:
return "*";
case TRUNC_DIV_EXPR:
case RDIV_EXPR:
return "/";
case CEIL_DIV_EXPR:
return "/[cl]";
case FLOOR_DIV_EXPR:
return "/[fl]";
case ROUND_DIV_EXPR:
return "/[rd]";
case EXACT_DIV_EXPR:
return "/[ex]";
case TRUNC_MOD_EXPR:
return "%";
case CEIL_MOD_EXPR:
return "%[cl]";
case FLOOR_MOD_EXPR:
return "%[fl]";
case ROUND_MOD_EXPR:
return "%[rd]";
case PREDECREMENT_EXPR:
return " --";
case PREINCREMENT_EXPR:
return " ++";
case POSTDECREMENT_EXPR:
return "-- ";
case POSTINCREMENT_EXPR:
return "++ ";
case MAX_EXPR:
return "max";
case MIN_EXPR:
return "min";
default:
return "<<< ??? >>>";
}
} | /* Return the symbol associated with operator CODE. */ | Return the symbol associated with operator CODE. | [
"Return",
"the",
"symbol",
"associated",
"with",
"operator",
"CODE",
"."
] | const char *
op_symbol_code (enum tree_code code)
{
switch (code)
{
case MODIFY_EXPR:
return "=";
case TRUTH_OR_EXPR:
case TRUTH_ORIF_EXPR:
return "||";
case TRUTH_AND_EXPR:
case TRUTH_ANDIF_EXPR:
return "&&";
case BIT_IOR_EXPR:
return "|";
case TRUTH_XOR_EXPR:
case BIT_XOR_EXPR:
return "^";
case ADDR_EXPR:
case BIT_AND_EXPR:
return "&";
case ORDERED_EXPR:
return "ord";
case UNORDERED_EXPR:
return "unord";
case EQ_EXPR:
return "==";
case UNEQ_EXPR:
return "u==";
case NE_EXPR:
return "!=";
case LT_EXPR:
return "<";
case UNLT_EXPR:
return "u<";
case LE_EXPR:
return "<=";
case UNLE_EXPR:
return "u<=";
case GT_EXPR:
return ">";
case UNGT_EXPR:
return "u>";
case GE_EXPR:
return ">=";
case UNGE_EXPR:
return "u>=";
case LTGT_EXPR:
return "<>";
case LSHIFT_EXPR:
return "<<";
case RSHIFT_EXPR:
return ">>";
case LROTATE_EXPR:
return "r<<";
case RROTATE_EXPR:
return "r>>";
case VEC_LSHIFT_EXPR:
return "v<<";
case VEC_RSHIFT_EXPR:
return "v>>";
case WIDEN_LSHIFT_EXPR:
return "w<<";
case POINTER_PLUS_EXPR:
return "+";
case PLUS_EXPR:
return "+";
case REDUC_PLUS_EXPR:
return "r+";
case WIDEN_SUM_EXPR:
return "w+";
case WIDEN_MULT_EXPR:
return "w*";
case NEGATE_EXPR:
case MINUS_EXPR:
return "-";
case BIT_NOT_EXPR:
return "~";
case TRUTH_NOT_EXPR:
return "!";
case MULT_EXPR:
case INDIRECT_REF:
return "*";
case TRUNC_DIV_EXPR:
case RDIV_EXPR:
return "/";
case CEIL_DIV_EXPR:
return "/[cl]";
case FLOOR_DIV_EXPR:
return "/[fl]";
case ROUND_DIV_EXPR:
return "/[rd]";
case EXACT_DIV_EXPR:
return "/[ex]";
case TRUNC_MOD_EXPR:
return "%";
case CEIL_MOD_EXPR:
return "%[cl]";
case FLOOR_MOD_EXPR:
return "%[fl]";
case ROUND_MOD_EXPR:
return "%[rd]";
case PREDECREMENT_EXPR:
return " --";
case PREINCREMENT_EXPR:
return " ++";
case POSTDECREMENT_EXPR:
return "-- ";
case POSTINCREMENT_EXPR:
return "++ ";
case MAX_EXPR:
return "max";
case MIN_EXPR:
return "min";
default:
return "<<< ??? >>>";
}
} | [
"const",
"char",
"*",
"op_symbol_code",
"(",
"enum",
"tree_code",
"code",
")",
"{",
"switch",
"(",
"code",
")",
"{",
"case",
"MODIFY_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"TRUTH_OR_EXPR",
":",
"case",
"TRUTH_ORIF_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"TRUTH_AND_EXPR",
":",
"case",
"TRUTH_ANDIF_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"BIT_IOR_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"TRUTH_XOR_EXPR",
":",
"case",
"BIT_XOR_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"ADDR_EXPR",
":",
"case",
"BIT_AND_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"ORDERED_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"UNORDERED_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"EQ_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"UNEQ_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"NE_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"LT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"UNLT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"LE_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"UNLE_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"GT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"UNGT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"GE_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"UNGE_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"LTGT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"LSHIFT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"RSHIFT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"LROTATE_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"RROTATE_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"VEC_LSHIFT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"VEC_RSHIFT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"WIDEN_LSHIFT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"POINTER_PLUS_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"PLUS_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"REDUC_PLUS_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"WIDEN_SUM_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"WIDEN_MULT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"NEGATE_EXPR",
":",
"case",
"MINUS_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"BIT_NOT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"TRUTH_NOT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"MULT_EXPR",
":",
"case",
"INDIRECT_REF",
":",
"return",
"\"",
"\"",
";",
"case",
"TRUNC_DIV_EXPR",
":",
"case",
"RDIV_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"CEIL_DIV_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"FLOOR_DIV_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"ROUND_DIV_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"EXACT_DIV_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"TRUNC_MOD_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"CEIL_MOD_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"FLOOR_MOD_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"ROUND_MOD_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"PREDECREMENT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"PREINCREMENT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"POSTDECREMENT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"POSTINCREMENT_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"MAX_EXPR",
":",
"return",
"\"",
"\"",
";",
"case",
"MIN_EXPR",
":",
"return",
"\"",
"\"",
";",
"default",
":",
"return",
"\"",
"\"",
";",
"}",
"}"
] | Return the symbol associated with operator CODE. | [
"Return",
"the",
"symbol",
"associated",
"with",
"operator",
"CODE",
"."
] | [] | [
{
"param": "code",
"type": "enum tree_code"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "code",
"type": "enum tree_code",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | op_symbol | char | static const char *
op_symbol (const_tree op)
{
return op_symbol_code (TREE_CODE (op));
} | /* Return the symbol associated with operator OP. */ | Return the symbol associated with operator OP. | [
"Return",
"the",
"symbol",
"associated",
"with",
"operator",
"OP",
"."
] | static const char *
op_symbol (const_tree op)
{
return op_symbol_code (TREE_CODE (op));
} | [
"static",
"const",
"char",
"*",
"op_symbol",
"(",
"const_tree",
"op",
")",
"{",
"return",
"op_symbol_code",
"(",
"TREE_CODE",
"(",
"op",
")",
")",
";",
"}"
] | Return the symbol associated with operator OP. | [
"Return",
"the",
"symbol",
"associated",
"with",
"operator",
"OP",
"."
] | [] | [
{
"param": "op",
"type": "const_tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "op",
"type": "const_tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | print_call_name | void | void
print_call_name (pretty_printer *buffer, tree node, int flags)
{
tree op0 = node;
if (TREE_CODE (op0) == NON_LVALUE_EXPR)
op0 = TREE_OPERAND (op0, 0);
again:
switch (TREE_CODE (op0))
{
case VAR_DECL:
case PARM_DECL:
case FUNCTION_DECL:
dump_function_name (buffer, op0, flags);
break;
case ADDR_EXPR:
case INDIRECT_REF:
case NOP_EXPR:
op0 = TREE_OPERAND (op0, 0);
goto again;
case COND_EXPR:
pp_string (buffer, "(");
dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
pp_string (buffer, ") ? ");
dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, flags, false);
pp_string (buffer, " : ");
dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, flags, false);
break;
case ARRAY_REF:
if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
dump_function_name (buffer, TREE_OPERAND (op0, 0), flags);
else
dump_generic_node (buffer, op0, 0, flags, false);
break;
case MEM_REF:
if (integer_zerop (TREE_OPERAND (op0, 1)))
{
op0 = TREE_OPERAND (op0, 0);
goto again;
}
/* Fallthru. */
case COMPONENT_REF:
case SSA_NAME:
case OBJ_TYPE_REF:
dump_generic_node (buffer, op0, 0, flags, false);
break;
default:
NIY;
}
} | /* Prints the name of a call. NODE is the CALL_EXPR_FN of a CALL_EXPR or
the gimple_call_fn of a GIMPLE_CALL. */ | Prints the name of a call. | [
"Prints",
"the",
"name",
"of",
"a",
"call",
"."
] | void
print_call_name (pretty_printer *buffer, tree node, int flags)
{
tree op0 = node;
if (TREE_CODE (op0) == NON_LVALUE_EXPR)
op0 = TREE_OPERAND (op0, 0);
again:
switch (TREE_CODE (op0))
{
case VAR_DECL:
case PARM_DECL:
case FUNCTION_DECL:
dump_function_name (buffer, op0, flags);
break;
case ADDR_EXPR:
case INDIRECT_REF:
case NOP_EXPR:
op0 = TREE_OPERAND (op0, 0);
goto again;
case COND_EXPR:
pp_string (buffer, "(");
dump_generic_node (buffer, TREE_OPERAND (op0, 0), 0, flags, false);
pp_string (buffer, ") ? ");
dump_generic_node (buffer, TREE_OPERAND (op0, 1), 0, flags, false);
pp_string (buffer, " : ");
dump_generic_node (buffer, TREE_OPERAND (op0, 2), 0, flags, false);
break;
case ARRAY_REF:
if (TREE_CODE (TREE_OPERAND (op0, 0)) == VAR_DECL)
dump_function_name (buffer, TREE_OPERAND (op0, 0), flags);
else
dump_generic_node (buffer, op0, 0, flags, false);
break;
case MEM_REF:
if (integer_zerop (TREE_OPERAND (op0, 1)))
{
op0 = TREE_OPERAND (op0, 0);
goto again;
}
case COMPONENT_REF:
case SSA_NAME:
case OBJ_TYPE_REF:
dump_generic_node (buffer, op0, 0, flags, false);
break;
default:
NIY;
}
} | [
"void",
"print_call_name",
"(",
"pretty_printer",
"*",
"buffer",
",",
"tree",
"node",
",",
"int",
"flags",
")",
"{",
"tree",
"op0",
"=",
"node",
";",
"if",
"(",
"TREE_CODE",
"(",
"op0",
")",
"==",
"NON_LVALUE_EXPR",
")",
"op0",
"=",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
";",
"again",
":",
"switch",
"(",
"TREE_CODE",
"(",
"op0",
")",
")",
"{",
"case",
"VAR_DECL",
":",
"case",
"PARM_DECL",
":",
"case",
"FUNCTION_DECL",
":",
"dump_function_name",
"(",
"buffer",
",",
"op0",
",",
"flags",
")",
";",
"break",
";",
"case",
"ADDR_EXPR",
":",
"case",
"INDIRECT_REF",
":",
"case",
"NOP_EXPR",
":",
"op0",
"=",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
";",
"goto",
"again",
";",
"case",
"COND_EXPR",
":",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_OPERAND",
"(",
"op0",
",",
"1",
")",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"pp_string",
"(",
"buffer",
",",
"\"",
"\"",
")",
";",
"dump_generic_node",
"(",
"buffer",
",",
"TREE_OPERAND",
"(",
"op0",
",",
"2",
")",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"break",
";",
"case",
"ARRAY_REF",
":",
"if",
"(",
"TREE_CODE",
"(",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
")",
"==",
"VAR_DECL",
")",
"dump_function_name",
"(",
"buffer",
",",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
",",
"flags",
")",
";",
"else",
"dump_generic_node",
"(",
"buffer",
",",
"op0",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"break",
";",
"case",
"MEM_REF",
":",
"if",
"(",
"integer_zerop",
"(",
"TREE_OPERAND",
"(",
"op0",
",",
"1",
")",
")",
")",
"{",
"op0",
"=",
"TREE_OPERAND",
"(",
"op0",
",",
"0",
")",
";",
"goto",
"again",
";",
"}",
"case",
"COMPONENT_REF",
":",
"case",
"SSA_NAME",
":",
"case",
"OBJ_TYPE_REF",
":",
"dump_generic_node",
"(",
"buffer",
",",
"op0",
",",
"0",
",",
"flags",
",",
"false",
")",
";",
"break",
";",
"default",
":",
"NIY",
";",
"}",
"}"
] | Prints the name of a call. | [
"Prints",
"the",
"name",
"of",
"a",
"call",
"."
] | [
"/* Fallthru. */"
] | [
{
"param": "buffer",
"type": "pretty_printer"
},
{
"param": "node",
"type": "tree"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "buffer",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "node",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | percent_K_format | void | void
percent_K_format (text_info *text)
{
tree t = va_arg (*text->args_ptr, tree), block;
gcc_assert (text->locus != NULL);
*text->locus = EXPR_LOCATION (t);
gcc_assert (pp_ti_abstract_origin (text) != NULL);
block = TREE_BLOCK (t);
*pp_ti_abstract_origin (text) = NULL;
while (block
&& TREE_CODE (block) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (block))
{
tree ao = BLOCK_ABSTRACT_ORIGIN (block);
while (TREE_CODE (ao) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (ao)
&& BLOCK_ABSTRACT_ORIGIN (ao) != ao)
ao = BLOCK_ABSTRACT_ORIGIN (ao);
if (TREE_CODE (ao) == FUNCTION_DECL)
{
*pp_ti_abstract_origin (text) = block;
break;
}
block = BLOCK_SUPERCONTEXT (block);
}
} | /* Handle a %K format for TEXT. Separate from default_tree_printer so
it can also be used in front ends.
%K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded.
*/ | Handle a %K format for TEXT. Separate from default_tree_printer so
it can also be used in front ends.
%K: a statement, from which EXPR_LOCATION and TREE_BLOCK will be recorded. | [
"Handle",
"a",
"%K",
"format",
"for",
"TEXT",
".",
"Separate",
"from",
"default_tree_printer",
"so",
"it",
"can",
"also",
"be",
"used",
"in",
"front",
"ends",
".",
"%K",
":",
"a",
"statement",
"from",
"which",
"EXPR_LOCATION",
"and",
"TREE_BLOCK",
"will",
"be",
"recorded",
"."
] | void
percent_K_format (text_info *text)
{
tree t = va_arg (*text->args_ptr, tree), block;
gcc_assert (text->locus != NULL);
*text->locus = EXPR_LOCATION (t);
gcc_assert (pp_ti_abstract_origin (text) != NULL);
block = TREE_BLOCK (t);
*pp_ti_abstract_origin (text) = NULL;
while (block
&& TREE_CODE (block) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (block))
{
tree ao = BLOCK_ABSTRACT_ORIGIN (block);
while (TREE_CODE (ao) == BLOCK
&& BLOCK_ABSTRACT_ORIGIN (ao)
&& BLOCK_ABSTRACT_ORIGIN (ao) != ao)
ao = BLOCK_ABSTRACT_ORIGIN (ao);
if (TREE_CODE (ao) == FUNCTION_DECL)
{
*pp_ti_abstract_origin (text) = block;
break;
}
block = BLOCK_SUPERCONTEXT (block);
}
} | [
"void",
"percent_K_format",
"(",
"text_info",
"*",
"text",
")",
"{",
"tree",
"t",
"=",
"va_arg",
"(",
"*",
"text",
"->",
"args_ptr",
",",
"tree",
")",
",",
"block",
";",
"gcc_assert",
"(",
"text",
"->",
"locus",
"!=",
"NULL",
")",
";",
"*",
"text",
"->",
"locus",
"=",
"EXPR_LOCATION",
"(",
"t",
")",
";",
"gcc_assert",
"(",
"pp_ti_abstract_origin",
"(",
"text",
")",
"!=",
"NULL",
")",
";",
"block",
"=",
"TREE_BLOCK",
"(",
"t",
")",
";",
"*",
"pp_ti_abstract_origin",
"(",
"text",
")",
"=",
"NULL",
";",
"while",
"(",
"block",
"&&",
"TREE_CODE",
"(",
"block",
")",
"==",
"BLOCK",
"&&",
"BLOCK_ABSTRACT_ORIGIN",
"(",
"block",
")",
")",
"{",
"tree",
"ao",
"=",
"BLOCK_ABSTRACT_ORIGIN",
"(",
"block",
")",
";",
"while",
"(",
"TREE_CODE",
"(",
"ao",
")",
"==",
"BLOCK",
"&&",
"BLOCK_ABSTRACT_ORIGIN",
"(",
"ao",
")",
"&&",
"BLOCK_ABSTRACT_ORIGIN",
"(",
"ao",
")",
"!=",
"ao",
")",
"ao",
"=",
"BLOCK_ABSTRACT_ORIGIN",
"(",
"ao",
")",
";",
"if",
"(",
"TREE_CODE",
"(",
"ao",
")",
"==",
"FUNCTION_DECL",
")",
"{",
"*",
"pp_ti_abstract_origin",
"(",
"text",
")",
"=",
"block",
";",
"break",
";",
"}",
"block",
"=",
"BLOCK_SUPERCONTEXT",
"(",
"block",
")",
";",
"}",
"}"
] | Handle a %K format for TEXT. | [
"Handle",
"a",
"%K",
"format",
"for",
"TEXT",
"."
] | [] | [
{
"param": "text",
"type": "text_info"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "text",
"type": "text_info",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | pp_base_tree_identifier | void | void
pp_base_tree_identifier (pretty_printer *pp, tree id)
{
if (pp_translate_identifiers (pp))
{
const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
pp_append_text (pp, text, text + strlen (text));
}
else
pp_append_text (pp, IDENTIFIER_POINTER (id),
IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
} | /* Print the identifier ID to PRETTY-PRINTER. */ | Print the identifier ID to PRETTY-PRINTER. | [
"Print",
"the",
"identifier",
"ID",
"to",
"PRETTY",
"-",
"PRINTER",
"."
] | void
pp_base_tree_identifier (pretty_printer *pp, tree id)
{
if (pp_translate_identifiers (pp))
{
const char *text = identifier_to_locale (IDENTIFIER_POINTER (id));
pp_append_text (pp, text, text + strlen (text));
}
else
pp_append_text (pp, IDENTIFIER_POINTER (id),
IDENTIFIER_POINTER (id) + IDENTIFIER_LENGTH (id));
} | [
"void",
"pp_base_tree_identifier",
"(",
"pretty_printer",
"*",
"pp",
",",
"tree",
"id",
")",
"{",
"if",
"(",
"pp_translate_identifiers",
"(",
"pp",
")",
")",
"{",
"const",
"char",
"*",
"text",
"=",
"identifier_to_locale",
"(",
"IDENTIFIER_POINTER",
"(",
"id",
")",
")",
";",
"pp_append_text",
"(",
"pp",
",",
"text",
",",
"text",
"+",
"strlen",
"(",
"text",
")",
")",
";",
"}",
"else",
"pp_append_text",
"(",
"pp",
",",
"IDENTIFIER_POINTER",
"(",
"id",
")",
",",
"IDENTIFIER_POINTER",
"(",
"id",
")",
"+",
"IDENTIFIER_LENGTH",
"(",
"id",
")",
")",
";",
"}"
] | Print the identifier ID to PRETTY-PRINTER. | [
"Print",
"the",
"identifier",
"ID",
"to",
"PRETTY",
"-",
"PRINTER",
"."
] | [] | [
{
"param": "pp",
"type": "pretty_printer"
},
{
"param": "id",
"type": "tree"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pp",
"type": "pretty_printer",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "id",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
4b9b4536641469a999a26fba7201421c4a372989 | atrens/DragonFlyBSD-src | contrib/gcc-4.7/gcc/tree-pretty-print.c | [
"BSD-3-Clause"
] | C | dump_function_header | void | void
dump_function_header (FILE *dump_file, tree fdecl, int flags)
{
const char *dname, *aname;
struct cgraph_node *node = cgraph_get_node (fdecl);
struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
dname = lang_hooks.decl_printable_name (fdecl, 2);
if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
aname = (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (fdecl)));
else
aname = "<unset-asm-name>";
fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
dname, aname, fun->funcdef_no);
if (!(flags & TDF_NOUID))
fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
if (node)
{
fprintf (dump_file, ", cgraph_uid=%d)%s\n\n", node->uid,
node->frequency == NODE_FREQUENCY_HOT
? " (hot)"
: node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
? " (unlikely executed)"
: node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
? " (executed once)"
: "");
}
else
fprintf (dump_file, ")\n\n");
} | /* A helper function that is used to dump function information before the
function dump. */ | A helper function that is used to dump function information before the
function dump. | [
"A",
"helper",
"function",
"that",
"is",
"used",
"to",
"dump",
"function",
"information",
"before",
"the",
"function",
"dump",
"."
] | void
dump_function_header (FILE *dump_file, tree fdecl, int flags)
{
const char *dname, *aname;
struct cgraph_node *node = cgraph_get_node (fdecl);
struct function *fun = DECL_STRUCT_FUNCTION (fdecl);
dname = lang_hooks.decl_printable_name (fdecl, 2);
if (DECL_ASSEMBLER_NAME_SET_P (fdecl))
aname = (IDENTIFIER_POINTER
(DECL_ASSEMBLER_NAME (fdecl)));
else
aname = "<unset-asm-name>";
fprintf (dump_file, "\n;; Function %s (%s, funcdef_no=%d",
dname, aname, fun->funcdef_no);
if (!(flags & TDF_NOUID))
fprintf (dump_file, ", decl_uid=%d", DECL_UID (fdecl));
if (node)
{
fprintf (dump_file, ", cgraph_uid=%d)%s\n\n", node->uid,
node->frequency == NODE_FREQUENCY_HOT
? " (hot)"
: node->frequency == NODE_FREQUENCY_UNLIKELY_EXECUTED
? " (unlikely executed)"
: node->frequency == NODE_FREQUENCY_EXECUTED_ONCE
? " (executed once)"
: "");
}
else
fprintf (dump_file, ")\n\n");
} | [
"void",
"dump_function_header",
"(",
"FILE",
"*",
"dump_file",
",",
"tree",
"fdecl",
",",
"int",
"flags",
")",
"{",
"const",
"char",
"*",
"dname",
",",
"*",
"aname",
";",
"struct",
"cgraph_node",
"*",
"node",
"=",
"cgraph_get_node",
"(",
"fdecl",
")",
";",
"struct",
"function",
"*",
"fun",
"=",
"DECL_STRUCT_FUNCTION",
"(",
"fdecl",
")",
";",
"dname",
"=",
"lang_hooks",
".",
"decl_printable_name",
"(",
"fdecl",
",",
"2",
")",
";",
"if",
"(",
"DECL_ASSEMBLER_NAME_SET_P",
"(",
"fdecl",
")",
")",
"aname",
"=",
"(",
"IDENTIFIER_POINTER",
"(",
"DECL_ASSEMBLER_NAME",
"(",
"fdecl",
")",
")",
")",
";",
"else",
"aname",
"=",
"\"",
"\"",
";",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\"",
",",
"dname",
",",
"aname",
",",
"fun",
"->",
"funcdef_no",
")",
";",
"if",
"(",
"!",
"(",
"flags",
"&",
"TDF_NOUID",
")",
")",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\"",
",",
"DECL_UID",
"(",
"fdecl",
")",
")",
";",
"if",
"(",
"node",
")",
"{",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\\n",
"\"",
",",
"node",
"->",
"uid",
",",
"node",
"->",
"frequency",
"==",
"NODE_FREQUENCY_HOT",
"?",
"\"",
"\"",
":",
"node",
"->",
"frequency",
"==",
"NODE_FREQUENCY_UNLIKELY_EXECUTED",
"?",
"\"",
"\"",
":",
"node",
"->",
"frequency",
"==",
"NODE_FREQUENCY_EXECUTED_ONCE",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"}",
"else",
"fprintf",
"(",
"dump_file",
",",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"}"
] | A helper function that is used to dump function information before the
function dump. | [
"A",
"helper",
"function",
"that",
"is",
"used",
"to",
"dump",
"function",
"information",
"before",
"the",
"function",
"dump",
"."
] | [] | [
{
"param": "dump_file",
"type": "FILE"
},
{
"param": "fdecl",
"type": "tree"
},
{
"param": "flags",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dump_file",
"type": "FILE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "fdecl",
"type": "tree",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "flags",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e0335117a37e1d5efd5fc94671a9184a8dd7a7bf | atrens/DragonFlyBSD-src | usr.bin/locale/locale.c | [
"BSD-3-Clause"
] | C | list_locales | void | static void
list_locales(void)
{
size_t i;
init_locales_list();
for (i = 0; i < locales->sl_cur; i++) {
printf("%s\n", locales->sl_str[i]);
}
} | /*
* Output information about all available locales
*
* XXX actually output of this function does not guarantee that locale
* is really available to application, since it can be broken or
* inconsistent thus setlocale() will fail. Maybe add '-V' function to
* also validate these locales?
*/ | Output information about all available locales
XXX actually output of this function does not guarantee that locale
is really available to application, since it can be broken or
inconsistent thus setlocale() will fail. | [
"Output",
"information",
"about",
"all",
"available",
"locales",
"XXX",
"actually",
"output",
"of",
"this",
"function",
"does",
"not",
"guarantee",
"that",
"locale",
"is",
"really",
"available",
"to",
"application",
"since",
"it",
"can",
"be",
"broken",
"or",
"inconsistent",
"thus",
"setlocale",
"()",
"will",
"fail",
"."
] | static void
list_locales(void)
{
size_t i;
init_locales_list();
for (i = 0; i < locales->sl_cur; i++) {
printf("%s\n", locales->sl_str[i]);
}
} | [
"static",
"void",
"list_locales",
"(",
"void",
")",
"{",
"size_t",
"i",
";",
"init_locales_list",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"locales",
"->",
"sl_cur",
";",
"i",
"++",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"locales",
"->",
"sl_str",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Output information about all available locales
XXX actually output of this function does not guarantee that locale
is really available to application, since it can be broken or
inconsistent thus setlocale() will fail. | [
"Output",
"information",
"about",
"all",
"available",
"locales",
"XXX",
"actually",
"output",
"of",
"this",
"function",
"does",
"not",
"guarantee",
"that",
"locale",
"is",
"really",
"available",
"to",
"application",
"since",
"it",
"can",
"be",
"broken",
"or",
"inconsistent",
"thus",
"setlocale",
"()",
"will",
"fail",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e0335117a37e1d5efd5fc94671a9184a8dd7a7bf | atrens/DragonFlyBSD-src | usr.bin/locale/locale.c | [
"BSD-3-Clause"
] | C | list_charmaps | void | static void
list_charmaps(void)
{
size_t i;
char *s, *cs;
StringList *charmaps;
/* initialize StringList */
charmaps = sl_init();
if (charmaps == NULL)
err(1, "could not allocate memory");
/* fetch locales list */
init_locales_list();
/* split codesets and build their list */
for (i = 0; i < locales->sl_cur; i++) {
s = locales->sl_str[i];
if ((cs = strchr(s, '.')) != NULL) {
cs++;
if (sl_find(charmaps, cs) == NULL)
sl_add(charmaps, cs);
}
}
/* add US-ASCII, if not yet added */
if (sl_find(charmaps, "US-ASCII") == NULL)
sl_add(charmaps, "US-ASCII");
/* sort the list */
qsort(charmaps->sl_str, charmaps->sl_cur, sizeof(char *), scmp);
/* print results */
for (i = 0; i < charmaps->sl_cur; i++) {
printf("%s\n", charmaps->sl_str[i]);
}
} | /*
* Output information about all available charmaps
*
* XXX this function is doing a task in hackish way, i.e. by scaning
* list of locales, spliting their codeset part and building list of
* them.
*/ | Output information about all available charmaps
XXX this function is doing a task in hackish way, i.e. by scaning
list of locales, spliting their codeset part and building list of
them. | [
"Output",
"information",
"about",
"all",
"available",
"charmaps",
"XXX",
"this",
"function",
"is",
"doing",
"a",
"task",
"in",
"hackish",
"way",
"i",
".",
"e",
".",
"by",
"scaning",
"list",
"of",
"locales",
"spliting",
"their",
"codeset",
"part",
"and",
"building",
"list",
"of",
"them",
"."
] | static void
list_charmaps(void)
{
size_t i;
char *s, *cs;
StringList *charmaps;
charmaps = sl_init();
if (charmaps == NULL)
err(1, "could not allocate memory");
init_locales_list();
for (i = 0; i < locales->sl_cur; i++) {
s = locales->sl_str[i];
if ((cs = strchr(s, '.')) != NULL) {
cs++;
if (sl_find(charmaps, cs) == NULL)
sl_add(charmaps, cs);
}
}
if (sl_find(charmaps, "US-ASCII") == NULL)
sl_add(charmaps, "US-ASCII");
qsort(charmaps->sl_str, charmaps->sl_cur, sizeof(char *), scmp);
for (i = 0; i < charmaps->sl_cur; i++) {
printf("%s\n", charmaps->sl_str[i]);
}
} | [
"static",
"void",
"list_charmaps",
"(",
"void",
")",
"{",
"size_t",
"i",
";",
"char",
"*",
"s",
",",
"*",
"cs",
";",
"StringList",
"*",
"charmaps",
";",
"charmaps",
"=",
"sl_init",
"(",
")",
";",
"if",
"(",
"charmaps",
"==",
"NULL",
")",
"err",
"(",
"1",
",",
"\"",
"\"",
")",
";",
"init_locales_list",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"locales",
"->",
"sl_cur",
";",
"i",
"++",
")",
"{",
"s",
"=",
"locales",
"->",
"sl_str",
"[",
"i",
"]",
";",
"if",
"(",
"(",
"cs",
"=",
"strchr",
"(",
"s",
",",
"'",
"'",
")",
")",
"!=",
"NULL",
")",
"{",
"cs",
"++",
";",
"if",
"(",
"sl_find",
"(",
"charmaps",
",",
"cs",
")",
"==",
"NULL",
")",
"sl_add",
"(",
"charmaps",
",",
"cs",
")",
";",
"}",
"}",
"if",
"(",
"sl_find",
"(",
"charmaps",
",",
"\"",
"\"",
")",
"==",
"NULL",
")",
"sl_add",
"(",
"charmaps",
",",
"\"",
"\"",
")",
";",
"qsort",
"(",
"charmaps",
"->",
"sl_str",
",",
"charmaps",
"->",
"sl_cur",
",",
"sizeof",
"(",
"char",
"*",
")",
",",
"scmp",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"charmaps",
"->",
"sl_cur",
";",
"i",
"++",
")",
"{",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"charmaps",
"->",
"sl_str",
"[",
"i",
"]",
")",
";",
"}",
"}"
] | Output information about all available charmaps
XXX this function is doing a task in hackish way, i.e. | [
"Output",
"information",
"about",
"all",
"available",
"charmaps",
"XXX",
"this",
"function",
"is",
"doing",
"a",
"task",
"in",
"hackish",
"way",
"i",
".",
"e",
"."
] | [
"/* initialize StringList */",
"/* fetch locales list */",
"/* split codesets and build their list */",
"/* add US-ASCII, if not yet added */",
"/* sort the list */",
"/* print results */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e0335117a37e1d5efd5fc94671a9184a8dd7a7bf | atrens/DragonFlyBSD-src | usr.bin/locale/locale.c | [
"BSD-3-Clause"
] | C | init_locales_list | void | static void
init_locales_list(void)
{
DIR *dirp;
struct dirent *dp;
char *s;
char *localedir;
/* why call this function twice ? */
if (locales != NULL)
return;
/* initialize StringList */
locales = sl_init();
if (locales == NULL)
err(1, "could not allocate memory");
/* get actual locales directory name */
setlocale(LC_CTYPE, "C");
localedir = getenv("PATH_LOCALE");
if (localedir == NULL)
localedir = _PATH_LOCALE;
/* open locales directory */
dirp = opendir(localedir);
if (dirp == NULL)
err(1, "could not open directory '%s'", localedir);
/* scan directory and store its contents except "." and ".." */
while ((dp = readdir(dirp)) != NULL) {
/* exclude "." and ".." */
if ((dp->d_name[0] != '.' || (dp->d_name[1] != '\0' &&
(dp->d_name[1] != '.' || dp->d_name[2] != '\0')))) {
s = strdup(dp->d_name);
if (s == NULL)
err(1, "could not allocate memory");
sl_add(locales, s);
}
}
closedir(dirp);
/* make sure that 'POSIX' and 'C' locales are present in the list.
* POSIX 1003.1-2001 requires presence of 'POSIX' name only here, but
* we also list 'C' for constistency
*/
if (sl_find(locales, "POSIX") == NULL)
sl_add(locales, "POSIX");
if (sl_find(locales, "C") == NULL)
sl_add(locales, "C");
/* make output nicer, sort the list */
qsort(locales->sl_str, locales->sl_cur, sizeof(char *), scmp);
} | /*
* Retrieve sorted list of system locales (or user locales, if PATH_LOCALE
* environment variable is set)
*/ | Retrieve sorted list of system locales (or user locales, if PATH_LOCALE
environment variable is set) | [
"Retrieve",
"sorted",
"list",
"of",
"system",
"locales",
"(",
"or",
"user",
"locales",
"if",
"PATH_LOCALE",
"environment",
"variable",
"is",
"set",
")"
] | static void
init_locales_list(void)
{
DIR *dirp;
struct dirent *dp;
char *s;
char *localedir;
if (locales != NULL)
return;
locales = sl_init();
if (locales == NULL)
err(1, "could not allocate memory");
setlocale(LC_CTYPE, "C");
localedir = getenv("PATH_LOCALE");
if (localedir == NULL)
localedir = _PATH_LOCALE;
dirp = opendir(localedir);
if (dirp == NULL)
err(1, "could not open directory '%s'", localedir);
while ((dp = readdir(dirp)) != NULL) {
if ((dp->d_name[0] != '.' || (dp->d_name[1] != '\0' &&
(dp->d_name[1] != '.' || dp->d_name[2] != '\0')))) {
s = strdup(dp->d_name);
if (s == NULL)
err(1, "could not allocate memory");
sl_add(locales, s);
}
}
closedir(dirp);
if (sl_find(locales, "POSIX") == NULL)
sl_add(locales, "POSIX");
if (sl_find(locales, "C") == NULL)
sl_add(locales, "C");
qsort(locales->sl_str, locales->sl_cur, sizeof(char *), scmp);
} | [
"static",
"void",
"init_locales_list",
"(",
"void",
")",
"{",
"DIR",
"*",
"dirp",
";",
"struct",
"dirent",
"*",
"dp",
";",
"char",
"*",
"s",
";",
"char",
"*",
"localedir",
";",
"if",
"(",
"locales",
"!=",
"NULL",
")",
"return",
";",
"locales",
"=",
"sl_init",
"(",
")",
";",
"if",
"(",
"locales",
"==",
"NULL",
")",
"err",
"(",
"1",
",",
"\"",
"\"",
")",
";",
"setlocale",
"(",
"LC_CTYPE",
",",
"\"",
"\"",
")",
";",
"localedir",
"=",
"getenv",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"localedir",
"==",
"NULL",
")",
"localedir",
"=",
"_PATH_LOCALE",
";",
"dirp",
"=",
"opendir",
"(",
"localedir",
")",
";",
"if",
"(",
"dirp",
"==",
"NULL",
")",
"err",
"(",
"1",
",",
"\"",
"\"",
",",
"localedir",
")",
";",
"while",
"(",
"(",
"dp",
"=",
"readdir",
"(",
"dirp",
")",
")",
"!=",
"NULL",
")",
"{",
"if",
"(",
"(",
"dp",
"->",
"d_name",
"[",
"0",
"]",
"!=",
"'",
"'",
"||",
"(",
"dp",
"->",
"d_name",
"[",
"1",
"]",
"!=",
"'",
"\\0",
"'",
"&&",
"(",
"dp",
"->",
"d_name",
"[",
"1",
"]",
"!=",
"'",
"'",
"||",
"dp",
"->",
"d_name",
"[",
"2",
"]",
"!=",
"'",
"\\0",
"'",
")",
")",
")",
")",
"{",
"s",
"=",
"strdup",
"(",
"dp",
"->",
"d_name",
")",
";",
"if",
"(",
"s",
"==",
"NULL",
")",
"err",
"(",
"1",
",",
"\"",
"\"",
")",
";",
"sl_add",
"(",
"locales",
",",
"s",
")",
";",
"}",
"}",
"closedir",
"(",
"dirp",
")",
";",
"if",
"(",
"sl_find",
"(",
"locales",
",",
"\"",
"\"",
")",
"==",
"NULL",
")",
"sl_add",
"(",
"locales",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"sl_find",
"(",
"locales",
",",
"\"",
"\"",
")",
"==",
"NULL",
")",
"sl_add",
"(",
"locales",
",",
"\"",
"\"",
")",
";",
"qsort",
"(",
"locales",
"->",
"sl_str",
",",
"locales",
"->",
"sl_cur",
",",
"sizeof",
"(",
"char",
"*",
")",
",",
"scmp",
")",
";",
"}"
] | Retrieve sorted list of system locales (or user locales, if PATH_LOCALE
environment variable is set) | [
"Retrieve",
"sorted",
"list",
"of",
"system",
"locales",
"(",
"or",
"user",
"locales",
"if",
"PATH_LOCALE",
"environment",
"variable",
"is",
"set",
")"
] | [
"/* why call this function twice ? */",
"/* initialize StringList */",
"/* get actual locales directory name */",
"/* open locales directory */",
"/* scan directory and store its contents except \".\" and \"..\" */",
"/* exclude \".\" and \"..\" */",
"/* make sure that 'POSIX' and 'C' locales are present in the list.\n\t * POSIX 1003.1-2001 requires presence of 'POSIX' name only here, but\n * we also list 'C' for constistency\n */",
"/* make output nicer, sort the list */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e0335117a37e1d5efd5fc94671a9184a8dd7a7bf | atrens/DragonFlyBSD-src | usr.bin/locale/locale.c | [
"BSD-3-Clause"
] | C | showlocale | void | static void
showlocale(void)
{
size_t i;
const char *lang, *vval, *eval;
setlocale(LC_ALL, "");
lang = getenv("LANG");
if (lang == NULL) {
lang = "";
}
printf("LANG=\"%s\"\n", lang);
/* XXX: if LANG is null, then set it to "C" to get implied values? */
for (i = 0; i < NLCINFO; i++) {
vval = setlocale(lcinfo[i].id, NULL);
eval = getenv(lcinfo[i].name);
if (eval != NULL && !strcmp(eval, vval)
&& strcmp(lang, vval)) {
/*
* Appropriate environment variable set, its value
* is valid and not overridden by LC_ALL
*
* XXX: possible side effect: if both LANG and
* overridden environment variable are set into same
* value, then it'll be assumed as 'implied'
*/
printf("%s=\"%s\"\n", lcinfo[i].name, vval);
} else {
printf("%s=\"%s\"\n", lcinfo[i].name, vval);
}
}
vval = getenv("LC_ALL");
if (vval == NULL) {
vval = "";
}
printf("LC_ALL=\"%s\"\n", vval);
} | /*
* Show current locale status, depending on environment variables
*/ | Show current locale status, depending on environment variables | [
"Show",
"current",
"locale",
"status",
"depending",
"on",
"environment",
"variables"
] | static void
showlocale(void)
{
size_t i;
const char *lang, *vval, *eval;
setlocale(LC_ALL, "");
lang = getenv("LANG");
if (lang == NULL) {
lang = "";
}
printf("LANG=\"%s\"\n", lang);
for (i = 0; i < NLCINFO; i++) {
vval = setlocale(lcinfo[i].id, NULL);
eval = getenv(lcinfo[i].name);
if (eval != NULL && !strcmp(eval, vval)
&& strcmp(lang, vval)) {
printf("%s=\"%s\"\n", lcinfo[i].name, vval);
} else {
printf("%s=\"%s\"\n", lcinfo[i].name, vval);
}
}
vval = getenv("LC_ALL");
if (vval == NULL) {
vval = "";
}
printf("LC_ALL=\"%s\"\n", vval);
} | [
"static",
"void",
"showlocale",
"(",
"void",
")",
"{",
"size_t",
"i",
";",
"const",
"char",
"*",
"lang",
",",
"*",
"vval",
",",
"*",
"eval",
";",
"setlocale",
"(",
"LC_ALL",
",",
"\"",
"\"",
")",
";",
"lang",
"=",
"getenv",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"lang",
"==",
"NULL",
")",
"{",
"lang",
"=",
"\"",
"\"",
";",
"}",
"printf",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"lang",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"NLCINFO",
";",
"i",
"++",
")",
"{",
"vval",
"=",
"setlocale",
"(",
"lcinfo",
"[",
"i",
"]",
".",
"id",
",",
"NULL",
")",
";",
"eval",
"=",
"getenv",
"(",
"lcinfo",
"[",
"i",
"]",
".",
"name",
")",
";",
"if",
"(",
"eval",
"!=",
"NULL",
"&&",
"!",
"strcmp",
"(",
"eval",
",",
"vval",
")",
"&&",
"strcmp",
"(",
"lang",
",",
"vval",
")",
")",
"{",
"printf",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"lcinfo",
"[",
"i",
"]",
".",
"name",
",",
"vval",
")",
";",
"}",
"else",
"{",
"printf",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"lcinfo",
"[",
"i",
"]",
".",
"name",
",",
"vval",
")",
";",
"}",
"}",
"vval",
"=",
"getenv",
"(",
"\"",
"\"",
")",
";",
"if",
"(",
"vval",
"==",
"NULL",
")",
"{",
"vval",
"=",
"\"",
"\"",
";",
"}",
"printf",
"(",
"\"",
"\\\"",
"\\\"",
"\\n",
"\"",
",",
"vval",
")",
";",
"}"
] | Show current locale status, depending on environment variables | [
"Show",
"current",
"locale",
"status",
"depending",
"on",
"environment",
"variables"
] | [
"/* XXX: if LANG is null, then set it to \"C\" to get implied values? */",
"/*\n\t\t\t * Appropriate environment variable set, its value\n\t\t\t * is valid and not overridden by LC_ALL\n\t\t\t *\n\t\t\t * XXX: possible side effect: if both LANG and\n\t\t\t * overridden environment variable are set into same\n\t\t\t * value, then it'll be assumed as 'implied'\n\t\t\t */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e0335117a37e1d5efd5fc94671a9184a8dd7a7bf | atrens/DragonFlyBSD-src | usr.bin/locale/locale.c | [
"BSD-3-Clause"
] | C | kwval_lconv | char | static char *
kwval_lconv(int id)
{
struct lconv *lc;
char *rval;
rval = NULL;
lc = localeconv();
switch (id) {
case KW_GROUPING:
rval = lc->grouping;
break;
case KW_INT_CURR_SYMBOL:
rval = lc->int_curr_symbol;
break;
case KW_CURRENCY_SYMBOL:
rval = lc->currency_symbol;
break;
case KW_MON_DECIMAL_POINT:
rval = lc->mon_decimal_point;
break;
case KW_MON_THOUSANDS_SEP:
rval = lc->mon_thousands_sep;
break;
case KW_MON_GROUPING:
rval = lc->mon_grouping;
break;
case KW_POSITIVE_SIGN:
rval = lc->positive_sign;
break;
case KW_NEGATIVE_SIGN:
rval = lc->negative_sign;
break;
case KW_INT_FRAC_DIGITS:
rval = &(lc->int_frac_digits);
break;
case KW_FRAC_DIGITS:
rval = &(lc->frac_digits);
break;
case KW_P_CS_PRECEDES:
rval = &(lc->p_cs_precedes);
break;
case KW_P_SEP_BY_SPACE:
rval = &(lc->p_sep_by_space);
break;
case KW_N_CS_PRECEDES:
rval = &(lc->n_cs_precedes);
break;
case KW_N_SEP_BY_SPACE:
rval = &(lc->n_sep_by_space);
break;
case KW_P_SIGN_POSN:
rval = &(lc->p_sign_posn);
break;
case KW_N_SIGN_POSN:
rval = &(lc->n_sign_posn);
break;
case KW_INT_P_CS_PRECEDES:
rval = &(lc->int_p_cs_precedes);
break;
case KW_INT_P_SEP_BY_SPACE:
rval = &(lc->int_p_sep_by_space);
break;
case KW_INT_N_CS_PRECEDES:
rval = &(lc->int_n_cs_precedes);
break;
case KW_INT_N_SEP_BY_SPACE:
rval = &(lc->int_n_sep_by_space);
break;
case KW_INT_P_SIGN_POSN:
rval = &(lc->int_p_sign_posn);
break;
case KW_INT_N_SIGN_POSN:
rval = &(lc->int_n_sign_posn);
break;
default:
break;
}
return (rval);
} | /*
* keyword value lookup helper (via localeconv())
*/ | keyword value lookup helper (via localeconv()) | [
"keyword",
"value",
"lookup",
"helper",
"(",
"via",
"localeconv",
"()",
")"
] | static char *
kwval_lconv(int id)
{
struct lconv *lc;
char *rval;
rval = NULL;
lc = localeconv();
switch (id) {
case KW_GROUPING:
rval = lc->grouping;
break;
case KW_INT_CURR_SYMBOL:
rval = lc->int_curr_symbol;
break;
case KW_CURRENCY_SYMBOL:
rval = lc->currency_symbol;
break;
case KW_MON_DECIMAL_POINT:
rval = lc->mon_decimal_point;
break;
case KW_MON_THOUSANDS_SEP:
rval = lc->mon_thousands_sep;
break;
case KW_MON_GROUPING:
rval = lc->mon_grouping;
break;
case KW_POSITIVE_SIGN:
rval = lc->positive_sign;
break;
case KW_NEGATIVE_SIGN:
rval = lc->negative_sign;
break;
case KW_INT_FRAC_DIGITS:
rval = &(lc->int_frac_digits);
break;
case KW_FRAC_DIGITS:
rval = &(lc->frac_digits);
break;
case KW_P_CS_PRECEDES:
rval = &(lc->p_cs_precedes);
break;
case KW_P_SEP_BY_SPACE:
rval = &(lc->p_sep_by_space);
break;
case KW_N_CS_PRECEDES:
rval = &(lc->n_cs_precedes);
break;
case KW_N_SEP_BY_SPACE:
rval = &(lc->n_sep_by_space);
break;
case KW_P_SIGN_POSN:
rval = &(lc->p_sign_posn);
break;
case KW_N_SIGN_POSN:
rval = &(lc->n_sign_posn);
break;
case KW_INT_P_CS_PRECEDES:
rval = &(lc->int_p_cs_precedes);
break;
case KW_INT_P_SEP_BY_SPACE:
rval = &(lc->int_p_sep_by_space);
break;
case KW_INT_N_CS_PRECEDES:
rval = &(lc->int_n_cs_precedes);
break;
case KW_INT_N_SEP_BY_SPACE:
rval = &(lc->int_n_sep_by_space);
break;
case KW_INT_P_SIGN_POSN:
rval = &(lc->int_p_sign_posn);
break;
case KW_INT_N_SIGN_POSN:
rval = &(lc->int_n_sign_posn);
break;
default:
break;
}
return (rval);
} | [
"static",
"char",
"*",
"kwval_lconv",
"(",
"int",
"id",
")",
"{",
"struct",
"lconv",
"*",
"lc",
";",
"char",
"*",
"rval",
";",
"rval",
"=",
"NULL",
";",
"lc",
"=",
"localeconv",
"(",
")",
";",
"switch",
"(",
"id",
")",
"{",
"case",
"KW_GROUPING",
":",
"rval",
"=",
"lc",
"->",
"grouping",
";",
"break",
";",
"case",
"KW_INT_CURR_SYMBOL",
":",
"rval",
"=",
"lc",
"->",
"int_curr_symbol",
";",
"break",
";",
"case",
"KW_CURRENCY_SYMBOL",
":",
"rval",
"=",
"lc",
"->",
"currency_symbol",
";",
"break",
";",
"case",
"KW_MON_DECIMAL_POINT",
":",
"rval",
"=",
"lc",
"->",
"mon_decimal_point",
";",
"break",
";",
"case",
"KW_MON_THOUSANDS_SEP",
":",
"rval",
"=",
"lc",
"->",
"mon_thousands_sep",
";",
"break",
";",
"case",
"KW_MON_GROUPING",
":",
"rval",
"=",
"lc",
"->",
"mon_grouping",
";",
"break",
";",
"case",
"KW_POSITIVE_SIGN",
":",
"rval",
"=",
"lc",
"->",
"positive_sign",
";",
"break",
";",
"case",
"KW_NEGATIVE_SIGN",
":",
"rval",
"=",
"lc",
"->",
"negative_sign",
";",
"break",
";",
"case",
"KW_INT_FRAC_DIGITS",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"int_frac_digits",
")",
";",
"break",
";",
"case",
"KW_FRAC_DIGITS",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"frac_digits",
")",
";",
"break",
";",
"case",
"KW_P_CS_PRECEDES",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"p_cs_precedes",
")",
";",
"break",
";",
"case",
"KW_P_SEP_BY_SPACE",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"p_sep_by_space",
")",
";",
"break",
";",
"case",
"KW_N_CS_PRECEDES",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"n_cs_precedes",
")",
";",
"break",
";",
"case",
"KW_N_SEP_BY_SPACE",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"n_sep_by_space",
")",
";",
"break",
";",
"case",
"KW_P_SIGN_POSN",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"p_sign_posn",
")",
";",
"break",
";",
"case",
"KW_N_SIGN_POSN",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"n_sign_posn",
")",
";",
"break",
";",
"case",
"KW_INT_P_CS_PRECEDES",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"int_p_cs_precedes",
")",
";",
"break",
";",
"case",
"KW_INT_P_SEP_BY_SPACE",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"int_p_sep_by_space",
")",
";",
"break",
";",
"case",
"KW_INT_N_CS_PRECEDES",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"int_n_cs_precedes",
")",
";",
"break",
";",
"case",
"KW_INT_N_SEP_BY_SPACE",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"int_n_sep_by_space",
")",
";",
"break",
";",
"case",
"KW_INT_P_SIGN_POSN",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"int_p_sign_posn",
")",
";",
"break",
";",
"case",
"KW_INT_N_SIGN_POSN",
":",
"rval",
"=",
"&",
"(",
"lc",
"->",
"int_n_sign_posn",
")",
";",
"break",
";",
"default",
":",
"break",
";",
"}",
"return",
"(",
"rval",
")",
";",
"}"
] | keyword value lookup helper (via localeconv()) | [
"keyword",
"value",
"lookup",
"helper",
"(",
"via",
"localeconv",
"()",
")"
] | [] | [
{
"param": "id",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "id",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e0335117a37e1d5efd5fc94671a9184a8dd7a7bf | atrens/DragonFlyBSD-src | usr.bin/locale/locale.c | [
"BSD-3-Clause"
] | C | lookup_localecat | char | static const char *
lookup_localecat(int cat)
{
size_t i;
for (i = 0; i < NLCINFO; i++)
if (lcinfo[i].id == cat) {
return (lcinfo[i].name);
}
return ("UNKNOWN");
} | /*
* Convert locale category id into string
*/ | Convert locale category id into string | [
"Convert",
"locale",
"category",
"id",
"into",
"string"
] | static const char *
lookup_localecat(int cat)
{
size_t i;
for (i = 0; i < NLCINFO; i++)
if (lcinfo[i].id == cat) {
return (lcinfo[i].name);
}
return ("UNKNOWN");
} | [
"static",
"const",
"char",
"*",
"lookup_localecat",
"(",
"int",
"cat",
")",
"{",
"size_t",
"i",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"NLCINFO",
";",
"i",
"++",
")",
"if",
"(",
"lcinfo",
"[",
"i",
"]",
".",
"id",
"==",
"cat",
")",
"{",
"return",
"(",
"lcinfo",
"[",
"i",
"]",
".",
"name",
")",
";",
"}",
"return",
"(",
"\"",
"\"",
")",
";",
"}"
] | Convert locale category id into string | [
"Convert",
"locale",
"category",
"id",
"into",
"string"
] | [] | [
{
"param": "cat",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cat",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e5b340669d33abae8f68d13ab408b4ca8a8f4a8 | atrens/DragonFlyBSD-src | usr.bin/mail/head.c | [
"BSD-3-Clause"
] | C | ishead | int | int
ishead(char *linebuf)
{
struct headline hl;
char parbuf[BUFSIZ];
if (strncmp(linebuf, "From ", 5) != 0)
return (0);
parse(linebuf, &hl, parbuf);
if (hl.l_date == NULL) {
fail(linebuf, "No date field");
return (0);
}
if (!isdate(hl.l_date)) {
fail(linebuf, "Date field not legal date");
return (0);
}
/*
* I guess we got it!
*/
return (1);
} | /*
* See if the passed line buffer is a mail header.
* Return true if yes. Note the extreme pains to
* accomodate all funny formats.
*/ | See if the passed line buffer is a mail header.
Return true if yes. Note the extreme pains to
accomodate all funny formats. | [
"See",
"if",
"the",
"passed",
"line",
"buffer",
"is",
"a",
"mail",
"header",
".",
"Return",
"true",
"if",
"yes",
".",
"Note",
"the",
"extreme",
"pains",
"to",
"accomodate",
"all",
"funny",
"formats",
"."
] | int
ishead(char *linebuf)
{
struct headline hl;
char parbuf[BUFSIZ];
if (strncmp(linebuf, "From ", 5) != 0)
return (0);
parse(linebuf, &hl, parbuf);
if (hl.l_date == NULL) {
fail(linebuf, "No date field");
return (0);
}
if (!isdate(hl.l_date)) {
fail(linebuf, "Date field not legal date");
return (0);
}
return (1);
} | [
"int",
"ishead",
"(",
"char",
"*",
"linebuf",
")",
"{",
"struct",
"headline",
"hl",
";",
"char",
"parbuf",
"[",
"BUFSIZ",
"]",
";",
"if",
"(",
"strncmp",
"(",
"linebuf",
",",
"\"",
"\"",
",",
"5",
")",
"!=",
"0",
")",
"return",
"(",
"0",
")",
";",
"parse",
"(",
"linebuf",
",",
"&",
"hl",
",",
"parbuf",
")",
";",
"if",
"(",
"hl",
".",
"l_date",
"==",
"NULL",
")",
"{",
"fail",
"(",
"linebuf",
",",
"\"",
"\"",
")",
";",
"return",
"(",
"0",
")",
";",
"}",
"if",
"(",
"!",
"isdate",
"(",
"hl",
".",
"l_date",
")",
")",
"{",
"fail",
"(",
"linebuf",
",",
"\"",
"\"",
")",
";",
"return",
"(",
"0",
")",
";",
"}",
"return",
"(",
"1",
")",
";",
"}"
] | See if the passed line buffer is a mail header. | [
"See",
"if",
"the",
"passed",
"line",
"buffer",
"is",
"a",
"mail",
"header",
"."
] | [
"/*\n\t * I guess we got it!\n\t */"
] | [
{
"param": "linebuf",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "linebuf",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e5b340669d33abae8f68d13ab408b4ca8a8f4a8 | atrens/DragonFlyBSD-src | usr.bin/mail/head.c | [
"BSD-3-Clause"
] | C | parse | void | void
parse(char *line, struct headline *hl, char *pbuf)
{
char *cp, *sp;
char word[LINESIZE];
hl->l_from = NULL;
hl->l_tty = NULL;
hl->l_date = NULL;
cp = line;
sp = pbuf;
/*
* Skip over "From" first.
*/
cp = nextword(cp, word);
/*
* Check for missing return-path.
*/
if (isdate(cp)) {
hl->l_date = copyin(cp, &sp);
return;
}
cp = nextword(cp, word);
if (strlen(word) > 0)
hl->l_from = copyin(word, &sp);
if (cp != NULL && strncmp(cp, "tty", 3) == 0) {
cp = nextword(cp, word);
hl->l_tty = copyin(word, &sp);
}
if (cp != NULL)
hl->l_date = copyin(cp, &sp);
} | /*
* Split a headline into its useful components.
* Copy the line into dynamic string space, then set
* pointers into the copied line in the passed headline
* structure. Actually, it scans.
*/ | Split a headline into its useful components.
Copy the line into dynamic string space, then set
pointers into the copied line in the passed headline
structure. Actually, it scans. | [
"Split",
"a",
"headline",
"into",
"its",
"useful",
"components",
".",
"Copy",
"the",
"line",
"into",
"dynamic",
"string",
"space",
"then",
"set",
"pointers",
"into",
"the",
"copied",
"line",
"in",
"the",
"passed",
"headline",
"structure",
".",
"Actually",
"it",
"scans",
"."
] | void
parse(char *line, struct headline *hl, char *pbuf)
{
char *cp, *sp;
char word[LINESIZE];
hl->l_from = NULL;
hl->l_tty = NULL;
hl->l_date = NULL;
cp = line;
sp = pbuf;
cp = nextword(cp, word);
if (isdate(cp)) {
hl->l_date = copyin(cp, &sp);
return;
}
cp = nextword(cp, word);
if (strlen(word) > 0)
hl->l_from = copyin(word, &sp);
if (cp != NULL && strncmp(cp, "tty", 3) == 0) {
cp = nextword(cp, word);
hl->l_tty = copyin(word, &sp);
}
if (cp != NULL)
hl->l_date = copyin(cp, &sp);
} | [
"void",
"parse",
"(",
"char",
"*",
"line",
",",
"struct",
"headline",
"*",
"hl",
",",
"char",
"*",
"pbuf",
")",
"{",
"char",
"*",
"cp",
",",
"*",
"sp",
";",
"char",
"word",
"[",
"LINESIZE",
"]",
";",
"hl",
"->",
"l_from",
"=",
"NULL",
";",
"hl",
"->",
"l_tty",
"=",
"NULL",
";",
"hl",
"->",
"l_date",
"=",
"NULL",
";",
"cp",
"=",
"line",
";",
"sp",
"=",
"pbuf",
";",
"cp",
"=",
"nextword",
"(",
"cp",
",",
"word",
")",
";",
"if",
"(",
"isdate",
"(",
"cp",
")",
")",
"{",
"hl",
"->",
"l_date",
"=",
"copyin",
"(",
"cp",
",",
"&",
"sp",
")",
";",
"return",
";",
"}",
"cp",
"=",
"nextword",
"(",
"cp",
",",
"word",
")",
";",
"if",
"(",
"strlen",
"(",
"word",
")",
">",
"0",
")",
"hl",
"->",
"l_from",
"=",
"copyin",
"(",
"word",
",",
"&",
"sp",
")",
";",
"if",
"(",
"cp",
"!=",
"NULL",
"&&",
"strncmp",
"(",
"cp",
",",
"\"",
"\"",
",",
"3",
")",
"==",
"0",
")",
"{",
"cp",
"=",
"nextword",
"(",
"cp",
",",
"word",
")",
";",
"hl",
"->",
"l_tty",
"=",
"copyin",
"(",
"word",
",",
"&",
"sp",
")",
";",
"}",
"if",
"(",
"cp",
"!=",
"NULL",
")",
"hl",
"->",
"l_date",
"=",
"copyin",
"(",
"cp",
",",
"&",
"sp",
")",
";",
"}"
] | Split a headline into its useful components. | [
"Split",
"a",
"headline",
"into",
"its",
"useful",
"components",
"."
] | [
"/*\n\t * Skip over \"From\" first.\n\t */",
"/*\n\t * Check for missing return-path.\n\t */"
] | [
{
"param": "line",
"type": "char"
},
{
"param": "hl",
"type": "struct headline"
},
{
"param": "pbuf",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "line",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "hl",
"type": "struct headline",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pbuf",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e5b340669d33abae8f68d13ab408b4ca8a8f4a8 | atrens/DragonFlyBSD-src | usr.bin/mail/head.c | [
"BSD-3-Clause"
] | C | copyin | char | char *
copyin(char *src, char **space)
{
char *cp, *top;
top = cp = *space;
while ((*cp++ = *src++) != '\0')
;
*space = cp;
return (top);
} | /*
* Copy the string on the left into the string on the right
* and bump the right (reference) string pointer by the length.
* Thus, dynamically allocate space in the right string, copying
* the left string into it.
*/ | Copy the string on the left into the string on the right
and bump the right (reference) string pointer by the length.
Thus, dynamically allocate space in the right string, copying
the left string into it. | [
"Copy",
"the",
"string",
"on",
"the",
"left",
"into",
"the",
"string",
"on",
"the",
"right",
"and",
"bump",
"the",
"right",
"(",
"reference",
")",
"string",
"pointer",
"by",
"the",
"length",
".",
"Thus",
"dynamically",
"allocate",
"space",
"in",
"the",
"right",
"string",
"copying",
"the",
"left",
"string",
"into",
"it",
"."
] | char *
copyin(char *src, char **space)
{
char *cp, *top;
top = cp = *space;
while ((*cp++ = *src++) != '\0')
;
*space = cp;
return (top);
} | [
"char",
"*",
"copyin",
"(",
"char",
"*",
"src",
",",
"char",
"*",
"*",
"space",
")",
"{",
"char",
"*",
"cp",
",",
"*",
"top",
";",
"top",
"=",
"cp",
"=",
"*",
"space",
";",
"while",
"(",
"(",
"*",
"cp",
"++",
"=",
"*",
"src",
"++",
")",
"!=",
"'",
"\\0",
"'",
")",
";",
"*",
"space",
"=",
"cp",
";",
"return",
"(",
"top",
")",
";",
"}"
] | Copy the string on the left into the string on the right
and bump the right (reference) string pointer by the length. | [
"Copy",
"the",
"string",
"on",
"the",
"left",
"into",
"the",
"string",
"on",
"the",
"right",
"and",
"bump",
"the",
"right",
"(",
"reference",
")",
"string",
"pointer",
"by",
"the",
"length",
"."
] | [] | [
{
"param": "src",
"type": "char"
},
{
"param": "space",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "src",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "space",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e5b340669d33abae8f68d13ab408b4ca8a8f4a8 | atrens/DragonFlyBSD-src | usr.bin/mail/head.c | [
"BSD-3-Clause"
] | C | cmatch | int | int
cmatch(char *cp, char *tp)
{
while (*cp != '\0' && *tp != '\0')
switch (*tp++) {
case 'a':
if (!islower((unsigned char)*cp++))
return (0);
break;
case 'A':
if (!isupper((unsigned char)*cp++))
return (0);
break;
case ' ':
if (*cp++ != ' ')
return (0);
break;
case '0':
if (!isdigit((unsigned char)*cp++))
return (0);
break;
case 'O':
if (*cp != ' ' && !isdigit((unsigned char)*cp))
return (0);
cp++;
break;
case 'p':
if (!ispunct((unsigned char)*cp++))
return (0);
break;
case 'P':
if (*cp != ' ' && !ispunct((unsigned char)*cp))
return (0);
cp++;
break;
case ':':
if (*cp++ != ':')
return (0);
break;
case 'N':
if (*cp++ != '\n')
return (0);
break;
}
if (*cp != '\0' || *tp != '\0')
return (0);
return (1);
} | /*
* Match the given string (cp) against the given template (tp).
* Return 1 if they match, 0 if they don't
*/ | Match the given string (cp) against the given template (tp).
Return 1 if they match, 0 if they don't | [
"Match",
"the",
"given",
"string",
"(",
"cp",
")",
"against",
"the",
"given",
"template",
"(",
"tp",
")",
".",
"Return",
"1",
"if",
"they",
"match",
"0",
"if",
"they",
"don",
"'",
"t"
] | int
cmatch(char *cp, char *tp)
{
while (*cp != '\0' && *tp != '\0')
switch (*tp++) {
case 'a':
if (!islower((unsigned char)*cp++))
return (0);
break;
case 'A':
if (!isupper((unsigned char)*cp++))
return (0);
break;
case ' ':
if (*cp++ != ' ')
return (0);
break;
case '0':
if (!isdigit((unsigned char)*cp++))
return (0);
break;
case 'O':
if (*cp != ' ' && !isdigit((unsigned char)*cp))
return (0);
cp++;
break;
case 'p':
if (!ispunct((unsigned char)*cp++))
return (0);
break;
case 'P':
if (*cp != ' ' && !ispunct((unsigned char)*cp))
return (0);
cp++;
break;
case ':':
if (*cp++ != ':')
return (0);
break;
case 'N':
if (*cp++ != '\n')
return (0);
break;
}
if (*cp != '\0' || *tp != '\0')
return (0);
return (1);
} | [
"int",
"cmatch",
"(",
"char",
"*",
"cp",
",",
"char",
"*",
"tp",
")",
"{",
"while",
"(",
"*",
"cp",
"!=",
"'",
"\\0",
"'",
"&&",
"*",
"tp",
"!=",
"'",
"\\0",
"'",
")",
"switch",
"(",
"*",
"tp",
"++",
")",
"{",
"case",
"'",
"'",
":",
"if",
"(",
"!",
"islower",
"(",
"(",
"unsigned",
"char",
")",
"*",
"cp",
"++",
")",
")",
"return",
"(",
"0",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"!",
"isupper",
"(",
"(",
"unsigned",
"char",
")",
"*",
"cp",
"++",
")",
")",
"return",
"(",
"0",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"*",
"cp",
"++",
"!=",
"'",
"'",
")",
"return",
"(",
"0",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"!",
"isdigit",
"(",
"(",
"unsigned",
"char",
")",
"*",
"cp",
"++",
")",
")",
"return",
"(",
"0",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"*",
"cp",
"!=",
"'",
"'",
"&&",
"!",
"isdigit",
"(",
"(",
"unsigned",
"char",
")",
"*",
"cp",
")",
")",
"return",
"(",
"0",
")",
";",
"cp",
"++",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"!",
"ispunct",
"(",
"(",
"unsigned",
"char",
")",
"*",
"cp",
"++",
")",
")",
"return",
"(",
"0",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"*",
"cp",
"!=",
"'",
"'",
"&&",
"!",
"ispunct",
"(",
"(",
"unsigned",
"char",
")",
"*",
"cp",
")",
")",
"return",
"(",
"0",
")",
";",
"cp",
"++",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"*",
"cp",
"++",
"!=",
"'",
"'",
")",
"return",
"(",
"0",
")",
";",
"break",
";",
"case",
"'",
"'",
":",
"if",
"(",
"*",
"cp",
"++",
"!=",
"'",
"\\n",
"'",
")",
"return",
"(",
"0",
")",
";",
"break",
";",
"}",
"if",
"(",
"*",
"cp",
"!=",
"'",
"\\0",
"'",
"||",
"*",
"tp",
"!=",
"'",
"\\0",
"'",
")",
"return",
"(",
"0",
")",
";",
"return",
"(",
"1",
")",
";",
"}"
] | Match the given string (cp) against the given template (tp). | [
"Match",
"the",
"given",
"string",
"(",
"cp",
")",
"against",
"the",
"given",
"template",
"(",
"tp",
")",
"."
] | [] | [
{
"param": "cp",
"type": "char"
},
{
"param": "tp",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cp",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "tp",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1e5b340669d33abae8f68d13ab408b4ca8a8f4a8 | atrens/DragonFlyBSD-src | usr.bin/mail/head.c | [
"BSD-3-Clause"
] | C | nextword | char | char *
nextword(char *wp, char *wbuf)
{
int c;
if (wp == NULL) {
*wbuf = '\0';
return (NULL);
}
while ((c = *wp++) != '\0' && c != ' ' && c != '\t') {
*wbuf++ = c;
if (c == '"') {
while ((c = *wp++) != '\0' && c != '"')
*wbuf++ = c;
if (c == '"')
*wbuf++ = c;
else
wp--;
}
}
*wbuf = '\0';
for (; c == ' ' || c == '\t'; c = *wp++)
;
if (c == '\0')
return (NULL);
return (wp - 1);
} | /*
* Collect a liberal (space, tab delimited) word into the word buffer
* passed. Also, return a pointer to the next word following that,
* or NULL if none follow.
*/ | Collect a liberal (space, tab delimited) word into the word buffer
passed. Also, return a pointer to the next word following that,
or NULL if none follow. | [
"Collect",
"a",
"liberal",
"(",
"space",
"tab",
"delimited",
")",
"word",
"into",
"the",
"word",
"buffer",
"passed",
".",
"Also",
"return",
"a",
"pointer",
"to",
"the",
"next",
"word",
"following",
"that",
"or",
"NULL",
"if",
"none",
"follow",
"."
] | char *
nextword(char *wp, char *wbuf)
{
int c;
if (wp == NULL) {
*wbuf = '\0';
return (NULL);
}
while ((c = *wp++) != '\0' && c != ' ' && c != '\t') {
*wbuf++ = c;
if (c == '"') {
while ((c = *wp++) != '\0' && c != '"')
*wbuf++ = c;
if (c == '"')
*wbuf++ = c;
else
wp--;
}
}
*wbuf = '\0';
for (; c == ' ' || c == '\t'; c = *wp++)
;
if (c == '\0')
return (NULL);
return (wp - 1);
} | [
"char",
"*",
"nextword",
"(",
"char",
"*",
"wp",
",",
"char",
"*",
"wbuf",
")",
"{",
"int",
"c",
";",
"if",
"(",
"wp",
"==",
"NULL",
")",
"{",
"*",
"wbuf",
"=",
"'",
"\\0",
"'",
";",
"return",
"(",
"NULL",
")",
";",
"}",
"while",
"(",
"(",
"c",
"=",
"*",
"wp",
"++",
")",
"!=",
"'",
"\\0",
"'",
"&&",
"c",
"!=",
"'",
"'",
"&&",
"c",
"!=",
"'",
"\\t",
"'",
")",
"{",
"*",
"wbuf",
"++",
"=",
"c",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"while",
"(",
"(",
"c",
"=",
"*",
"wp",
"++",
")",
"!=",
"'",
"\\0",
"'",
"&&",
"c",
"!=",
"'",
"'",
")",
"*",
"wbuf",
"++",
"=",
"c",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"*",
"wbuf",
"++",
"=",
"c",
";",
"else",
"wp",
"--",
";",
"}",
"}",
"*",
"wbuf",
"=",
"'",
"\\0",
"'",
";",
"for",
"(",
";",
"c",
"==",
"'",
"'",
"||",
"c",
"==",
"'",
"\\t",
"'",
";",
"c",
"=",
"*",
"wp",
"++",
")",
";",
"if",
"(",
"c",
"==",
"'",
"\\0",
"'",
")",
"return",
"(",
"NULL",
")",
";",
"return",
"(",
"wp",
"-",
"1",
")",
";",
"}"
] | Collect a liberal (space, tab delimited) word into the word buffer
passed. | [
"Collect",
"a",
"liberal",
"(",
"space",
"tab",
"delimited",
")",
"word",
"into",
"the",
"word",
"buffer",
"passed",
"."
] | [] | [
{
"param": "wp",
"type": "char"
},
{
"param": "wbuf",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "wp",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "wbuf",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af0d280e208055dc8088fb4b8394e49998092cc1 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/genmodes.c | [
"BSD-3-Clause"
] | C | complete_mode | void | static void
complete_mode (struct mode_data *m)
{
unsigned int alignment;
if (!m->name)
{
error ("%s:%d: mode with no name", m->file, m->line);
return;
}
if (m->cl == MAX_MODE_CLASS)
{
error ("%s:%d: %smode has no mode class", m->file, m->line, m->name);
return;
}
switch (m->cl)
{
case MODE_RANDOM:
/* Nothing more need be said. */
if (!strcmp (m->name, "VOID"))
void_mode = m;
validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
m->precision = 0;
m->bytesize = 0;
m->ncomponents = 0;
m->component = 0;
break;
case MODE_CC:
/* Again, nothing more need be said. For historical reasons,
the size of a CC mode is four units. */
validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
m->bytesize = 4;
m->ncomponents = 1;
m->component = 0;
break;
case MODE_INT:
case MODE_POINTER_BOUNDS:
case MODE_FLOAT:
case MODE_DECIMAL_FLOAT:
case MODE_FRACT:
case MODE_UFRACT:
case MODE_ACCUM:
case MODE_UACCUM:
/* A scalar mode must have a byte size, may have a bit size,
and must not have components. A float mode must have a
format. */
validate_mode (m, OPTIONAL, SET, UNSET, UNSET,
(m->cl == MODE_FLOAT || m->cl == MODE_DECIMAL_FLOAT)
? SET : UNSET);
m->ncomponents = 1;
m->component = 0;
break;
case MODE_PARTIAL_INT:
/* A partial integer mode uses ->component to say what the
corresponding full-size integer mode is, and may also
specify a bit size. */
validate_mode (m, OPTIONAL, UNSET, SET, UNSET, UNSET);
m->bytesize = m->component->bytesize;
m->ncomponents = 1;
break;
case MODE_COMPLEX_INT:
case MODE_COMPLEX_FLOAT:
/* Complex modes should have a component indicated, but no more. */
validate_mode (m, UNSET, UNSET, SET, UNSET, UNSET);
m->ncomponents = 2;
if (m->component->precision != (unsigned int)-1)
m->precision = 2 * m->component->precision;
m->bytesize = 2 * m->component->bytesize;
break;
case MODE_VECTOR_BOOL:
validate_mode (m, UNSET, SET, SET, SET, UNSET);
break;
case MODE_VECTOR_INT:
case MODE_VECTOR_FLOAT:
case MODE_VECTOR_FRACT:
case MODE_VECTOR_UFRACT:
case MODE_VECTOR_ACCUM:
case MODE_VECTOR_UACCUM:
/* Vector modes should have a component and a number of components. */
validate_mode (m, UNSET, UNSET, SET, SET, UNSET);
if (m->component->precision != (unsigned int)-1)
m->precision = m->ncomponents * m->component->precision;
m->bytesize = m->ncomponents * m->component->bytesize;
break;
default:
gcc_unreachable ();
}
/* If not already specified, the mode alignment defaults to the largest
power of two that divides the size of the object. Complex types are
not more aligned than their contents. */
if (m->cl == MODE_COMPLEX_INT || m->cl == MODE_COMPLEX_FLOAT)
alignment = m->component->bytesize;
else
alignment = m->bytesize;
m->alignment = alignment & (~alignment + 1);
/* If this mode has components, make the component mode point back
to this mode, for the sake of adjustments. */
if (m->component)
{
m->next_cont = m->component->contained;
m->component->contained = m;
}
} | /* Given a partially-filled-out mode structure, figure out what we can
and fill the rest of it in; die if it isn't enough. */ | Given a partially-filled-out mode structure, figure out what we can
and fill the rest of it in; die if it isn't enough. | [
"Given",
"a",
"partially",
"-",
"filled",
"-",
"out",
"mode",
"structure",
"figure",
"out",
"what",
"we",
"can",
"and",
"fill",
"the",
"rest",
"of",
"it",
"in",
";",
"die",
"if",
"it",
"isn",
"'",
"t",
"enough",
"."
] | static void
complete_mode (struct mode_data *m)
{
unsigned int alignment;
if (!m->name)
{
error ("%s:%d: mode with no name", m->file, m->line);
return;
}
if (m->cl == MAX_MODE_CLASS)
{
error ("%s:%d: %smode has no mode class", m->file, m->line, m->name);
return;
}
switch (m->cl)
{
case MODE_RANDOM:
if (!strcmp (m->name, "VOID"))
void_mode = m;
validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
m->precision = 0;
m->bytesize = 0;
m->ncomponents = 0;
m->component = 0;
break;
case MODE_CC:
validate_mode (m, UNSET, UNSET, UNSET, UNSET, UNSET);
m->bytesize = 4;
m->ncomponents = 1;
m->component = 0;
break;
case MODE_INT:
case MODE_POINTER_BOUNDS:
case MODE_FLOAT:
case MODE_DECIMAL_FLOAT:
case MODE_FRACT:
case MODE_UFRACT:
case MODE_ACCUM:
case MODE_UACCUM:
validate_mode (m, OPTIONAL, SET, UNSET, UNSET,
(m->cl == MODE_FLOAT || m->cl == MODE_DECIMAL_FLOAT)
? SET : UNSET);
m->ncomponents = 1;
m->component = 0;
break;
case MODE_PARTIAL_INT:
validate_mode (m, OPTIONAL, UNSET, SET, UNSET, UNSET);
m->bytesize = m->component->bytesize;
m->ncomponents = 1;
break;
case MODE_COMPLEX_INT:
case MODE_COMPLEX_FLOAT:
validate_mode (m, UNSET, UNSET, SET, UNSET, UNSET);
m->ncomponents = 2;
if (m->component->precision != (unsigned int)-1)
m->precision = 2 * m->component->precision;
m->bytesize = 2 * m->component->bytesize;
break;
case MODE_VECTOR_BOOL:
validate_mode (m, UNSET, SET, SET, SET, UNSET);
break;
case MODE_VECTOR_INT:
case MODE_VECTOR_FLOAT:
case MODE_VECTOR_FRACT:
case MODE_VECTOR_UFRACT:
case MODE_VECTOR_ACCUM:
case MODE_VECTOR_UACCUM:
validate_mode (m, UNSET, UNSET, SET, SET, UNSET);
if (m->component->precision != (unsigned int)-1)
m->precision = m->ncomponents * m->component->precision;
m->bytesize = m->ncomponents * m->component->bytesize;
break;
default:
gcc_unreachable ();
}
if (m->cl == MODE_COMPLEX_INT || m->cl == MODE_COMPLEX_FLOAT)
alignment = m->component->bytesize;
else
alignment = m->bytesize;
m->alignment = alignment & (~alignment + 1);
if (m->component)
{
m->next_cont = m->component->contained;
m->component->contained = m;
}
} | [
"static",
"void",
"complete_mode",
"(",
"struct",
"mode_data",
"*",
"m",
")",
"{",
"unsigned",
"int",
"alignment",
";",
"if",
"(",
"!",
"m",
"->",
"name",
")",
"{",
"error",
"(",
"\"",
"\"",
",",
"m",
"->",
"file",
",",
"m",
"->",
"line",
")",
";",
"return",
";",
"}",
"if",
"(",
"m",
"->",
"cl",
"==",
"MAX_MODE_CLASS",
")",
"{",
"error",
"(",
"\"",
"\"",
",",
"m",
"->",
"file",
",",
"m",
"->",
"line",
",",
"m",
"->",
"name",
")",
";",
"return",
";",
"}",
"switch",
"(",
"m",
"->",
"cl",
")",
"{",
"case",
"MODE_RANDOM",
":",
"if",
"(",
"!",
"strcmp",
"(",
"m",
"->",
"name",
",",
"\"",
"\"",
")",
")",
"void_mode",
"=",
"m",
";",
"validate_mode",
"(",
"m",
",",
"UNSET",
",",
"UNSET",
",",
"UNSET",
",",
"UNSET",
",",
"UNSET",
")",
";",
"m",
"->",
"precision",
"=",
"0",
";",
"m",
"->",
"bytesize",
"=",
"0",
";",
"m",
"->",
"ncomponents",
"=",
"0",
";",
"m",
"->",
"component",
"=",
"0",
";",
"break",
";",
"case",
"MODE_CC",
":",
"validate_mode",
"(",
"m",
",",
"UNSET",
",",
"UNSET",
",",
"UNSET",
",",
"UNSET",
",",
"UNSET",
")",
";",
"m",
"->",
"bytesize",
"=",
"4",
";",
"m",
"->",
"ncomponents",
"=",
"1",
";",
"m",
"->",
"component",
"=",
"0",
";",
"break",
";",
"case",
"MODE_INT",
":",
"case",
"MODE_POINTER_BOUNDS",
":",
"case",
"MODE_FLOAT",
":",
"case",
"MODE_DECIMAL_FLOAT",
":",
"case",
"MODE_FRACT",
":",
"case",
"MODE_UFRACT",
":",
"case",
"MODE_ACCUM",
":",
"case",
"MODE_UACCUM",
":",
"validate_mode",
"(",
"m",
",",
"OPTIONAL",
",",
"SET",
",",
"UNSET",
",",
"UNSET",
",",
"(",
"m",
"->",
"cl",
"==",
"MODE_FLOAT",
"||",
"m",
"->",
"cl",
"==",
"MODE_DECIMAL_FLOAT",
")",
"?",
"SET",
":",
"UNSET",
")",
";",
"m",
"->",
"ncomponents",
"=",
"1",
";",
"m",
"->",
"component",
"=",
"0",
";",
"break",
";",
"case",
"MODE_PARTIAL_INT",
":",
"validate_mode",
"(",
"m",
",",
"OPTIONAL",
",",
"UNSET",
",",
"SET",
",",
"UNSET",
",",
"UNSET",
")",
";",
"m",
"->",
"bytesize",
"=",
"m",
"->",
"component",
"->",
"bytesize",
";",
"m",
"->",
"ncomponents",
"=",
"1",
";",
"break",
";",
"case",
"MODE_COMPLEX_INT",
":",
"case",
"MODE_COMPLEX_FLOAT",
":",
"validate_mode",
"(",
"m",
",",
"UNSET",
",",
"UNSET",
",",
"SET",
",",
"UNSET",
",",
"UNSET",
")",
";",
"m",
"->",
"ncomponents",
"=",
"2",
";",
"if",
"(",
"m",
"->",
"component",
"->",
"precision",
"!=",
"(",
"unsigned",
"int",
")",
"-1",
")",
"m",
"->",
"precision",
"=",
"2",
"*",
"m",
"->",
"component",
"->",
"precision",
";",
"m",
"->",
"bytesize",
"=",
"2",
"*",
"m",
"->",
"component",
"->",
"bytesize",
";",
"break",
";",
"case",
"MODE_VECTOR_BOOL",
":",
"validate_mode",
"(",
"m",
",",
"UNSET",
",",
"SET",
",",
"SET",
",",
"SET",
",",
"UNSET",
")",
";",
"break",
";",
"case",
"MODE_VECTOR_INT",
":",
"case",
"MODE_VECTOR_FLOAT",
":",
"case",
"MODE_VECTOR_FRACT",
":",
"case",
"MODE_VECTOR_UFRACT",
":",
"case",
"MODE_VECTOR_ACCUM",
":",
"case",
"MODE_VECTOR_UACCUM",
":",
"validate_mode",
"(",
"m",
",",
"UNSET",
",",
"UNSET",
",",
"SET",
",",
"SET",
",",
"UNSET",
")",
";",
"if",
"(",
"m",
"->",
"component",
"->",
"precision",
"!=",
"(",
"unsigned",
"int",
")",
"-1",
")",
"m",
"->",
"precision",
"=",
"m",
"->",
"ncomponents",
"*",
"m",
"->",
"component",
"->",
"precision",
";",
"m",
"->",
"bytesize",
"=",
"m",
"->",
"ncomponents",
"*",
"m",
"->",
"component",
"->",
"bytesize",
";",
"break",
";",
"default",
":",
"gcc_unreachable",
"(",
")",
";",
"}",
"if",
"(",
"m",
"->",
"cl",
"==",
"MODE_COMPLEX_INT",
"||",
"m",
"->",
"cl",
"==",
"MODE_COMPLEX_FLOAT",
")",
"alignment",
"=",
"m",
"->",
"component",
"->",
"bytesize",
";",
"else",
"alignment",
"=",
"m",
"->",
"bytesize",
";",
"m",
"->",
"alignment",
"=",
"alignment",
"&",
"(",
"~",
"alignment",
"+",
"1",
")",
";",
"if",
"(",
"m",
"->",
"component",
")",
"{",
"m",
"->",
"next_cont",
"=",
"m",
"->",
"component",
"->",
"contained",
";",
"m",
"->",
"component",
"->",
"contained",
"=",
"m",
";",
"}",
"}"
] | Given a partially-filled-out mode structure, figure out what we can
and fill the rest of it in; die if it isn't enough. | [
"Given",
"a",
"partially",
"-",
"filled",
"-",
"out",
"mode",
"structure",
"figure",
"out",
"what",
"we",
"can",
"and",
"fill",
"the",
"rest",
"of",
"it",
"in",
";",
"die",
"if",
"it",
"isn",
"'",
"t",
"enough",
"."
] | [
"/* Nothing more need be said. */",
"/* Again, nothing more need be said. For historical reasons,\n\t the size of a CC mode is four units. */",
"/* A scalar mode must have a byte size, may have a bit size,\n\t and must not have components. A float mode must have a\n format. */",
"/* A partial integer mode uses ->component to say what the\n\t corresponding full-size integer mode is, and may also\n\t specify a bit size. */",
"/* Complex modes should have a component indicated, but no more. */",
"/* Vector modes should have a component and a number of components. */",
"/* If not already specified, the mode alignment defaults to the largest\n power of two that divides the size of the object. Complex types are\n not more aligned than their contents. */",
"/* If this mode has components, make the component mode point back\n to this mode, for the sake of adjustments. */"
] | [
{
"param": "m",
"type": "struct mode_data"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "m",
"type": "struct mode_data",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af0d280e208055dc8088fb4b8394e49998092cc1 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/genmodes.c | [
"BSD-3-Clause"
] | C | cmp_modes | int | static int
cmp_modes (const void *a, const void *b)
{
const struct mode_data *const m = *(const struct mode_data *const*)a;
const struct mode_data *const n = *(const struct mode_data *const*)b;
if (m->bytesize > n->bytesize)
return 1;
else if (m->bytesize < n->bytesize)
return -1;
if (m->precision > n->precision)
return 1;
else if (m->precision < n->precision)
return -1;
if (!m->component && !n->component)
{
if (m->counter < n->counter)
return -1;
else
return 1;
}
if (m->component->bytesize > n->component->bytesize)
return 1;
else if (m->component->bytesize < n->component->bytesize)
return -1;
if (m->component->precision > n->component->precision)
return 1;
else if (m->component->precision < n->component->precision)
return -1;
if (m->counter < n->counter)
return -1;
else
return 1;
} | /* Sort a list of modes into the order needed for the WIDER field:
major sort by precision, minor sort by component precision.
For instance:
QI < HI < SI < DI < TI
V4QI < V2HI < V8QI < V4HI < V2SI.
If the precision is not set, sort by the bytesize. A mode with
precision set gets sorted before a mode without precision set, if
they have the same bytesize; this is the right thing because
the precision must always be smaller than the bytesize * BITS_PER_UNIT.
We don't have to do anything special to get this done -- an unset
precision shows up as (unsigned int)-1, i.e. UINT_MAX. */ | Sort a list of modes into the order needed for the WIDER field:
major sort by precision, minor sort by component precision.
If the precision is not set, sort by the bytesize. A mode with
precision set gets sorted before a mode without precision set, if
they have the same bytesize; this is the right thing because
the precision must always be smaller than the bytesize * BITS_PER_UNIT.
We don't have to do anything special to get this done -- an unset
precision shows up as (unsigned int)-1, i.e. | [
"Sort",
"a",
"list",
"of",
"modes",
"into",
"the",
"order",
"needed",
"for",
"the",
"WIDER",
"field",
":",
"major",
"sort",
"by",
"precision",
"minor",
"sort",
"by",
"component",
"precision",
".",
"If",
"the",
"precision",
"is",
"not",
"set",
"sort",
"by",
"the",
"bytesize",
".",
"A",
"mode",
"with",
"precision",
"set",
"gets",
"sorted",
"before",
"a",
"mode",
"without",
"precision",
"set",
"if",
"they",
"have",
"the",
"same",
"bytesize",
";",
"this",
"is",
"the",
"right",
"thing",
"because",
"the",
"precision",
"must",
"always",
"be",
"smaller",
"than",
"the",
"bytesize",
"*",
"BITS_PER_UNIT",
".",
"We",
"don",
"'",
"t",
"have",
"to",
"do",
"anything",
"special",
"to",
"get",
"this",
"done",
"--",
"an",
"unset",
"precision",
"shows",
"up",
"as",
"(",
"unsigned",
"int",
")",
"-",
"1",
"i",
".",
"e",
"."
] | static int
cmp_modes (const void *a, const void *b)
{
const struct mode_data *const m = *(const struct mode_data *const*)a;
const struct mode_data *const n = *(const struct mode_data *const*)b;
if (m->bytesize > n->bytesize)
return 1;
else if (m->bytesize < n->bytesize)
return -1;
if (m->precision > n->precision)
return 1;
else if (m->precision < n->precision)
return -1;
if (!m->component && !n->component)
{
if (m->counter < n->counter)
return -1;
else
return 1;
}
if (m->component->bytesize > n->component->bytesize)
return 1;
else if (m->component->bytesize < n->component->bytesize)
return -1;
if (m->component->precision > n->component->precision)
return 1;
else if (m->component->precision < n->component->precision)
return -1;
if (m->counter < n->counter)
return -1;
else
return 1;
} | [
"static",
"int",
"cmp_modes",
"(",
"const",
"void",
"*",
"a",
",",
"const",
"void",
"*",
"b",
")",
"{",
"const",
"struct",
"mode_data",
"*",
"const",
"m",
"=",
"*",
"(",
"const",
"struct",
"mode_data",
"*",
"const",
"*",
")",
"a",
";",
"const",
"struct",
"mode_data",
"*",
"const",
"n",
"=",
"*",
"(",
"const",
"struct",
"mode_data",
"*",
"const",
"*",
")",
"b",
";",
"if",
"(",
"m",
"->",
"bytesize",
">",
"n",
"->",
"bytesize",
")",
"return",
"1",
";",
"else",
"if",
"(",
"m",
"->",
"bytesize",
"<",
"n",
"->",
"bytesize",
")",
"return",
"-1",
";",
"if",
"(",
"m",
"->",
"precision",
">",
"n",
"->",
"precision",
")",
"return",
"1",
";",
"else",
"if",
"(",
"m",
"->",
"precision",
"<",
"n",
"->",
"precision",
")",
"return",
"-1",
";",
"if",
"(",
"!",
"m",
"->",
"component",
"&&",
"!",
"n",
"->",
"component",
")",
"{",
"if",
"(",
"m",
"->",
"counter",
"<",
"n",
"->",
"counter",
")",
"return",
"-1",
";",
"else",
"return",
"1",
";",
"}",
"if",
"(",
"m",
"->",
"component",
"->",
"bytesize",
">",
"n",
"->",
"component",
"->",
"bytesize",
")",
"return",
"1",
";",
"else",
"if",
"(",
"m",
"->",
"component",
"->",
"bytesize",
"<",
"n",
"->",
"component",
"->",
"bytesize",
")",
"return",
"-1",
";",
"if",
"(",
"m",
"->",
"component",
"->",
"precision",
">",
"n",
"->",
"component",
"->",
"precision",
")",
"return",
"1",
";",
"else",
"if",
"(",
"m",
"->",
"component",
"->",
"precision",
"<",
"n",
"->",
"component",
"->",
"precision",
")",
"return",
"-1",
";",
"if",
"(",
"m",
"->",
"counter",
"<",
"n",
"->",
"counter",
")",
"return",
"-1",
";",
"else",
"return",
"1",
";",
"}"
] | Sort a list of modes into the order needed for the WIDER field:
major sort by precision, minor sort by component precision. | [
"Sort",
"a",
"list",
"of",
"modes",
"into",
"the",
"order",
"needed",
"for",
"the",
"WIDER",
"field",
":",
"major",
"sort",
"by",
"precision",
"minor",
"sort",
"by",
"component",
"precision",
"."
] | [] | [
{
"param": "a",
"type": "void"
},
{
"param": "b",
"type": "void"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "a",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "b",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
af0d280e208055dc8088fb4b8394e49998092cc1 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/genmodes.c | [
"BSD-3-Clause"
] | C | emit_max_int | void | static void
emit_max_int (void)
{
unsigned int max, mmax;
struct mode_data *i;
int j;
puts ("");
printf ("#define BITS_PER_UNIT (%d)\n", bits_per_unit);
if (max_bitsize_mode_any_int == 0)
{
for (max = 1, i = modes[MODE_INT]; i; i = i->next)
if (max < i->bytesize)
max = i->bytesize;
mmax = max;
for (max = 1, i = modes[MODE_PARTIAL_INT]; i; i = i->next)
if (max < i->bytesize)
max = i->bytesize;
if (max > mmax)
mmax = max;
printf ("#define MAX_BITSIZE_MODE_ANY_INT (%d*BITS_PER_UNIT)\n", mmax);
}
else
printf ("#define MAX_BITSIZE_MODE_ANY_INT %d\n", max_bitsize_mode_any_int);
if (max_bitsize_mode_any_mode == 0)
{
mmax = 0;
for (j = 0; j < MAX_MODE_CLASS; j++)
for (i = modes[j]; i; i = i->next)
if (mmax < i->bytesize)
mmax = i->bytesize;
printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax);
}
else
printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d\n",
max_bitsize_mode_any_mode);
} | /* Compute the max bitsize of some of the classes of integers. It may
be that there are needs for the other integer classes, and this
code is easy to extend. */ | Compute the max bitsize of some of the classes of integers. It may
be that there are needs for the other integer classes, and this
code is easy to extend. | [
"Compute",
"the",
"max",
"bitsize",
"of",
"some",
"of",
"the",
"classes",
"of",
"integers",
".",
"It",
"may",
"be",
"that",
"there",
"are",
"needs",
"for",
"the",
"other",
"integer",
"classes",
"and",
"this",
"code",
"is",
"easy",
"to",
"extend",
"."
] | static void
emit_max_int (void)
{
unsigned int max, mmax;
struct mode_data *i;
int j;
puts ("");
printf ("#define BITS_PER_UNIT (%d)\n", bits_per_unit);
if (max_bitsize_mode_any_int == 0)
{
for (max = 1, i = modes[MODE_INT]; i; i = i->next)
if (max < i->bytesize)
max = i->bytesize;
mmax = max;
for (max = 1, i = modes[MODE_PARTIAL_INT]; i; i = i->next)
if (max < i->bytesize)
max = i->bytesize;
if (max > mmax)
mmax = max;
printf ("#define MAX_BITSIZE_MODE_ANY_INT (%d*BITS_PER_UNIT)\n", mmax);
}
else
printf ("#define MAX_BITSIZE_MODE_ANY_INT %d\n", max_bitsize_mode_any_int);
if (max_bitsize_mode_any_mode == 0)
{
mmax = 0;
for (j = 0; j < MAX_MODE_CLASS; j++)
for (i = modes[j]; i; i = i->next)
if (mmax < i->bytesize)
mmax = i->bytesize;
printf ("#define MAX_BITSIZE_MODE_ANY_MODE (%d*BITS_PER_UNIT)\n", mmax);
}
else
printf ("#define MAX_BITSIZE_MODE_ANY_MODE %d\n",
max_bitsize_mode_any_mode);
} | [
"static",
"void",
"emit_max_int",
"(",
"void",
")",
"{",
"unsigned",
"int",
"max",
",",
"mmax",
";",
"struct",
"mode_data",
"*",
"i",
";",
"int",
"j",
";",
"puts",
"(",
"\"",
"\"",
")",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"bits_per_unit",
")",
";",
"if",
"(",
"max_bitsize_mode_any_int",
"==",
"0",
")",
"{",
"for",
"(",
"max",
"=",
"1",
",",
"i",
"=",
"modes",
"[",
"MODE_INT",
"]",
";",
"i",
";",
"i",
"=",
"i",
"->",
"next",
")",
"if",
"(",
"max",
"<",
"i",
"->",
"bytesize",
")",
"max",
"=",
"i",
"->",
"bytesize",
";",
"mmax",
"=",
"max",
";",
"for",
"(",
"max",
"=",
"1",
",",
"i",
"=",
"modes",
"[",
"MODE_PARTIAL_INT",
"]",
";",
"i",
";",
"i",
"=",
"i",
"->",
"next",
")",
"if",
"(",
"max",
"<",
"i",
"->",
"bytesize",
")",
"max",
"=",
"i",
"->",
"bytesize",
";",
"if",
"(",
"max",
">",
"mmax",
")",
"mmax",
"=",
"max",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"mmax",
")",
";",
"}",
"else",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"max_bitsize_mode_any_int",
")",
";",
"if",
"(",
"max_bitsize_mode_any_mode",
"==",
"0",
")",
"{",
"mmax",
"=",
"0",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"MAX_MODE_CLASS",
";",
"j",
"++",
")",
"for",
"(",
"i",
"=",
"modes",
"[",
"j",
"]",
";",
"i",
";",
"i",
"=",
"i",
"->",
"next",
")",
"if",
"(",
"mmax",
"<",
"i",
"->",
"bytesize",
")",
"mmax",
"=",
"i",
"->",
"bytesize",
";",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"mmax",
")",
";",
"}",
"else",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"max_bitsize_mode_any_mode",
")",
";",
"}"
] | Compute the max bitsize of some of the classes of integers. | [
"Compute",
"the",
"max",
"bitsize",
"of",
"some",
"of",
"the",
"classes",
"of",
"integers",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
af0d280e208055dc8088fb4b8394e49998092cc1 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/genmodes.c | [
"BSD-3-Clause"
] | C | emit_mode_nunits_inline | void | static void
emit_mode_nunits_inline (void)
{
int c;
struct mode_data *m;
for (mode_adjust *a = adj_nunits; a; a = a->next)
a->mode->need_nunits_adj = true;
printf ("\
#ifdef __cplusplus\n\
inline __attribute__((__always_inline__))\n\
#else\n\
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
#endif\n\
poly_uint16\n\
mode_nunits_inline (machine_mode mode)\n\
{\n\
extern %spoly_uint16_pod mode_nunits[NUM_MACHINE_MODES];\n\
switch (mode)\n\
{\n", adj_nunits ? "" : "const ");
for_all_modes (c, m)
if (!m->need_nunits_adj)
printf (" case E_%smode: return %u;\n", m->name, m->ncomponents);
puts ("\
default: return mode_nunits[mode];\n\
}\n\
}\n");
} | /* Emit mode_nunits_inline routine into insn-modes.h header. */ | Emit mode_nunits_inline routine into insn-modes.h header. | [
"Emit",
"mode_nunits_inline",
"routine",
"into",
"insn",
"-",
"modes",
".",
"h",
"header",
"."
] | static void
emit_mode_nunits_inline (void)
{
int c;
struct mode_data *m;
for (mode_adjust *a = adj_nunits; a; a = a->next)
a->mode->need_nunits_adj = true;
printf ("\
#ifdef __cplusplus\n\
inline __attribute__((__always_inline__))\n\
#else\n\
extern __inline__ __attribute__((__always_inline__, __gnu_inline__))\n\
#endif\n\
poly_uint16\n\
mode_nunits_inline (machine_mode mode)\n\
{\n\
extern %spoly_uint16_pod mode_nunits[NUM_MACHINE_MODES];\n\
switch (mode)\n\
{\n", adj_nunits ? "" : "const ");
for_all_modes (c, m)
if (!m->need_nunits_adj)
printf (" case E_%smode: return %u;\n", m->name, m->ncomponents);
puts ("\
default: return mode_nunits[mode];\n\
}\n\
}\n");
} | [
"static",
"void",
"emit_mode_nunits_inline",
"(",
"void",
")",
"{",
"int",
"c",
";",
"struct",
"mode_data",
"*",
"m",
";",
"for",
"(",
"mode_adjust",
"*",
"a",
"=",
"adj_nunits",
";",
"a",
";",
"a",
"=",
"a",
"->",
"next",
")",
"a",
"->",
"mode",
"->",
"need_nunits_adj",
"=",
"true",
";",
"printf",
"(",
"\"",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\"",
",",
"adj_nunits",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"for_all_modes",
"(",
"c",
",",
"m",
")",
"",
"if",
"(",
"!",
"m",
"->",
"need_nunits_adj",
")",
"printf",
"(",
"\"",
"\\n",
"\"",
",",
"m",
"->",
"name",
",",
"m",
"->",
"ncomponents",
")",
";",
"puts",
"(",
"\"",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\\\n",
"\\n",
"\"",
")",
";",
"}"
] | Emit mode_nunits_inline routine into insn-modes.h header. | [
"Emit",
"mode_nunits_inline",
"routine",
"into",
"insn",
"-",
"modes",
".",
"h",
"header",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
af0d280e208055dc8088fb4b8394e49998092cc1 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/genmodes.c | [
"BSD-3-Clause"
] | C | emit_mode_ibit | void | static void
emit_mode_ibit (void)
{
int c;
struct mode_data *m;
print_maybe_const_decl ("%sunsigned char",
"mode_ibit", "NUM_MACHINE_MODES",
adj_ibit);
for_all_modes (c, m)
tagged_printf ("%u", m->ibit, m->name);
print_closer ();
} | /* Emit ibit for all modes. */ | Emit ibit for all modes. | [
"Emit",
"ibit",
"for",
"all",
"modes",
"."
] | static void
emit_mode_ibit (void)
{
int c;
struct mode_data *m;
print_maybe_const_decl ("%sunsigned char",
"mode_ibit", "NUM_MACHINE_MODES",
adj_ibit);
for_all_modes (c, m)
tagged_printf ("%u", m->ibit, m->name);
print_closer ();
} | [
"static",
"void",
"emit_mode_ibit",
"(",
"void",
")",
"{",
"int",
"c",
";",
"struct",
"mode_data",
"*",
"m",
";",
"print_maybe_const_decl",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"adj_ibit",
")",
";",
"for_all_modes",
"(",
"c",
",",
"m",
")",
"",
"tagged_printf",
"(",
"\"",
"\"",
",",
"m",
"->",
"ibit",
",",
"m",
"->",
"name",
")",
";",
"print_closer",
"(",
")",
";",
"}"
] | Emit ibit for all modes. | [
"Emit",
"ibit",
"for",
"all",
"modes",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
af0d280e208055dc8088fb4b8394e49998092cc1 | atrens/DragonFlyBSD-src | contrib/gcc-8.0/gcc/genmodes.c | [
"BSD-3-Clause"
] | C | emit_mode_fbit | void | static void
emit_mode_fbit (void)
{
int c;
struct mode_data *m;
print_maybe_const_decl ("%sunsigned char",
"mode_fbit", "NUM_MACHINE_MODES",
adj_fbit);
for_all_modes (c, m)
tagged_printf ("%u", m->fbit, m->name);
print_closer ();
} | /* Emit fbit for all modes. */ | Emit fbit for all modes. | [
"Emit",
"fbit",
"for",
"all",
"modes",
"."
] | static void
emit_mode_fbit (void)
{
int c;
struct mode_data *m;
print_maybe_const_decl ("%sunsigned char",
"mode_fbit", "NUM_MACHINE_MODES",
adj_fbit);
for_all_modes (c, m)
tagged_printf ("%u", m->fbit, m->name);
print_closer ();
} | [
"static",
"void",
"emit_mode_fbit",
"(",
"void",
")",
"{",
"int",
"c",
";",
"struct",
"mode_data",
"*",
"m",
";",
"print_maybe_const_decl",
"(",
"\"",
"\"",
",",
"\"",
"\"",
",",
"\"",
"\"",
",",
"adj_fbit",
")",
";",
"for_all_modes",
"(",
"c",
",",
"m",
")",
"",
"tagged_printf",
"(",
"\"",
"\"",
",",
"m",
"->",
"fbit",
",",
"m",
"->",
"name",
")",
";",
"print_closer",
"(",
")",
";",
"}"
] | Emit fbit for all modes. | [
"Emit",
"fbit",
"for",
"all",
"modes",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_open | void | void
dbg_open(const char *fn)
{
if (fn) {
dbg_log=fopen(fn, "a");
} else {
dbg_log_isstdout = 1;
dbg_log=stdout;
}
return;
} | /* ********************************************************** dbg_open ***** */
/*
* Open the filehandle where all debug output has to go.
*/ | dbg_open
Open the filehandle where all debug output has to go. | [
"dbg_open",
"Open",
"the",
"filehandle",
"where",
"all",
"debug",
"output",
"has",
"to",
"go",
"."
] | void
dbg_open(const char *fn)
{
if (fn) {
dbg_log=fopen(fn, "a");
} else {
dbg_log_isstdout = 1;
dbg_log=stdout;
}
return;
} | [
"void",
"dbg_open",
"(",
"const",
"char",
"*",
"fn",
")",
"{",
"if",
"(",
"fn",
")",
"{",
"dbg_log",
"=",
"fopen",
"(",
"fn",
",",
"\"",
"\"",
")",
";",
"}",
"else",
"{",
"dbg_log_isstdout",
"=",
"1",
";",
"dbg_log",
"=",
"stdout",
";",
"}",
"return",
";",
"}"
] | dbg_open
Open the filehandle where all debug output has to go. | [
"dbg_open",
"Open",
"the",
"filehandle",
"where",
"all",
"debug",
"output",
"has",
"to",
"go",
"."
] | [] | [
{
"param": "fn",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "fn",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_close | void | void
dbg_close(void)
{
if (dbg_log && dbg_log_isstdout == 0) {
fclose(dbg_log);
}
dbg_log = NULL;
dbg_log_isstdout = 0;
return;
} | /* ********************************************************* dbg_close ***** */
/*
* Close the filehandle where all debug output went to.
*/ | dbg_close
Close the filehandle where all debug output went to. | [
"dbg_close",
"Close",
"the",
"filehandle",
"where",
"all",
"debug",
"output",
"went",
"to",
"."
] | void
dbg_close(void)
{
if (dbg_log && dbg_log_isstdout == 0) {
fclose(dbg_log);
}
dbg_log = NULL;
dbg_log_isstdout = 0;
return;
} | [
"void",
"dbg_close",
"(",
"void",
")",
"{",
"if",
"(",
"dbg_log",
"&&",
"dbg_log_isstdout",
"==",
"0",
")",
"{",
"fclose",
"(",
"dbg_log",
")",
";",
"}",
"dbg_log",
"=",
"NULL",
";",
"dbg_log_isstdout",
"=",
"0",
";",
"return",
";",
"}"
] | dbg_close
Close the filehandle where all debug output went to. | [
"dbg_close",
"Close",
"the",
"filehandle",
"where",
"all",
"debug",
"output",
"went",
"to",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_dump_hex | void | void
dbg_dump_hex(struct fs *sb, const char *comment, unsigned char *mem)
{
int i, j, k;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START HEXDUMP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)mem, comment);
indent++;
for (i=0; i<sb->fs_bsize; i+=24) {
for (j=0; j<3; j++) {
for (k=0; k<8; k++) {
fprintf(dbg_log, "%02x ", *mem++);
}
fprintf(dbg_log, " ");
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END HEXDUMP =====\n");
return;
} | /* ****************************************************** dbg_dump_hex ***** */
/*
* Dump out a full filesystem block in hex.
*/ | dbg_dump_hex
Dump out a full filesystem block in hex. | [
"dbg_dump_hex",
"Dump",
"out",
"a",
"full",
"filesystem",
"block",
"in",
"hex",
"."
] | void
dbg_dump_hex(struct fs *sb, const char *comment, unsigned char *mem)
{
int i, j, k;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START HEXDUMP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)mem, comment);
indent++;
for (i=0; i<sb->fs_bsize; i+=24) {
for (j=0; j<3; j++) {
for (k=0; k<8; k++) {
fprintf(dbg_log, "%02x ", *mem++);
}
fprintf(dbg_log, " ");
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END HEXDUMP =====\n");
return;
} | [
"void",
"dbg_dump_hex",
"(",
"struct",
"fs",
"*",
"sb",
",",
"const",
"char",
"*",
"comment",
",",
"unsigned",
"char",
"*",
"mem",
")",
"{",
"int",
"i",
",",
"j",
",",
"k",
";",
"if",
"(",
"!",
"dbg_log",
")",
"{",
"return",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"indent",
",",
"(",
"unsigned",
"long",
")",
"mem",
",",
"comment",
")",
";",
"indent",
"++",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"sb",
"->",
"fs_bsize",
";",
"i",
"+=",
"24",
")",
"{",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"3",
";",
"j",
"++",
")",
"{",
"for",
"(",
"k",
"=",
"0",
";",
"k",
"<",
"8",
";",
"k",
"++",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"*",
"mem",
"++",
")",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
")",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"indent",
"--",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | dbg_dump_hex
Dump out a full filesystem block in hex. | [
"dbg_dump_hex",
"Dump",
"out",
"a",
"full",
"filesystem",
"block",
"in",
"hex",
"."
] | [] | [
{
"param": "sb",
"type": "struct fs"
},
{
"param": "comment",
"type": "char"
},
{
"param": "mem",
"type": "unsigned char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sb",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comment",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "mem",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_dump_inmap | void | void
dbg_dump_inmap(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k,l,e;
unsigned char *cp;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START INODE ALLOCATION MAP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
cp=(unsigned char *)cg_inosused(cgr);
e=sb->fs_ipg/8;
for(j=0; j<e; j+=32) {
fprintf(dbg_log, "%08x: ", j);
for(k=0; k<32; k+=8) {
if(j+k+8<e) {
fprintf(dbg_log,
"%02x%02x%02x%02x%02x%02x%02x%02x ",
cp[0], cp[1], cp[2], cp[3],
cp[4], cp[5], cp[6], cp[7]);
} else {
for(l=0; (l<8)&&(j+k+l<e); l++) {
fprintf(dbg_log, "%02x", cp[l]);
}
}
cp+=8;
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END INODE ALLOCATION MAP =====\n");
return;
} | /* **************************************************** dbg_dump_inmap ***** */
/*
* Dump the inode allocation map in one cylinder group.
*/ | dbg_dump_inmap
Dump the inode allocation map in one cylinder group. | [
"dbg_dump_inmap",
"Dump",
"the",
"inode",
"allocation",
"map",
"in",
"one",
"cylinder",
"group",
"."
] | void
dbg_dump_inmap(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k,l,e;
unsigned char *cp;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START INODE ALLOCATION MAP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
cp=(unsigned char *)cg_inosused(cgr);
e=sb->fs_ipg/8;
for(j=0; j<e; j+=32) {
fprintf(dbg_log, "%08x: ", j);
for(k=0; k<32; k+=8) {
if(j+k+8<e) {
fprintf(dbg_log,
"%02x%02x%02x%02x%02x%02x%02x%02x ",
cp[0], cp[1], cp[2], cp[3],
cp[4], cp[5], cp[6], cp[7]);
} else {
for(l=0; (l<8)&&(j+k+l<e); l++) {
fprintf(dbg_log, "%02x", cp[l]);
}
}
cp+=8;
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END INODE ALLOCATION MAP =====\n");
return;
} | [
"void",
"dbg_dump_inmap",
"(",
"struct",
"fs",
"*",
"sb",
",",
"const",
"char",
"*",
"comment",
",",
"struct",
"cg",
"*",
"cgr",
")",
"{",
"int",
"j",
",",
"k",
",",
"l",
",",
"e",
";",
"unsigned",
"char",
"*",
"cp",
";",
"if",
"(",
"!",
"dbg_log",
")",
"{",
"return",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"indent",
",",
"(",
"unsigned",
"long",
")",
"cgr",
",",
"comment",
")",
";",
"indent",
"++",
";",
"cp",
"=",
"(",
"unsigned",
"char",
"*",
")",
"cg_inosused",
"(",
"cgr",
")",
";",
"e",
"=",
"sb",
"->",
"fs_ipg",
"/",
"8",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"e",
";",
"j",
"+=",
"32",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"j",
")",
";",
"for",
"(",
"k",
"=",
"0",
";",
"k",
"<",
"32",
";",
"k",
"+=",
"8",
")",
"{",
"if",
"(",
"j",
"+",
"k",
"+",
"8",
"<",
"e",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"cp",
"[",
"0",
"]",
",",
"cp",
"[",
"1",
"]",
",",
"cp",
"[",
"2",
"]",
",",
"cp",
"[",
"3",
"]",
",",
"cp",
"[",
"4",
"]",
",",
"cp",
"[",
"5",
"]",
",",
"cp",
"[",
"6",
"]",
",",
"cp",
"[",
"7",
"]",
")",
";",
"}",
"else",
"{",
"for",
"(",
"l",
"=",
"0",
";",
"(",
"l",
"<",
"8",
")",
"&&",
"(",
"j",
"+",
"k",
"+",
"l",
"<",
"e",
")",
";",
"l",
"++",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"cp",
"[",
"l",
"]",
")",
";",
"}",
"}",
"cp",
"+=",
"8",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"indent",
"--",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | dbg_dump_inmap
Dump the inode allocation map in one cylinder group. | [
"dbg_dump_inmap",
"Dump",
"the",
"inode",
"allocation",
"map",
"in",
"one",
"cylinder",
"group",
"."
] | [] | [
{
"param": "sb",
"type": "struct fs"
},
{
"param": "comment",
"type": "char"
},
{
"param": "cgr",
"type": "struct cg"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sb",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comment",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cgr",
"type": "struct cg",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_dump_frmap | void | void
dbg_dump_frmap(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k,l,e;
unsigned char *cp;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START FRAGMENT ALLOCATION MAP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
cp=(unsigned char *)cg_blksfree(cgr);
e=howmany((sb->fs_cpg * sb->fs_spc / NSPF(sb)), NBBY);
for(j=0; j<e; j+=32) {
fprintf(dbg_log, "%08x: ", j);
for(k=0; k<32; k+=8) {
if(j+k+8<e) {
fprintf(dbg_log,
"%02x%02x%02x%02x%02x%02x%02x%02x ",
cp[0], cp[1], cp[2], cp[3],
cp[4], cp[5], cp[6], cp[7]);
} else {
for(l=0; (l<8)&&(j+k+l<e); l++) {
fprintf(dbg_log, "%02x", cp[l]);
}
}
cp+=8;
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END FRAGMENT ALLOCATION MAP =====\n");
return;
} | /* **************************************************** dbg_dump_frmap ***** */
/*
* Dump the fragment allocation map in one cylinder group.
*/ | dbg_dump_frmap
Dump the fragment allocation map in one cylinder group. | [
"dbg_dump_frmap",
"Dump",
"the",
"fragment",
"allocation",
"map",
"in",
"one",
"cylinder",
"group",
"."
] | void
dbg_dump_frmap(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k,l,e;
unsigned char *cp;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START FRAGMENT ALLOCATION MAP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
cp=(unsigned char *)cg_blksfree(cgr);
e=howmany((sb->fs_cpg * sb->fs_spc / NSPF(sb)), NBBY);
for(j=0; j<e; j+=32) {
fprintf(dbg_log, "%08x: ", j);
for(k=0; k<32; k+=8) {
if(j+k+8<e) {
fprintf(dbg_log,
"%02x%02x%02x%02x%02x%02x%02x%02x ",
cp[0], cp[1], cp[2], cp[3],
cp[4], cp[5], cp[6], cp[7]);
} else {
for(l=0; (l<8)&&(j+k+l<e); l++) {
fprintf(dbg_log, "%02x", cp[l]);
}
}
cp+=8;
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END FRAGMENT ALLOCATION MAP =====\n");
return;
} | [
"void",
"dbg_dump_frmap",
"(",
"struct",
"fs",
"*",
"sb",
",",
"const",
"char",
"*",
"comment",
",",
"struct",
"cg",
"*",
"cgr",
")",
"{",
"int",
"j",
",",
"k",
",",
"l",
",",
"e",
";",
"unsigned",
"char",
"*",
"cp",
";",
"if",
"(",
"!",
"dbg_log",
")",
"{",
"return",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"indent",
",",
"(",
"unsigned",
"long",
")",
"cgr",
",",
"comment",
")",
";",
"indent",
"++",
";",
"cp",
"=",
"(",
"unsigned",
"char",
"*",
")",
"cg_blksfree",
"(",
"cgr",
")",
";",
"e",
"=",
"howmany",
"(",
"(",
"sb",
"->",
"fs_cpg",
"*",
"sb",
"->",
"fs_spc",
"/",
"NSPF",
"(",
"sb",
")",
")",
",",
"NBBY",
")",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"e",
";",
"j",
"+=",
"32",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"j",
")",
";",
"for",
"(",
"k",
"=",
"0",
";",
"k",
"<",
"32",
";",
"k",
"+=",
"8",
")",
"{",
"if",
"(",
"j",
"+",
"k",
"+",
"8",
"<",
"e",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"cp",
"[",
"0",
"]",
",",
"cp",
"[",
"1",
"]",
",",
"cp",
"[",
"2",
"]",
",",
"cp",
"[",
"3",
"]",
",",
"cp",
"[",
"4",
"]",
",",
"cp",
"[",
"5",
"]",
",",
"cp",
"[",
"6",
"]",
",",
"cp",
"[",
"7",
"]",
")",
";",
"}",
"else",
"{",
"for",
"(",
"l",
"=",
"0",
";",
"(",
"l",
"<",
"8",
")",
"&&",
"(",
"j",
"+",
"k",
"+",
"l",
"<",
"e",
")",
";",
"l",
"++",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"cp",
"[",
"l",
"]",
")",
";",
"}",
"}",
"cp",
"+=",
"8",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"indent",
"--",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | dbg_dump_frmap
Dump the fragment allocation map in one cylinder group. | [
"dbg_dump_frmap",
"Dump",
"the",
"fragment",
"allocation",
"map",
"in",
"one",
"cylinder",
"group",
"."
] | [] | [
{
"param": "sb",
"type": "struct fs"
},
{
"param": "comment",
"type": "char"
},
{
"param": "cgr",
"type": "struct cg"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sb",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comment",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cgr",
"type": "struct cg",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_dump_clmap | void | void
dbg_dump_clmap(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k,l,e;
unsigned char *cp;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START CLUSTER ALLOCATION MAP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
cp=(unsigned char *)cg_clustersfree(cgr);
e=howmany(sb->fs_cpg * sb->fs_spc / NSPB(sb), NBBY);
for(j=0; j<e; j+=32) {
fprintf(dbg_log, "%08x: ", j);
for(k=0; k<32; k+=8) {
if(j+k+8<e) {
fprintf(dbg_log,
"%02x%02x%02x%02x%02x%02x%02x%02x ",
cp[0], cp[1], cp[2], cp[3],
cp[4], cp[5], cp[6], cp[7]);
} else {
for(l=0; (l<8)&&(j+k+l<e); l++) {
fprintf(dbg_log, "%02x", cp[l]);
}
}
cp+=8;
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END CLUSTER ALLOCATION MAP =====\n");
return;
} | /* **************************************************** dbg_dump_clmap ***** */
/*
* Dump the cluster allocation map in one cylinder group.
*/ | dbg_dump_clmap
Dump the cluster allocation map in one cylinder group. | [
"dbg_dump_clmap",
"Dump",
"the",
"cluster",
"allocation",
"map",
"in",
"one",
"cylinder",
"group",
"."
] | void
dbg_dump_clmap(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k,l,e;
unsigned char *cp;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START CLUSTER ALLOCATION MAP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
cp=(unsigned char *)cg_clustersfree(cgr);
e=howmany(sb->fs_cpg * sb->fs_spc / NSPB(sb), NBBY);
for(j=0; j<e; j+=32) {
fprintf(dbg_log, "%08x: ", j);
for(k=0; k<32; k+=8) {
if(j+k+8<e) {
fprintf(dbg_log,
"%02x%02x%02x%02x%02x%02x%02x%02x ",
cp[0], cp[1], cp[2], cp[3],
cp[4], cp[5], cp[6], cp[7]);
} else {
for(l=0; (l<8)&&(j+k+l<e); l++) {
fprintf(dbg_log, "%02x", cp[l]);
}
}
cp+=8;
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END CLUSTER ALLOCATION MAP =====\n");
return;
} | [
"void",
"dbg_dump_clmap",
"(",
"struct",
"fs",
"*",
"sb",
",",
"const",
"char",
"*",
"comment",
",",
"struct",
"cg",
"*",
"cgr",
")",
"{",
"int",
"j",
",",
"k",
",",
"l",
",",
"e",
";",
"unsigned",
"char",
"*",
"cp",
";",
"if",
"(",
"!",
"dbg_log",
")",
"{",
"return",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"indent",
",",
"(",
"unsigned",
"long",
")",
"cgr",
",",
"comment",
")",
";",
"indent",
"++",
";",
"cp",
"=",
"(",
"unsigned",
"char",
"*",
")",
"cg_clustersfree",
"(",
"cgr",
")",
";",
"e",
"=",
"howmany",
"(",
"sb",
"->",
"fs_cpg",
"*",
"sb",
"->",
"fs_spc",
"/",
"NSPB",
"(",
"sb",
")",
",",
"NBBY",
")",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"e",
";",
"j",
"+=",
"32",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"j",
")",
";",
"for",
"(",
"k",
"=",
"0",
";",
"k",
"<",
"32",
";",
"k",
"+=",
"8",
")",
"{",
"if",
"(",
"j",
"+",
"k",
"+",
"8",
"<",
"e",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"cp",
"[",
"0",
"]",
",",
"cp",
"[",
"1",
"]",
",",
"cp",
"[",
"2",
"]",
",",
"cp",
"[",
"3",
"]",
",",
"cp",
"[",
"4",
"]",
",",
"cp",
"[",
"5",
"]",
",",
"cp",
"[",
"6",
"]",
",",
"cp",
"[",
"7",
"]",
")",
";",
"}",
"else",
"{",
"for",
"(",
"l",
"=",
"0",
";",
"(",
"l",
"<",
"8",
")",
"&&",
"(",
"j",
"+",
"k",
"+",
"l",
"<",
"e",
")",
";",
"l",
"++",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"cp",
"[",
"l",
"]",
")",
";",
"}",
"}",
"cp",
"+=",
"8",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"indent",
"--",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | dbg_dump_clmap
Dump the cluster allocation map in one cylinder group. | [
"dbg_dump_clmap",
"Dump",
"the",
"cluster",
"allocation",
"map",
"in",
"one",
"cylinder",
"group",
"."
] | [] | [
{
"param": "sb",
"type": "struct fs"
},
{
"param": "comment",
"type": "char"
},
{
"param": "cgr",
"type": "struct cg"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sb",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comment",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cgr",
"type": "struct cg",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_dump_clsum | void | void
dbg_dump_clsum(struct fs *sb, const char *comment, struct cg *cgr)
{
int j;
int *ip;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START CLUSTER SUMMARY =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
ip=(int *)cg_clustersum(cgr);
for(j=0; j<=sb->fs_contigsumsize; j++) {
fprintf(dbg_log, "%02d: %8d\n", j, *ip++);
}
indent--;
fprintf(dbg_log, "===== END CLUSTER SUMMARY =====\n");
return;
} | /* **************************************************** dbg_dump_clsum ***** */
/*
* Dump the cluster availability summary of one cylinder group.
*/ | dbg_dump_clsum
Dump the cluster availability summary of one cylinder group. | [
"dbg_dump_clsum",
"Dump",
"the",
"cluster",
"availability",
"summary",
"of",
"one",
"cylinder",
"group",
"."
] | void
dbg_dump_clsum(struct fs *sb, const char *comment, struct cg *cgr)
{
int j;
int *ip;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START CLUSTER SUMMARY =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
ip=(int *)cg_clustersum(cgr);
for(j=0; j<=sb->fs_contigsumsize; j++) {
fprintf(dbg_log, "%02d: %8d\n", j, *ip++);
}
indent--;
fprintf(dbg_log, "===== END CLUSTER SUMMARY =====\n");
return;
} | [
"void",
"dbg_dump_clsum",
"(",
"struct",
"fs",
"*",
"sb",
",",
"const",
"char",
"*",
"comment",
",",
"struct",
"cg",
"*",
"cgr",
")",
"{",
"int",
"j",
";",
"int",
"*",
"ip",
";",
"if",
"(",
"!",
"dbg_log",
")",
"{",
"return",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"indent",
",",
"(",
"unsigned",
"long",
")",
"cgr",
",",
"comment",
")",
";",
"indent",
"++",
";",
"ip",
"=",
"(",
"int",
"*",
")",
"cg_clustersum",
"(",
"cgr",
")",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<=",
"sb",
"->",
"fs_contigsumsize",
";",
"j",
"++",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"j",
",",
"*",
"ip",
"++",
")",
";",
"}",
"indent",
"--",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | dbg_dump_clsum
Dump the cluster availability summary of one cylinder group. | [
"dbg_dump_clsum",
"Dump",
"the",
"cluster",
"availability",
"summary",
"of",
"one",
"cylinder",
"group",
"."
] | [] | [
{
"param": "sb",
"type": "struct fs"
},
{
"param": "comment",
"type": "char"
},
{
"param": "cgr",
"type": "struct cg"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sb",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comment",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cgr",
"type": "struct cg",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_dump_sptbl | void | void
dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k;
int *ip;
if(!dbg_log) {
return;
}
fprintf(dbg_log,
"===== START BLOCK SUMMARY AND POSITION TABLE =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
ip=(int *)cg_blktot(cgr);
for(j=0; j<sb->fs_cpg; j++) {
fprintf(dbg_log, "%2d: %5d = ", j, *ip++);
for(k=0; k<sb->fs_nrpos; k++) {
fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]);
if(k<sb->fs_nrpos-1) {
fprintf(dbg_log, " + ");
}
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END BLOCK SUMMARY AND POSITION TABLE =====\n");
return;
} | /* **************************************************** dbg_dump_sptbl ***** */
/*
* Dump the block summary, and the rotational layout table.
*/ | dbg_dump_sptbl
Dump the block summary, and the rotational layout table. | [
"dbg_dump_sptbl",
"Dump",
"the",
"block",
"summary",
"and",
"the",
"rotational",
"layout",
"table",
"."
] | void
dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
{
int j,k;
int *ip;
if(!dbg_log) {
return;
}
fprintf(dbg_log,
"===== START BLOCK SUMMARY AND POSITION TABLE =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
indent++;
ip=(int *)cg_blktot(cgr);
for(j=0; j<sb->fs_cpg; j++) {
fprintf(dbg_log, "%2d: %5d = ", j, *ip++);
for(k=0; k<sb->fs_nrpos; k++) {
fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]);
if(k<sb->fs_nrpos-1) {
fprintf(dbg_log, " + ");
}
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END BLOCK SUMMARY AND POSITION TABLE =====\n");
return;
} | [
"void",
"dbg_dump_sptbl",
"(",
"struct",
"fs",
"*",
"sb",
",",
"const",
"char",
"*",
"comment",
",",
"struct",
"cg",
"*",
"cgr",
")",
"{",
"int",
"j",
",",
"k",
";",
"int",
"*",
"ip",
";",
"if",
"(",
"!",
"dbg_log",
")",
"{",
"return",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"indent",
",",
"(",
"unsigned",
"long",
")",
"cgr",
",",
"comment",
")",
";",
"indent",
"++",
";",
"ip",
"=",
"(",
"int",
"*",
")",
"cg_blktot",
"(",
"cgr",
")",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"sb",
"->",
"fs_cpg",
";",
"j",
"++",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"j",
",",
"*",
"ip",
"++",
")",
";",
"for",
"(",
"k",
"=",
"0",
";",
"k",
"<",
"sb",
"->",
"fs_nrpos",
";",
"k",
"++",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"cg_blks",
"(",
"sb",
",",
"cgr",
",",
"j",
")",
"[",
"k",
"]",
")",
";",
"if",
"(",
"k",
"<",
"sb",
"->",
"fs_nrpos",
"-",
"1",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
")",
";",
"}",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"indent",
"--",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | dbg_dump_sptbl
Dump the block summary, and the rotational layout table. | [
"dbg_dump_sptbl",
"Dump",
"the",
"block",
"summary",
"and",
"the",
"rotational",
"layout",
"table",
"."
] | [] | [
{
"param": "sb",
"type": "struct fs"
},
{
"param": "comment",
"type": "char"
},
{
"param": "cgr",
"type": "struct cg"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sb",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comment",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "cgr",
"type": "struct cg",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
0ad3004f5bae5bb56e1e45eae194e3a72da6aa81 | atrens/DragonFlyBSD-src | sbin/growfs/debug.c | [
"BSD-3-Clause"
] | C | dbg_dump_iblk | void | void
dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
{
unsigned int *mem;
int i, j;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START INDIRECT BLOCK DUMP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)block,
comment);
indent++;
mem=(unsigned int *)block;
for (i=0; (size_t)i<MIN(howmany(sb->fs_bsize, sizeof(ufs_daddr_t)),
length); i+=8) {
fprintf(dbg_log, "%04x: ", i);
for (j=0; j<8; j++) {
if((size_t)(i+j)<length) {
fprintf(dbg_log, "%08X ", *mem++);
}
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END INDIRECT BLOCK DUMP =====\n");
return;
} | /* ***************************************************** dbg_dump_iblk ***** */
/*
* Dump an indirect block. The iteration to dump a full file has to be
* written around.
*/ | dbg_dump_iblk
Dump an indirect block. The iteration to dump a full file has to be
written around. | [
"dbg_dump_iblk",
"Dump",
"an",
"indirect",
"block",
".",
"The",
"iteration",
"to",
"dump",
"a",
"full",
"file",
"has",
"to",
"be",
"written",
"around",
"."
] | void
dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
{
unsigned int *mem;
int i, j;
if(!dbg_log) {
return;
}
fprintf(dbg_log, "===== START INDIRECT BLOCK DUMP =====\n");
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)block,
comment);
indent++;
mem=(unsigned int *)block;
for (i=0; (size_t)i<MIN(howmany(sb->fs_bsize, sizeof(ufs_daddr_t)),
length); i+=8) {
fprintf(dbg_log, "%04x: ", i);
for (j=0; j<8; j++) {
if((size_t)(i+j)<length) {
fprintf(dbg_log, "%08X ", *mem++);
}
}
fprintf(dbg_log, "\n");
}
indent--;
fprintf(dbg_log, "===== END INDIRECT BLOCK DUMP =====\n");
return;
} | [
"void",
"dbg_dump_iblk",
"(",
"struct",
"fs",
"*",
"sb",
",",
"const",
"char",
"*",
"comment",
",",
"char",
"*",
"block",
",",
"size_t",
"length",
")",
"{",
"unsigned",
"int",
"*",
"mem",
";",
"int",
"i",
",",
"j",
";",
"if",
"(",
"!",
"dbg_log",
")",
"{",
"return",
";",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
",",
"indent",
",",
"(",
"unsigned",
"long",
")",
"block",
",",
"comment",
")",
";",
"indent",
"++",
";",
"mem",
"=",
"(",
"unsigned",
"int",
"*",
")",
"block",
";",
"for",
"(",
"i",
"=",
"0",
";",
"(",
"size_t",
")",
"i",
"<",
"MIN",
"(",
"howmany",
"(",
"sb",
"->",
"fs_bsize",
",",
"sizeof",
"(",
"ufs_daddr_t",
")",
")",
",",
"length",
")",
";",
"i",
"+=",
"8",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"i",
")",
";",
"for",
"(",
"j",
"=",
"0",
";",
"j",
"<",
"8",
";",
"j",
"++",
")",
"{",
"if",
"(",
"(",
"size_t",
")",
"(",
"i",
"+",
"j",
")",
"<",
"length",
")",
"{",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\"",
",",
"*",
"mem",
"++",
")",
";",
"}",
"}",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"}",
"indent",
"--",
";",
"fprintf",
"(",
"dbg_log",
",",
"\"",
"\\n",
"\"",
")",
";",
"return",
";",
"}"
] | dbg_dump_iblk
Dump an indirect block. | [
"dbg_dump_iblk",
"Dump",
"an",
"indirect",
"block",
"."
] | [] | [
{
"param": "sb",
"type": "struct fs"
},
{
"param": "comment",
"type": "char"
},
{
"param": "block",
"type": "char"
},
{
"param": "length",
"type": "size_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "sb",
"type": "struct fs",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "comment",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "block",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "length",
"type": "size_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | lookupino | null | struct entry *
lookupino(ufs1_ino_t inum)
{
struct entry *ep;
if (inum < UFS_WINO || inum >= maxino)
return (NULL);
for (ep = entry[inum % entrytblsize]; ep != NULL; ep = ep->e_next)
if (ep->e_ino == inum)
return (ep);
return (NULL);
} | /*
* Look up an entry by inode number
*/ | Look up an entry by inode number | [
"Look",
"up",
"an",
"entry",
"by",
"inode",
"number"
] | struct entry *
lookupino(ufs1_ino_t inum)
{
struct entry *ep;
if (inum < UFS_WINO || inum >= maxino)
return (NULL);
for (ep = entry[inum % entrytblsize]; ep != NULL; ep = ep->e_next)
if (ep->e_ino == inum)
return (ep);
return (NULL);
} | [
"struct",
"entry",
"*",
"lookupino",
"(",
"ufs1_ino_t",
"inum",
")",
"{",
"struct",
"entry",
"*",
"ep",
";",
"if",
"(",
"inum",
"<",
"UFS_WINO",
"||",
"inum",
">=",
"maxino",
")",
"return",
"(",
"NULL",
")",
";",
"for",
"(",
"ep",
"=",
"entry",
"[",
"inum",
"%",
"entrytblsize",
"]",
";",
"ep",
"!=",
"NULL",
";",
"ep",
"=",
"ep",
"->",
"e_next",
")",
"if",
"(",
"ep",
"->",
"e_ino",
"==",
"inum",
")",
"return",
"(",
"ep",
")",
";",
"return",
"(",
"NULL",
")",
";",
"}"
] | Look up an entry by inode number | [
"Look",
"up",
"an",
"entry",
"by",
"inode",
"number"
] | [] | [
{
"param": "inum",
"type": "ufs1_ino_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inum",
"type": "ufs1_ino_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | addino | void | static void
addino(ufs1_ino_t inum, struct entry *np)
{
struct entry **epp;
if (inum < UFS_WINO || inum >= maxino)
panic("addino: out of range %d\n", inum);
epp = &entry[inum % entrytblsize];
np->e_ino = inum;
np->e_next = *epp;
*epp = np;
if (dflag)
for (np = np->e_next; np != NULL; np = np->e_next)
if (np->e_ino == inum)
badentry(np, "duplicate inum");
} | /*
* Add an entry into the entry table
*/ | Add an entry into the entry table | [
"Add",
"an",
"entry",
"into",
"the",
"entry",
"table"
] | static void
addino(ufs1_ino_t inum, struct entry *np)
{
struct entry **epp;
if (inum < UFS_WINO || inum >= maxino)
panic("addino: out of range %d\n", inum);
epp = &entry[inum % entrytblsize];
np->e_ino = inum;
np->e_next = *epp;
*epp = np;
if (dflag)
for (np = np->e_next; np != NULL; np = np->e_next)
if (np->e_ino == inum)
badentry(np, "duplicate inum");
} | [
"static",
"void",
"addino",
"(",
"ufs1_ino_t",
"inum",
",",
"struct",
"entry",
"*",
"np",
")",
"{",
"struct",
"entry",
"*",
"*",
"epp",
";",
"if",
"(",
"inum",
"<",
"UFS_WINO",
"||",
"inum",
">=",
"maxino",
")",
"panic",
"(",
"\"",
"\\n",
"\"",
",",
"inum",
")",
";",
"epp",
"=",
"&",
"entry",
"[",
"inum",
"%",
"entrytblsize",
"]",
";",
"np",
"->",
"e_ino",
"=",
"inum",
";",
"np",
"->",
"e_next",
"=",
"*",
"epp",
";",
"*",
"epp",
"=",
"np",
";",
"if",
"(",
"dflag",
")",
"for",
"(",
"np",
"=",
"np",
"->",
"e_next",
";",
"np",
"!=",
"NULL",
";",
"np",
"=",
"np",
"->",
"e_next",
")",
"if",
"(",
"np",
"->",
"e_ino",
"==",
"inum",
")",
"badentry",
"(",
"np",
",",
"\"",
"\"",
")",
";",
"}"
] | Add an entry into the entry table | [
"Add",
"an",
"entry",
"into",
"the",
"entry",
"table"
] | [] | [
{
"param": "inum",
"type": "ufs1_ino_t"
},
{
"param": "np",
"type": "struct entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inum",
"type": "ufs1_ino_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "np",
"type": "struct entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | deleteino | void | void
deleteino(ufs1_ino_t inum)
{
struct entry *next;
struct entry **prev;
if (inum < UFS_WINO || inum >= maxino)
panic("deleteino: out of range %d\n", inum);
prev = &entry[inum % entrytblsize];
for (next = *prev; next != NULL; next = next->e_next) {
if (next->e_ino == inum) {
next->e_ino = 0;
*prev = next->e_next;
return;
}
prev = &next->e_next;
}
panic("deleteino: %d not found\n", inum);
} | /*
* Delete an entry from the entry table
*/ | Delete an entry from the entry table | [
"Delete",
"an",
"entry",
"from",
"the",
"entry",
"table"
] | void
deleteino(ufs1_ino_t inum)
{
struct entry *next;
struct entry **prev;
if (inum < UFS_WINO || inum >= maxino)
panic("deleteino: out of range %d\n", inum);
prev = &entry[inum % entrytblsize];
for (next = *prev; next != NULL; next = next->e_next) {
if (next->e_ino == inum) {
next->e_ino = 0;
*prev = next->e_next;
return;
}
prev = &next->e_next;
}
panic("deleteino: %d not found\n", inum);
} | [
"void",
"deleteino",
"(",
"ufs1_ino_t",
"inum",
")",
"{",
"struct",
"entry",
"*",
"next",
";",
"struct",
"entry",
"*",
"*",
"prev",
";",
"if",
"(",
"inum",
"<",
"UFS_WINO",
"||",
"inum",
">=",
"maxino",
")",
"panic",
"(",
"\"",
"\\n",
"\"",
",",
"inum",
")",
";",
"prev",
"=",
"&",
"entry",
"[",
"inum",
"%",
"entrytblsize",
"]",
";",
"for",
"(",
"next",
"=",
"*",
"prev",
";",
"next",
"!=",
"NULL",
";",
"next",
"=",
"next",
"->",
"e_next",
")",
"{",
"if",
"(",
"next",
"->",
"e_ino",
"==",
"inum",
")",
"{",
"next",
"->",
"e_ino",
"=",
"0",
";",
"*",
"prev",
"=",
"next",
"->",
"e_next",
";",
"return",
";",
"}",
"prev",
"=",
"&",
"next",
"->",
"e_next",
";",
"}",
"panic",
"(",
"\"",
"\\n",
"\"",
",",
"inum",
")",
";",
"}"
] | Delete an entry from the entry table | [
"Delete",
"an",
"entry",
"from",
"the",
"entry",
"table"
] | [] | [
{
"param": "inum",
"type": "ufs1_ino_t"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "inum",
"type": "ufs1_ino_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | lookupname | null | struct entry *
lookupname(const char *name)
{
struct entry *ep;
const char *cp;
char *np;
char buf[MAXPATHLEN];
cp = name;
for (ep = lookupino(UFS_ROOTINO); ep != NULL; ep = ep->e_entries) {
for (np = buf; *cp != '/' && *cp != '\0' &&
np < &buf[sizeof(buf)]; )
*np++ = *cp++;
if (np == &buf[sizeof(buf)])
break;
*np = '\0';
for ( ; ep != NULL; ep = ep->e_sibling)
if (strcmp(ep->e_name, buf) == 0)
break;
if (ep == NULL)
break;
if (*cp++ == '\0')
return (ep);
}
return (NULL);
} | /*
* Look up an entry by name
*/ | Look up an entry by name | [
"Look",
"up",
"an",
"entry",
"by",
"name"
] | struct entry *
lookupname(const char *name)
{
struct entry *ep;
const char *cp;
char *np;
char buf[MAXPATHLEN];
cp = name;
for (ep = lookupino(UFS_ROOTINO); ep != NULL; ep = ep->e_entries) {
for (np = buf; *cp != '/' && *cp != '\0' &&
np < &buf[sizeof(buf)]; )
*np++ = *cp++;
if (np == &buf[sizeof(buf)])
break;
*np = '\0';
for ( ; ep != NULL; ep = ep->e_sibling)
if (strcmp(ep->e_name, buf) == 0)
break;
if (ep == NULL)
break;
if (*cp++ == '\0')
return (ep);
}
return (NULL);
} | [
"struct",
"entry",
"*",
"lookupname",
"(",
"const",
"char",
"*",
"name",
")",
"{",
"struct",
"entry",
"*",
"ep",
";",
"const",
"char",
"*",
"cp",
";",
"char",
"*",
"np",
";",
"char",
"buf",
"[",
"MAXPATHLEN",
"]",
";",
"cp",
"=",
"name",
";",
"for",
"(",
"ep",
"=",
"lookupino",
"(",
"UFS_ROOTINO",
")",
";",
"ep",
"!=",
"NULL",
";",
"ep",
"=",
"ep",
"->",
"e_entries",
")",
"{",
"for",
"(",
"np",
"=",
"buf",
";",
"*",
"cp",
"!=",
"'",
"'",
"&&",
"*",
"cp",
"!=",
"'",
"\\0",
"'",
"&&",
"np",
"<",
"&",
"buf",
"[",
"sizeof",
"(",
"buf",
")",
"]",
";",
")",
"*",
"np",
"++",
"=",
"*",
"cp",
"++",
";",
"if",
"(",
"np",
"==",
"&",
"buf",
"[",
"sizeof",
"(",
"buf",
")",
"]",
")",
"break",
";",
"*",
"np",
"=",
"'",
"\\0",
"'",
";",
"for",
"(",
";",
"ep",
"!=",
"NULL",
";",
"ep",
"=",
"ep",
"->",
"e_sibling",
")",
"if",
"(",
"strcmp",
"(",
"ep",
"->",
"e_name",
",",
"buf",
")",
"==",
"0",
")",
"break",
";",
"if",
"(",
"ep",
"==",
"NULL",
")",
"break",
";",
"if",
"(",
"*",
"cp",
"++",
"==",
"'",
"\\0",
"'",
")",
"return",
"(",
"ep",
")",
";",
"}",
"return",
"(",
"NULL",
")",
";",
"}"
] | Look up an entry by name | [
"Look",
"up",
"an",
"entry",
"by",
"name"
] | [] | [
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | lookupparent | null | static struct entry *
lookupparent(const char *name)
{
struct entry *ep;
char *tailindex;
tailindex = strrchr(name, '/');
if (tailindex == NULL)
return (NULL);
*tailindex = '\0';
ep = lookupname(name);
*tailindex = '/';
if (ep == NULL)
return (NULL);
if (ep->e_type != NODE)
panic("%s is not a directory\n", name);
return (ep);
} | /*
* Look up the parent of a pathname
*/ | Look up the parent of a pathname | [
"Look",
"up",
"the",
"parent",
"of",
"a",
"pathname"
] | static struct entry *
lookupparent(const char *name)
{
struct entry *ep;
char *tailindex;
tailindex = strrchr(name, '/');
if (tailindex == NULL)
return (NULL);
*tailindex = '\0';
ep = lookupname(name);
*tailindex = '/';
if (ep == NULL)
return (NULL);
if (ep->e_type != NODE)
panic("%s is not a directory\n", name);
return (ep);
} | [
"static",
"struct",
"entry",
"*",
"lookupparent",
"(",
"const",
"char",
"*",
"name",
")",
"{",
"struct",
"entry",
"*",
"ep",
";",
"char",
"*",
"tailindex",
";",
"tailindex",
"=",
"strrchr",
"(",
"name",
",",
"'",
"'",
")",
";",
"if",
"(",
"tailindex",
"==",
"NULL",
")",
"return",
"(",
"NULL",
")",
";",
"*",
"tailindex",
"=",
"'",
"\\0",
"'",
";",
"ep",
"=",
"lookupname",
"(",
"name",
")",
";",
"*",
"tailindex",
"=",
"'",
"'",
";",
"if",
"(",
"ep",
"==",
"NULL",
")",
"return",
"(",
"NULL",
")",
";",
"if",
"(",
"ep",
"->",
"e_type",
"!=",
"NODE",
")",
"panic",
"(",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"return",
"(",
"ep",
")",
";",
"}"
] | Look up the parent of a pathname | [
"Look",
"up",
"the",
"parent",
"of",
"a",
"pathname"
] | [] | [
{
"param": "name",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | myname | char | char *
myname(struct entry *ep)
{
char *cp;
static char namebuf[MAXPATHLEN];
for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
cp -= ep->e_namlen;
memmove(cp, ep->e_name, (long)ep->e_namlen);
if (ep == lookupino(UFS_ROOTINO))
return (cp);
*(--cp) = '/';
ep = ep->e_parent;
}
panic("%s: pathname too long\n", cp);
return(cp);
} | /*
* Determine the current pathname of a node or leaf
*/ | Determine the current pathname of a node or leaf | [
"Determine",
"the",
"current",
"pathname",
"of",
"a",
"node",
"or",
"leaf"
] | char *
myname(struct entry *ep)
{
char *cp;
static char namebuf[MAXPATHLEN];
for (cp = &namebuf[MAXPATHLEN - 2]; cp > &namebuf[ep->e_namlen]; ) {
cp -= ep->e_namlen;
memmove(cp, ep->e_name, (long)ep->e_namlen);
if (ep == lookupino(UFS_ROOTINO))
return (cp);
*(--cp) = '/';
ep = ep->e_parent;
}
panic("%s: pathname too long\n", cp);
return(cp);
} | [
"char",
"*",
"myname",
"(",
"struct",
"entry",
"*",
"ep",
")",
"{",
"char",
"*",
"cp",
";",
"static",
"char",
"namebuf",
"[",
"MAXPATHLEN",
"]",
";",
"for",
"(",
"cp",
"=",
"&",
"namebuf",
"[",
"MAXPATHLEN",
"-",
"2",
"]",
";",
"cp",
">",
"&",
"namebuf",
"[",
"ep",
"->",
"e_namlen",
"]",
";",
")",
"{",
"cp",
"-=",
"ep",
"->",
"e_namlen",
";",
"memmove",
"(",
"cp",
",",
"ep",
"->",
"e_name",
",",
"(",
"long",
")",
"ep",
"->",
"e_namlen",
")",
";",
"if",
"(",
"ep",
"==",
"lookupino",
"(",
"UFS_ROOTINO",
")",
")",
"return",
"(",
"cp",
")",
";",
"*",
"(",
"--",
"cp",
")",
"=",
"'",
"'",
";",
"ep",
"=",
"ep",
"->",
"e_parent",
";",
"}",
"panic",
"(",
"\"",
"\\n",
"\"",
",",
"cp",
")",
";",
"return",
"(",
"cp",
")",
";",
"}"
] | Determine the current pathname of a node or leaf | [
"Determine",
"the",
"current",
"pathname",
"of",
"a",
"node",
"or",
"leaf"
] | [] | [
{
"param": "ep",
"type": "struct entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ep",
"type": "struct entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | addentry | null | struct entry *
addentry(const char *name, ufs1_ino_t inum, int type)
{
struct entry *np, *ep;
if (freelist != NULL) {
np = freelist;
freelist = np->e_next;
memset(np, 0, (long)sizeof(struct entry));
} else {
np = (struct entry *)calloc(1, sizeof(struct entry));
if (np == NULL)
panic("no memory to extend symbol table\n");
}
np->e_type = type & ~LINK;
ep = lookupparent(name);
if (ep == NULL) {
if (inum != UFS_ROOTINO || lookupino(UFS_ROOTINO) != NULL)
panic("bad name to addentry %s\n", name);
np->e_name = savename(name);
np->e_namlen = strlen(name);
np->e_parent = np;
addino(UFS_ROOTINO, np);
return (np);
}
np->e_name = savename(strrchr(name, '/') + 1);
np->e_namlen = strlen(np->e_name);
np->e_parent = ep;
np->e_sibling = ep->e_entries;
ep->e_entries = np;
if (type & LINK) {
ep = lookupino(inum);
if (ep == NULL)
panic("link to non-existent name\n");
np->e_ino = inum;
np->e_links = ep->e_links;
ep->e_links = np;
} else if (inum != 0) {
if (lookupino(inum) != NULL)
panic("duplicate entry\n");
addino(inum, np);
}
return (np);
} | /*
* add an entry to the symbol table
*/ | add an entry to the symbol table | [
"add",
"an",
"entry",
"to",
"the",
"symbol",
"table"
] | struct entry *
addentry(const char *name, ufs1_ino_t inum, int type)
{
struct entry *np, *ep;
if (freelist != NULL) {
np = freelist;
freelist = np->e_next;
memset(np, 0, (long)sizeof(struct entry));
} else {
np = (struct entry *)calloc(1, sizeof(struct entry));
if (np == NULL)
panic("no memory to extend symbol table\n");
}
np->e_type = type & ~LINK;
ep = lookupparent(name);
if (ep == NULL) {
if (inum != UFS_ROOTINO || lookupino(UFS_ROOTINO) != NULL)
panic("bad name to addentry %s\n", name);
np->e_name = savename(name);
np->e_namlen = strlen(name);
np->e_parent = np;
addino(UFS_ROOTINO, np);
return (np);
}
np->e_name = savename(strrchr(name, '/') + 1);
np->e_namlen = strlen(np->e_name);
np->e_parent = ep;
np->e_sibling = ep->e_entries;
ep->e_entries = np;
if (type & LINK) {
ep = lookupino(inum);
if (ep == NULL)
panic("link to non-existent name\n");
np->e_ino = inum;
np->e_links = ep->e_links;
ep->e_links = np;
} else if (inum != 0) {
if (lookupino(inum) != NULL)
panic("duplicate entry\n");
addino(inum, np);
}
return (np);
} | [
"struct",
"entry",
"*",
"addentry",
"(",
"const",
"char",
"*",
"name",
",",
"ufs1_ino_t",
"inum",
",",
"int",
"type",
")",
"{",
"struct",
"entry",
"*",
"np",
",",
"*",
"ep",
";",
"if",
"(",
"freelist",
"!=",
"NULL",
")",
"{",
"np",
"=",
"freelist",
";",
"freelist",
"=",
"np",
"->",
"e_next",
";",
"memset",
"(",
"np",
",",
"0",
",",
"(",
"long",
")",
"sizeof",
"(",
"struct",
"entry",
")",
")",
";",
"}",
"else",
"{",
"np",
"=",
"(",
"struct",
"entry",
"*",
")",
"calloc",
"(",
"1",
",",
"sizeof",
"(",
"struct",
"entry",
")",
")",
";",
"if",
"(",
"np",
"==",
"NULL",
")",
"panic",
"(",
"\"",
"\\n",
"\"",
")",
";",
"}",
"np",
"->",
"e_type",
"=",
"type",
"&",
"~",
"LINK",
";",
"ep",
"=",
"lookupparent",
"(",
"name",
")",
";",
"if",
"(",
"ep",
"==",
"NULL",
")",
"{",
"if",
"(",
"inum",
"!=",
"UFS_ROOTINO",
"||",
"lookupino",
"(",
"UFS_ROOTINO",
")",
"!=",
"NULL",
")",
"panic",
"(",
"\"",
"\\n",
"\"",
",",
"name",
")",
";",
"np",
"->",
"e_name",
"=",
"savename",
"(",
"name",
")",
";",
"np",
"->",
"e_namlen",
"=",
"strlen",
"(",
"name",
")",
";",
"np",
"->",
"e_parent",
"=",
"np",
";",
"addino",
"(",
"UFS_ROOTINO",
",",
"np",
")",
";",
"return",
"(",
"np",
")",
";",
"}",
"np",
"->",
"e_name",
"=",
"savename",
"(",
"strrchr",
"(",
"name",
",",
"'",
"'",
")",
"+",
"1",
")",
";",
"np",
"->",
"e_namlen",
"=",
"strlen",
"(",
"np",
"->",
"e_name",
")",
";",
"np",
"->",
"e_parent",
"=",
"ep",
";",
"np",
"->",
"e_sibling",
"=",
"ep",
"->",
"e_entries",
";",
"ep",
"->",
"e_entries",
"=",
"np",
";",
"if",
"(",
"type",
"&",
"LINK",
")",
"{",
"ep",
"=",
"lookupino",
"(",
"inum",
")",
";",
"if",
"(",
"ep",
"==",
"NULL",
")",
"panic",
"(",
"\"",
"\\n",
"\"",
")",
";",
"np",
"->",
"e_ino",
"=",
"inum",
";",
"np",
"->",
"e_links",
"=",
"ep",
"->",
"e_links",
";",
"ep",
"->",
"e_links",
"=",
"np",
";",
"}",
"else",
"if",
"(",
"inum",
"!=",
"0",
")",
"{",
"if",
"(",
"lookupino",
"(",
"inum",
")",
"!=",
"NULL",
")",
"panic",
"(",
"\"",
"\\n",
"\"",
")",
";",
"addino",
"(",
"inum",
",",
"np",
")",
";",
"}",
"return",
"(",
"np",
")",
";",
"}"
] | add an entry to the symbol table | [
"add",
"an",
"entry",
"to",
"the",
"symbol",
"table"
] | [] | [
{
"param": "name",
"type": "char"
},
{
"param": "inum",
"type": "ufs1_ino_t"
},
{
"param": "type",
"type": "int"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "name",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "inum",
"type": "ufs1_ino_t",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "type",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | freeentry | void | void
freeentry(struct entry *ep)
{
struct entry *np;
ufs1_ino_t inum;
if (ep->e_flags != REMOVED)
badentry(ep, "not marked REMOVED");
if (ep->e_type == NODE) {
if (ep->e_links != NULL)
badentry(ep, "freeing referenced directory");
if (ep->e_entries != NULL)
badentry(ep, "freeing non-empty directory");
}
if (ep->e_ino != 0) {
np = lookupino(ep->e_ino);
if (np == NULL)
badentry(ep, "lookupino failed");
if (np == ep) {
inum = ep->e_ino;
deleteino(inum);
if (ep->e_links != NULL)
addino(inum, ep->e_links);
} else {
for (; np != NULL; np = np->e_links) {
if (np->e_links == ep) {
np->e_links = ep->e_links;
break;
}
}
if (np == NULL)
badentry(ep, "link not found");
}
}
removeentry(ep);
freename(ep->e_name);
ep->e_next = freelist;
freelist = ep;
} | /*
* delete an entry from the symbol table
*/ | delete an entry from the symbol table | [
"delete",
"an",
"entry",
"from",
"the",
"symbol",
"table"
] | void
freeentry(struct entry *ep)
{
struct entry *np;
ufs1_ino_t inum;
if (ep->e_flags != REMOVED)
badentry(ep, "not marked REMOVED");
if (ep->e_type == NODE) {
if (ep->e_links != NULL)
badentry(ep, "freeing referenced directory");
if (ep->e_entries != NULL)
badentry(ep, "freeing non-empty directory");
}
if (ep->e_ino != 0) {
np = lookupino(ep->e_ino);
if (np == NULL)
badentry(ep, "lookupino failed");
if (np == ep) {
inum = ep->e_ino;
deleteino(inum);
if (ep->e_links != NULL)
addino(inum, ep->e_links);
} else {
for (; np != NULL; np = np->e_links) {
if (np->e_links == ep) {
np->e_links = ep->e_links;
break;
}
}
if (np == NULL)
badentry(ep, "link not found");
}
}
removeentry(ep);
freename(ep->e_name);
ep->e_next = freelist;
freelist = ep;
} | [
"void",
"freeentry",
"(",
"struct",
"entry",
"*",
"ep",
")",
"{",
"struct",
"entry",
"*",
"np",
";",
"ufs1_ino_t",
"inum",
";",
"if",
"(",
"ep",
"->",
"e_flags",
"!=",
"REMOVED",
")",
"badentry",
"(",
"ep",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"ep",
"->",
"e_type",
"==",
"NODE",
")",
"{",
"if",
"(",
"ep",
"->",
"e_links",
"!=",
"NULL",
")",
"badentry",
"(",
"ep",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"ep",
"->",
"e_entries",
"!=",
"NULL",
")",
"badentry",
"(",
"ep",
",",
"\"",
"\"",
")",
";",
"}",
"if",
"(",
"ep",
"->",
"e_ino",
"!=",
"0",
")",
"{",
"np",
"=",
"lookupino",
"(",
"ep",
"->",
"e_ino",
")",
";",
"if",
"(",
"np",
"==",
"NULL",
")",
"badentry",
"(",
"ep",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"np",
"==",
"ep",
")",
"{",
"inum",
"=",
"ep",
"->",
"e_ino",
";",
"deleteino",
"(",
"inum",
")",
";",
"if",
"(",
"ep",
"->",
"e_links",
"!=",
"NULL",
")",
"addino",
"(",
"inum",
",",
"ep",
"->",
"e_links",
")",
";",
"}",
"else",
"{",
"for",
"(",
";",
"np",
"!=",
"NULL",
";",
"np",
"=",
"np",
"->",
"e_links",
")",
"{",
"if",
"(",
"np",
"->",
"e_links",
"==",
"ep",
")",
"{",
"np",
"->",
"e_links",
"=",
"ep",
"->",
"e_links",
";",
"break",
";",
"}",
"}",
"if",
"(",
"np",
"==",
"NULL",
")",
"badentry",
"(",
"ep",
",",
"\"",
"\"",
")",
";",
"}",
"}",
"removeentry",
"(",
"ep",
")",
";",
"freename",
"(",
"ep",
"->",
"e_name",
")",
";",
"ep",
"->",
"e_next",
"=",
"freelist",
";",
"freelist",
"=",
"ep",
";",
"}"
] | delete an entry from the symbol table | [
"delete",
"an",
"entry",
"from",
"the",
"symbol",
"table"
] | [] | [
{
"param": "ep",
"type": "struct entry"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ep",
"type": "struct entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e041c866d9a3ba34138551a7fd22d407f90fb68f | atrens/DragonFlyBSD-src | sbin/restore/symtab.c | [
"BSD-3-Clause"
] | C | moveentry | void | void
moveentry(struct entry *ep, const char *newname)
{
struct entry *np;
char *cp;
np = lookupparent(newname);
if (np == NULL)
badentry(ep, "cannot move ROOT");
if (np != ep->e_parent) {
removeentry(ep);
ep->e_parent = np;
ep->e_sibling = np->e_entries;
np->e_entries = ep;
}
cp = strrchr(newname, '/') + 1;
freename(ep->e_name);
ep->e_name = savename(cp);
ep->e_namlen = strlen(cp);
if (strcmp(gentempname(ep), ep->e_name) == 0)
ep->e_flags |= TMPNAME;
else
ep->e_flags &= ~TMPNAME;
} | /*
* Relocate an entry in the tree structure
*/ | Relocate an entry in the tree structure | [
"Relocate",
"an",
"entry",
"in",
"the",
"tree",
"structure"
] | void
moveentry(struct entry *ep, const char *newname)
{
struct entry *np;
char *cp;
np = lookupparent(newname);
if (np == NULL)
badentry(ep, "cannot move ROOT");
if (np != ep->e_parent) {
removeentry(ep);
ep->e_parent = np;
ep->e_sibling = np->e_entries;
np->e_entries = ep;
}
cp = strrchr(newname, '/') + 1;
freename(ep->e_name);
ep->e_name = savename(cp);
ep->e_namlen = strlen(cp);
if (strcmp(gentempname(ep), ep->e_name) == 0)
ep->e_flags |= TMPNAME;
else
ep->e_flags &= ~TMPNAME;
} | [
"void",
"moveentry",
"(",
"struct",
"entry",
"*",
"ep",
",",
"const",
"char",
"*",
"newname",
")",
"{",
"struct",
"entry",
"*",
"np",
";",
"char",
"*",
"cp",
";",
"np",
"=",
"lookupparent",
"(",
"newname",
")",
";",
"if",
"(",
"np",
"==",
"NULL",
")",
"badentry",
"(",
"ep",
",",
"\"",
"\"",
")",
";",
"if",
"(",
"np",
"!=",
"ep",
"->",
"e_parent",
")",
"{",
"removeentry",
"(",
"ep",
")",
";",
"ep",
"->",
"e_parent",
"=",
"np",
";",
"ep",
"->",
"e_sibling",
"=",
"np",
"->",
"e_entries",
";",
"np",
"->",
"e_entries",
"=",
"ep",
";",
"}",
"cp",
"=",
"strrchr",
"(",
"newname",
",",
"'",
"'",
")",
"+",
"1",
";",
"freename",
"(",
"ep",
"->",
"e_name",
")",
";",
"ep",
"->",
"e_name",
"=",
"savename",
"(",
"cp",
")",
";",
"ep",
"->",
"e_namlen",
"=",
"strlen",
"(",
"cp",
")",
";",
"if",
"(",
"strcmp",
"(",
"gentempname",
"(",
"ep",
")",
",",
"ep",
"->",
"e_name",
")",
"==",
"0",
")",
"ep",
"->",
"e_flags",
"|=",
"TMPNAME",
";",
"else",
"ep",
"->",
"e_flags",
"&=",
"~",
"TMPNAME",
";",
"}"
] | Relocate an entry in the tree structure | [
"Relocate",
"an",
"entry",
"in",
"the",
"tree",
"structure"
] | [] | [
{
"param": "ep",
"type": "struct entry"
},
{
"param": "newname",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ep",
"type": "struct entry",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "newname",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.