PIPS
|
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "linear.h"
#include "genC.h"
#include "misc.h"
#include "properties.h"
#include "ri-util.h"
#include "text-util.h"
#include "prettyprint.h"
Go to the source code of this file.
Functions | |
text | c_text_entity (entity module, entity e, int margin, list *ppdl, bool init_p) |
Regeneration of declarations from the symbol table. More... | |
list | c_words_entity (type t, list name, list *ppdl) |
static list | words_initial_qualifiers (list obj) |
list | words_dimensions (list dims, list *ppdl) |
static list | words_constant (constant obj) |
static list | words_value (value obj) |
static list | words_parameters (entity e, list *ppdl) |
static list | words_dimension (dimension obj, list *ppdl) |
list | words_declaration (entity e, bool prettyprint_common_variable_dimensions_p, list *ppdl) |
some compilers don't like dimensions that are declared twice. More... | |
list | words_basic (basic obj, list *ppdl) |
what about simple DOUBLE PRECISION, REAL, INTEGER... More... | |
sentence | sentence_variable (entity e, list *ppdl) |
sentence | Sentence_Variable (entity e) |
sentence | sentence_head (entity e, list *ppdl) |
We have no way to distinguish between the SUBROUTINE and PROGRAM They two have almost the same properties. More... | |
static list | generic_words_qualifiers (list obj, bool initial_p, bool late_p) |
================C prettyprinter functions================= More... | |
list | words_qualifiers (list obj) |
static list | words_late_qualifiers (list obj) |
list | words_type (type obj, list *ppdl, bool argument_p) |
obj is the type to describe More... | |
list | Words_Type (type obj) |
bool | c_brace_expression_p (expression e) |
list | words_brace_expression (expression exp, list *ppdl) |
list | generic_c_words_entity (type t, list name, bool is_safe, bool add_dummy_parameter_name_p, list *ppdl) |
This recursive function prints a C variable with its type. More... | |
list | generic_c_words_simplified_entity (type t, list name, bool is_safe, bool add_dummy_parameter_name_p, bool is_first, bool in_type_declaration, bool argument_p, list *ppdl) |
Same as above, but the bool is_first is used to skip a type specifier which is useful when several variables or types are defined in a unique statement such as "int i, *pi, ai[10],...;". More... | |
list | c_words_simplified_entity (type t, list name, bool is_first, bool in_type_declaration, list *ppdl) |
The declaration list pointer ppdl is passed down to determine if an internal derived type must be fully expanded within another declaration or not. More... | |
list | safe_c_words_entity (type t, list name) |
text | c_text_entities (entity module, list ldecl, int margin, list *ppdl) |
Generate declarations for a list of entities belonging to the same statement declaration. More... | |
static list | words_struct_reference (const char *name1, list pc, bool init_p) |
To print out a struct reference, such as "struct s". More... | |
static list | words_enum_reference (const char *name1, list pc, bool init_p) |
Prolog to print out a struct definition, such as "struct s { int a;
int b;}"; for the time being, only the previous function is used. More... | |
static list | words_enum (const char *name1, list l, bool space_p, list pc, list *ppdl) |
static list | words_union (const char *name1, list pc, bool init_p) |
static list | words_variable_or_function (entity module, entity e, bool is_first, list pc, bool in_type_declaration, list *ppdl, bool init_p) |
static list | filtered_declaration_list (list del, list *pcl) |
Fix the declaration list produced by the parser, which includes declared program variables but also derived types used in the declaration or the initialization, to accomodate the prettyprinter, which must decide which derived types appearing in the declaration must be defined, and which one must be referenced: More... | |
text | c_text_related_entities (entity module, list del, int margin, int sn, list *ppdl, list cl) |
It is assumed that all entities in list el can be declared by an unique statement, i.e. More... | |
text | c_text_entity_simple (entity module, entity e, int margin) |
bool c_brace_expression_p | ( | expression | e | ) |
Definition at line 898 of file declarations.c.
References call_function, ENTITY_BRACE_INTRINSIC_P, expression_call_p(), expression_syntax, f(), and syntax_call.
Referenced by words_brace_expression().
Generate declarations for a list of entities belonging to the same statement declaration.
ppdl: derived from the parser declared entity; used to decide if a derived type entity de must be declared as a reference to de (e.g. "struct s") or as the type definition of de (e.g. "struct s {}"). Of course, the type can be defined only once, even if it is referenced several times. Hence, pdl, the list pointed to by ppdl is updated in the loop to avoid redeclarations.
Dummy enum must be printed sometimes because their members are exposed directly.
module | odule |
ldecl | decl |
margin | argin |
ppdl | pdl |
Definition at line 1452 of file declarations.c.
References basic_derived, c_text_entity(), derived_type_p(), DUMMY_ENUM_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, ENTITY, entity_name, entity_storage, entity_type, FOREACH, gen_once(), implicit_c_variable_p(), make_text(), MEMBER_SEP_STRING, MERGE_TEXTS, module, NIL, storage_formal_p, STRUCT_PREFIX, text_undefined, type_area_p, type_statement_p, type_unknown_p, type_used_in_type_declarations_p(), type_variable, ultimate_type(), UNION_PREFIX, and variable_basic.
Referenced by c_text_related_entities(), and ensure_comment_consistency().
Regeneration of declarations from the symbol table.
FI: strange recursion, probably due to Francois...
Regeneration of declarations... ==================== Variables and Function prototypes for C =========== pdl is the parser declaration list. It is used to decide if a derived entity should be simply declared, "struct s", or fully defined, "struct s {....}". It is accessed by its pointer ppdl
c_text_related_entities calls c_text_entities calls c_text_entity calls back c_text_related_entities (!) but with only one element... may call words_variable_or_function calls c_words_simplified_entity calls generic_c_words_simplified_entity
Note: text when newline are involved, words when everything fits on one line.
module | odule |
margin | argin |
ppdl | pdl |
init_p | nit_p |
Definition at line 2087 of file declarations.c.
References c_text_related_entities(), CONS, ENTITY, EXPRESSION, gen_free_list(), gen_full_free_list(), int_to_expression(), module, and NIL.
Referenced by c_text_entities(), c_text_entity_simple(), and compilation_unit_text().
module | odule |
margin | argin |
Definition at line 2100 of file declarations.c.
References c_text_entity(), gen_free_list(), module, and NIL.
Referenced by stub_text().
It is assumed that all entities in list el can be declared by an unique statement, i.e.
their types must be closely related, as in
"int i, *pj, foo();".
But you can also have:
"struct one { struct too {int a;};};"
where no variable is declared. And the parser generate a declaration list stating that "struct two" and "struct one" are declared in this statement.
In other words, this function prints out a C declaration statement, taking into account the derived entities that have to be defined exactly once, pdl. Of course, pdl can be updated by the caller when a derived entity is declared so as to avoid a redeclaration.
At this first level, the declarations of derived types use several lines. If a nested declaration occurs, the nested declaration is packed on a unique line.
List icl indicates for each entity if it should be initialized or not. This is useful for global variable initializations.
If we are not in a compilation unit, the initialization control list is useless and may be wrong because of program transformations such as scalar renaming.
The last entity may be a place holder
overwrite the parser declaration list pdl with del
A declaration has two parts: declaration specifiers and declarator (even with initializer) In declaration specifiers, we can have:
This part is for storage specifiers
&& (extern_p || explicit_extern_entity_p(module, e_last)
|| (extern_entity_p(module, e_last) && !type_functional_p(t_last))))
The global variables stored in static area and in ram but they are not static so a condition is needed, which checks if it is not a global variable
If a derived type is declared first, the qualifiers are carried by the type of the second entity
This part is for type specifiers, type qualifiers, function specifiers and declarator Three special cases for struct/union/enum definitions are treated here. Variable (scalar, array), pointer, function, variables of type struct/union/enum and typedef are treated by function c_words_entity
c = words_variable_or_function(module, e1, true, pc, in_type_declaration, pdl);
the word list pc must have been inserted in text r
Add the declared variables or more declared variables.
add the asm qualifier if needed
the final semi column,
the word list pc must be added to the last sentence of text r
module | odule |
del | el |
margin | argin |
sn | n |
ppdl | pdl |
cl | l |
Definition at line 1815 of file declarations.c.
References ADD_SENTENCE_TO_TEXT, add_words_to_text(), asprintf, c_text_entities(), CAR, CDR, CHAIN_SWORD, compilation_unit_entity_p(), CONS, declarable_type_p(), derived_entity_p(), DUMMY_ENUM_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, ENDP, ENTITY, entity_local_name(), entity_module_p(), entity_name, entity_qualifiers(), entity_storage, entity_type, entity_undefined_p, entity_user_name(), ENUM_PREFIX, EXPRESSION, false, filtered_declaration_list(), FOREACH, free(), gen_in_list_p(), gen_last(), gen_length(), gen_nconc(), gen_once(), get_bool_property(), INDENTATION, integer_constant_expression_value(), is_sentence_unformatted, is_type_area, is_type_enum, is_type_functional, is_type_statement, is_type_struct, is_type_union, is_type_unknown, is_type_varargs, is_type_variable, is_type_void, list_undefined, lname(), MAKE_ONE_WORD_SENTENCE, make_sentence(), make_text(), make_unformatted(), MERGE_TEXTS, module, NIL, pips_assert, pips_debug, pips_internal_error, place_holder_variable_p(), POP, QUALIFIER, qualifier_asm, qualifier_asm_p, ram_section, static_area_p(), static_module_p(), storage_ram, storage_ram_p, strdup(), STRUCT_PREFIX, text_sentences, TOP_LEVEL_MODULE_NAME, true, type_enum, type_struct, type_tag, type_union, type_variable, type_variable_p, TYPEDEF_PREFIX, UNION_PREFIX, variable_qualifiers, words_enum(), words_enum_reference(), words_qualifiers(), words_struct_reference(), words_union(), and words_variable_or_function().
Referenced by c_text_entity().
name | ame |
ppdl | pdl |
Definition at line 1421 of file declarations.c.
References generic_c_words_entity(), ifdebug, list_to_string(), and pips_debug.
Referenced by ensure_comment_consistency(), generic_c_words_simplified_entity(), UpdatePointerEntity(), words_basic(), and words_parameters().
list c_words_simplified_entity | ( | type | t, |
list | name, | ||
bool | is_first, | ||
bool | in_type_declaration, | ||
list * | ppdl | ||
) |
The declaration list pointer ppdl is passed down to determine if an internal derived type must be fully expanded within another declaration or not.
If it is declared by itself, there is no need to expand its declaration again.
name | ame |
is_first | s_first |
in_type_declaration | n_type_declaration |
ppdl | pdl |
Definition at line 1408 of file declarations.c.
References generic_c_words_simplified_entity(), ifdebug, list_to_string(), and pips_debug.
Referenced by ensure_comment_consistency(), and words_variable_or_function().
Fix the declaration list produced by the parser, which includes declared program variables but also derived types used in the declaration or the initialization, to accomodate the prettyprinter, which must decide which derived types appearing in the declaration must be defined, and which one must be referenced:
All entities in del are useful to regenerate the corresponding declaration, but the key entities are the type used for the variables, and the variables. Nested types should not appear in the return list.
FI: I wonder what the parser generates for something like
int foo[sizeof(struct {int a; int b;})] = {...};
No new list is allocated, just a pointer to the first relevant chunk of del.
Filter out secondary types
Filter out initialization flags
FI: initially I assumed > 2 for pattern such as
struct {struct ..} x;
but you can also have a struct declaration:
struct {struct ..};
with no variable declaration. Or a declaration in the rhs via a sizeof or a cast... See below, after the intermediate list.
Maybe, some type related entities such as substructure should not be printed out. Only the last one is useful.
Now we still have to deal with "void * p = ... derived type definition(s)..." Maybe, we simply want to make sure that e1 belongs to type supporting entities of t2... but this is not strong enough because it includes types of formal arguments which are not relevant
If t2 is a pointer, get to the final pointed type.
If nt2 is a functional type, what is the final pointed type returned?
program transformations do not know yet about the prettyprint control list. Let's keep the first element for extern and truncate what's behind, the initialization control list.
Definition at line 1671 of file declarations.c.
References b2, basic_derived, basic_derived_p, CAR, CDR, compilation_unit_entity_p(), derived_entity_p(), ENDP, ENTITY, entity_enum_p(), entity_struct_p(), entity_type, entity_union_p(), f2(), FOREACH, fprintf(), functional_result, gen_free_list(), gen_length(), get_current_module_entity(), ifdebug, NIL, pips_assert, pips_debug, POP, print_entities(), type_functional, type_functional_p, type_to_final_pointed_type(), type_undefined, type_variable, type_variable_p, and variable_basic.
Referenced by c_text_related_entities().
list generic_c_words_entity | ( | type | t, |
list | name, | ||
bool | is_safe, | ||
bool | add_dummy_parameter_name_p, | ||
list * | ppdl | ||
) |
This recursive function prints a C variable with its type.
It can be a simple variable declaration such as "int a" or complicated one such as "int (* forces[10])()" (an array of 10 pointers, each pointer points to a function with no parameter and the return type is int).
Type "t" is recursively traversed and the obtained attribute are accumulated in the list "name" (name of the type, not name of the variable).
Purpose of "is_safe"? Seems to be passed down recursively but never to be used...
In C, functional type can be decorated by optional dummy parameter names.
name | ame |
is_safe | s_safe |
add_dummy_parameter_name_p | dd_dummy_parameter_name_p |
ppdl | pdl |
Definition at line 980 of file declarations.c.
References generic_c_words_simplified_entity().
Referenced by c_words_entity(), safe_c_words_entity(), and stub_text().
list generic_c_words_simplified_entity | ( | type | t, |
list | name, | ||
bool | is_safe, | ||
bool | add_dummy_parameter_name_p, | ||
bool | is_first, | ||
bool | in_type_declaration, | ||
bool | argument_p, | ||
list * | ppdl | ||
) |
Same as above, but the bool is_first is used to skip a type specifier which is useful when several variables or types are defined in a unique statement such as "int i, *pi, ai[10],...;".
type t: new type to add in front of the word list name
list name: later part of the declaration being built
bool is_safe: does not seem to be used anymore
bool add_dummy_parameter_name_p: for function declarations, add a dummy parameter name to the type of each formal parameter
bool is_first: prettyprint the qualifiers or not; they should be printed only once when they apply to several declarations as in:
"register int i, j;"
in_type_declaration is set to true when a variable is declared at the same time as its type
argument_p: the type is used as argument type in a function declaration
list ppdl: pointer to the declaration list to decide if data structures appearing in another data structure must be declared independently or not. See validation cases struct03.c, struct04.c and struct05.c.
Function name is an expression like *vfs[] in (*vfs[])() (syntax = application), or an abstract function type, so parentheses must be added
Function name is a simple reference
RK wants us to use another better function than i2a, but its name is not documented next to i2a() source code and here the string is going to be strduped, which makes i2a() a better choice.
ips_debug(3,"Parameter type %s\n ", type_undefined_p(t1)? "type_undefined" : words_to_string(words_type(t1, ppdl, true)));
c_words_entity(t1,NIL) should be replaced by c_words_entity(t1,name_of_corresponding_parameter)
Add type qualifiers if there are
FI: left out of the previous declaration internal representation
&& !qualifiers_p
Array name is an expression like __ctype+1 in (__ctype+1)[*np] (syntax = subscript), or abstract type, parentheses must be added
Array name is a simple reference
The derived type has been declared explicitly elsewhere: see struct05.c
The derived type is declared by itself
Do not recurse down if the derived type reference itself
A place holder variable has no name and require no space
This section is derived from c_text_entity()
it is used for structures, unions and enums which have no names because they are part of a more global declaration such as typedef s
FI: The union and the struct cases could be merged.
name | ame |
is_safe | s_safe |
add_dummy_parameter_name_p | dd_dummy_parameter_name_p |
is_first | s_first |
in_type_declaration | n_type_declaration |
argument_p | rgument_p |
ppdl | pdl |
Definition at line 1017 of file declarations.c.
References argument_p(), array_type_p(), basic_bit, basic_derived, basic_pointer, basic_type_p(), basic_typedef, bit_type_p(), c_words_entity(), CAR, CDR, CHAIN_SWORD, concatenate(), CONS, constant_int, constant_int_p, copy_type(), declarable_type_p(), derived_type_p(), DUMMY_ENUM_PREFIX, dummy_identifier, DUMMY_MEMBER_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, dummy_unknown_p, ENDP, ENTITY, entity_initial, entity_local_name(), entity_name, entity_type, entity_user_name(), ENUM_PREFIX, f(), free(), free_type(), functional_parameters, functional_result, gen_full_free_list(), gen_in_list_p(), gen_length(), gen_nconc(), gen_once(), get_bool_property(), i2a(), list_to_string(), list_undefined, lparams, NIL, overloaded_parameters_p(), PARAMETER, parameter_dummy, parameter_type, pips_debug, pips_internal_error, pointer_type_p(), POP, qualifiers_const_p(), qualifiers_restrict_p(), ret, same_string_p, strdup(), STRING, string_type_p(), string_undefined, string_undefined_p, STRUCT_PREFIX, symbolic_constant, symbolic_expression, type_enum, type_enum_p, type_functional, type_functional_p, type_struct, type_struct_p, type_undefined_p, type_union, type_union_p, type_varargs_p, type_variable, type_variable_p, type_void, type_void_p, typedef_type_p(), UNION_PREFIX, value_symbolic, variable_basic, variable_dimensions, variable_qualifiers, words_dimensions(), words_expression(), words_initial_qualifiers(), words_late_qualifiers(), words_qualifiers(), and words_type().
Referenced by c_words_simplified_entity(), and generic_c_words_entity().
================C prettyprinter functions=================
returns a list of words corresponding to a list of qualifiers...
obj is a list of qualifiers.
initial_p :
late_p:
Space management?
FI: might not be an initial qualifier either
FI: the auto case was missing; I have no idea why.
asm qualifiers a reprinted in the end ...
FI: I have no idea about initial_p and late_p...
Definition at line 704 of file declarations.c.
References CHAIN_SWORD, ENDP, FOREACH, gen_nconc(), get_string_property(), is_qualifier_asm, is_qualifier_auto, is_qualifier_const, is_qualifier_constant, is_qualifier_global, is_qualifier_local, is_qualifier_private, is_qualifier_register, is_qualifier_restrict, is_qualifier_static_dimension, is_qualifier_thread, is_qualifier_volatile, NIL, pips_internal_error, QUALIFIER, qualifier_tag, and same_string_p.
Referenced by words_initial_qualifiers(), words_late_qualifiers(), and words_qualifiers().
Ignore the parser declared entities?
name | ame |
Definition at line 1433 of file declarations.c.
References gen_free_list(), generic_c_words_entity(), and NIL.
Referenced by FindOrCreateCurrentEntity(), UpdateEntity(), and UpdateFunctionEntity().
We have no way to distinguish between the SUBROUTINE and PROGRAM They two have almost the same properties.
For the time being, especially for the PUMA project, we have a temporary idea to deal with it: When there's no argument(s), it should be a PROGRAM, otherwise, it should be a SUBROUTINE. Lei ZHOU 18/10/91
correct PROGRAM and SUBROUTINE distinction added, FC 18/08/94 approximate BLOCK DATA / SUBROUTINE distinction also added. FC 09/97
ppdl | pdl |
Definition at line 601 of file declarations.c.
References CHAIN_SWORD, ENDP, entity_blockdata_p(), entity_f95module_p(), entity_main_module_p(), entity_type, entity_user_name(), functional_result, gen_nconc(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, is_sentence_unformatted, is_type_unknown, is_type_variable, is_type_void, make_sentence(), make_unformatted(), NIL, pips_assert, pips_internal_error, prettyprint_language_is_c_p(), static_module_p(), type_functional, type_functional_p, type_tag, type_unknown_p, type_variable, type_variable_p, type_void_p, variable_basic, variable_qualifiers, words_basic(), words_parameters(), and words_qualifiers().
Referenced by ensure_comment_consistency().
Definition at line 583 of file declarations.c.
References gen_free_list(), NIL, and sentence_variable().
Referenced by make_emulated_shared_variable(), and set_dimensions_of_local_variable_family().
ppdl | pdl |
Definition at line 567 of file declarations.c.
References CHAIN_SWORD, entity_type, gen_nconc(), is_sentence_unformatted, make_sentence(), make_unformatted(), NIL, pips_assert, type_variable, type_variable_p, variable_basic, words_basic(), and words_declaration().
Referenced by Sentence_Variable().
what about simple DOUBLE PRECISION, REAL, INTEGER...
This may happen in debugging statements
if(basic_int(obj)==4) { pc = CHAIN_SWORD(pc,"INTEGER"); } else {
FI: Use "bool" of stdbool.h instead of "int" but it leads to include issue for generated code; avoid stdbool.h and use "_Bool" directly but it leads to infinite loop from "_Bool" to "_Bool" because "_Bool" is declared as a typedef in anr999
should be a user error? Or simply bootstrap.c is not accurate?
ignore if it is signed or unsigned
The following code maybe redundant, because of tests in c_words_entity
This may occur in the parser when a variable is used before it is fully defined (see ptr in decl42.c)
FI: This space may not be always useful
obj | bj |
ppdl | pdl |
Definition at line 323 of file declarations.c.
References basic_bit, basic_complex, basic_derived, basic_float, basic_int, basic_logical, basic_pointer, basic_string, basic_tag, basic_typedef, basic_undefined_p, c_words_entity(), CHAIN_IWORD, CHAIN_SWORD, constant_int, DUMMY_ENUM_PREFIX, DUMMY_STRUCT_PREFIX, DUMMY_UNION_PREFIX, entity_local_name(), entity_type, entity_user_name(), ENUM_PREFIX, gen_nconc(), get_prettyprint_language_tag(), get_string_property(), is_basic_bit, is_basic_complex, is_basic_derived, is_basic_float, is_basic_int, is_basic_logical, is_basic_overloaded, is_basic_pointer, is_basic_string, is_basic_typedef, is_language_c, is_language_fortran, is_language_fortran95, lname(), NIL, pips_debug, pips_internal_error, STRUCT_PREFIX, symbolic_constant, type_undefined_p, UNION_PREFIX, words_type(), and words_value().
Referenced by basic_to_string(), find_or_create_allocatable_struct(), sentence_head(), sentence_variable(), and words_type().
list words_brace_expression | ( | expression | exp, |
list * | ppdl | ||
) |
exp | xp |
ppdl | pdl |
Definition at line 910 of file declarations.c.
References c_brace_expression_p(), call_arguments, CHAIN_SWORD, exp, EXPRESSION, expression_syntax, gen_nconc(), get_bool_property(), MAP, NIL, syntax_call, and words_expression().
Referenced by words_brace_op(), and words_variable_or_function().
hat about real, double, string constants ... ?
Definition at line 60 of file declarations.c.
References CHAIN_IWORD, constant_int, constant_int_p, NIL, and pips_internal_error.
Referenced by words_value().
some compilers don't like dimensions that are declared twice.
declarations.c
this is the case of g77 used after hpfc. thus I added a flag not to prettyprint again the dimensions of common variables. FC.
It is in the standard that dimensions cannot be declared twice in a single module. BC.
prettyprint_common_variable_dimensions_p | rettyprint_common_variable_dimensions_p |
ppdl | pdl |
Definition at line 277 of file declarations.c.
References attach_declaration_to_words(), CAR, CDR, CHAIN_SWORD, DIMENSION, entity_type, entity_user_name(), gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, MAPL, NIL, pips_internal_error, pl, type_variable, type_variable_p, variable_dimensions, variable_in_common_p(), variable_static_p(), and words_dimension().
Referenced by loop_private_variables(), sentence_area(), sentence_variable(), and text_entity_declaration().
The lower bound of array in C is always equal to 0, we only need to print (upper dimension + 1)
To deal with partial eval generated expressions
to be refined here to make more beautiful expression, use normalize ? FI: why would we modify the user C source code?
Definition at line 189 of file declarations.c.
References binary_call_lhs, binary_call_rhs, call_function, call_undefined, CHAIN_IWORD, CHAIN_SWORD, constant_int_p, CreateIntrinsic(), dimension_lower, dimension_qualifiers, dimension_upper, ENDP, ENTITY_MINUS_C_P, ENTITY_MINUS_P, entity_undefined, expression_call_p(), expression_constant(), expression_constant_p(), expression_integer_value(), expression_syntax, expression_to_int(), expression_undefined, f(), gen_nconc(), get_prettyprint_language_tag(), int_to_expression(), intptr_t, is_language_c, is_language_fortran, is_language_fortran95, MakeBinaryCall(), NIL, pips_internal_error, syntax_call, unbounded_dimension_p(), words_expression(), and words_qualifiers().
Referenced by words_declaration(), and words_dimensions().
dims | ims |
ppdl | pdl |
Definition at line 932 of file declarations.c.
References CHAIN_SWORD, FOREACH, gen_nconc(), get_bool_property(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, pips_internal_error, and words_dimension().
Referenced by generic_c_words_simplified_entity(), get_symbol_table(), and words_type().
Definition at line 1535 of file declarations.c.
References CAR, CHAIN_SWORD, constant_int, constant_int_p, DUMMY_ENUM_PREFIX, ENDP, ENTITY, entity_initial, entity_user_name(), gen_nconc(), list_undefined, POP, symbolic_constant, symbolic_expression, value_symbolic, and words_expression().
Referenced by c_text_related_entities().
Prolog to print out a struct definition, such as "struct s { int a; int b;}"; for the time being, only the previous function is used.
Definition at line 1524 of file declarations.c.
References CHAIN_SWORD, and DUMMY_ENUM_PREFIX.
Referenced by c_text_related_entities().
Definition at line 800 of file declarations.c.
References generic_words_qualifiers().
Referenced by generic_c_words_simplified_entity().
Definition at line 805 of file declarations.c.
References generic_words_qualifiers().
Referenced by generic_c_words_simplified_entity().
If prettyprint alternate returns... Property to be added.
param can be undefined for C language: void foo(void) We do not have an entity corresponding to the 1st argument
Should be correct, but seems useless
FI: types and derived entities used for the formal parameters should be defined before end. If ever they are defined in the formal scope, they cannot be used elsewhere.
FI: It might be better to implement the same behavior without building npdl, by passing an extra parameter... But you would have to check all call sites to c_words_entity().
npdl
Definition at line 96 of file declarations.c.
References c_words_entity(), CHAIN_SWORD, entity_local_name(), entity_name, entity_type, entity_undefined_p, find_ith_parameter(), formal_label_replacement_p(), functional_parameters, gen_length(), gen_nconc(), gen_nth(), get_bool_property(), get_prettyprint_language_tag(), is_language_c, is_language_fortran, is_language_fortran95, NIL, PARAMETER, parameter_type, pips_assert, pips_internal_error, pips_user_warning, type_functional, type_functional_p, type_undefined, and words_type().
Referenced by sentence_head().
obj | bj |
Definition at line 795 of file declarations.c.
References generic_words_qualifiers().
Referenced by c_text_related_entities(), generic_c_words_simplified_entity(), get_symbol_table(), print_qualifiers(), sentence_head(), words_dimension(), and words_type().
To print out a struct reference, such as "struct s".
Definition at line 1497 of file declarations.c.
References CHAIN_SWORD, and DUMMY_STRUCT_PREFIX.
Referenced by c_text_related_entities().
obj | bj |
Definition at line 891 of file declarations.c.
References NIL, and words_type().
obj is the type to describe
pdl is a list of already/previously declared data structures (not 100 % sure)
argument_p: the type is used as an argument type in a function declaration; if an argument appears with the "unknown" type it is explicitly declared "int"
returns a list of strings, called "words".
The default type is int. It can be skipped in direct declarations, but not as type of an argument in a function declaration
obj | bj |
ppdl | pdl |
argument_p | rgument_p |
Definition at line 821 of file declarations.c.
References argument_p(), CHAIN_SWORD, CONS, dump_functional(), gen_nconc(), is_type_enum, is_type_functional, is_type_struct, is_type_union, is_type_unknown, is_type_varargs, is_type_variable, is_type_void, list_to_string(), NIL, pips_debug, pips_internal_error, STRING, string_buffer_free(), string_buffer_make(), string_buffer_to_string(), string_undefined, type_functional, type_tag, type_variable, type_void, variable_basic, variable_dimensions, variable_qualifiers, words_basic(), words_dimensions(), and words_qualifiers().
Referenced by ensure_comment_consistency(), generic_c_words_simplified_entity(), print_type(), string_of_type(), type_to_full_string_definition(), words_basic(), words_parameters(), Words_Type(), and words_va_arg().
Definition at line 1584 of file declarations.c.
References CHAIN_SWORD, and DUMMY_UNION_PREFIX.
Referenced by c_text_related_entities().
Definition at line 74 of file declarations.c.
References CHAIN_SWORD, NIL, pips_internal_error, symbolic_constant, value_constant, value_constant_p, value_symbolic, value_symbolic_p, value_unknown_p, and words_constant().
Referenced by words_basic().
|
static |
This part is for declarator initialization if there is. If the entity is declared extern wrt current module, do not add this initialization
normal mode: module is defined
init_p is much more reliable
&& !extern_entity_p(module,e)
debugging mode: module is often undefined
it must be a pointer to a function. See encoding in set_entity_initial: how could this work with several pointers or pointer arrays to initialize?
Definition at line 1596 of file declarations.c.
References ASSIGN_OPERATOR_PRECEDENCE, brace_expression_p(), c_words_simplified_entity(), CAR, CHAIN_SWORD, code_initializations, ENDP, entity_initial, entity_type, entity_undefined_p, entity_user_name(), exp, gen_nconc(), instruction_expression, module, NIL, place_holder_variable_p(), sequence_statements, STATEMENT, statement_instruction, type_variable_p, value_code, value_code_p, value_expression, value_expression_p, value_undefined_p, words_brace_expression(), words_expression(), and words_subexpression().
Referenced by c_text_related_entities().