PIPS
flint.c File Reference
#include "local.h"
+ Include dependency graph for flint.c:

Go to the source code of this file.

Functions

bool flinter (const string module_name)
 Routine of global module verification
More...
 
void flint_message (char *fun, char *fmt,...)
 
void flint_message_2 (char *fun, char *fmt,...)
 Same as flint_message but without the function name
More...
 
void raw_flint_message (bool count, char *fmt,...)
 Same as flint_message but a bare bones version
More...
 

Variables

static FILE * flint_messages_file = NULL
 internal variables More...
 
static bool no_message = true
 
static int number_of_messages = 0
 
statement flint_current_statement = statement_undefined
 cproto-generated files More...
 
static char * flint_current_module_name
 name of module being flinted More...
 

Function Documentation

◆ flint_message()

void flint_message ( char *  fun,
char *  fmt,
  ... 
)

print out remainder of message

Parameters
funun
fmtmt

Definition at line 147 of file flint.c.

150 {
151  va_list args;
152  int order;
153 
154  va_start(args, fmt);
155 
156  /*
157  * print name of function causing message, and in which module it
158  * occured.
159  */
160 
161  no_message = false;
163 
165 
167  "flint message from %s, in module %s, in statement (%d.%d), number %td\n",
169  ORDERING_NUMBER(order), ORDERING_STATEMENT(order),
171 
172 
173  /* print out remainder of message */
174  (void) vfprintf(flint_messages_file, fmt, args);
175 
176  va_end(args);
177 
178 }
static bool no_message
Definition: flint.c:44
static FILE * flint_messages_file
internal variables
Definition: flint.c:43
static char * flint_current_module_name
name of module being flinted
Definition: flint.c:49
static int number_of_messages
Definition: flint.c:45
statement flint_current_statement
cproto-generated files
Definition: flint.c:46
#define ORDERING_NUMBER(o)
#define ORDERING_STATEMENT(o)
#define statement_ordering(x)
Definition: ri.h:2454
#define statement_number(x)
Definition: ri.h:2452
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References flint_current_module_name, flint_current_statement, flint_messages_file, fprintf(), no_message, number_of_messages, ORDERING_NUMBER, ORDERING_STATEMENT, statement_number, and statement_ordering.

Referenced by check_call_args_number(), check_call_basic(), check_call_dim(), check_call_one_mode(), check_one_common(), check_procedure(), check_the_reference(), control_type_in_expression(), find_bd_call(), find_bd_expression(), and find_bd_type_variable().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flint_message_2()

void flint_message_2 ( char *  fun,
char *  fmt,
  ... 
)

Same as flint_message but without the function name

print out remainder of message

Parameters
funun
fmtmt

Definition at line 183 of file flint.c.

186 {
187  va_list args;
188 
189  va_start(args, fmt);
190 
191  no_message = false;
193 
195  "flint message from %s, in module %s\n",
197 
198  /* print out remainder of message */
199  (void) vfprintf(flint_messages_file, fmt, args);
200 
201  va_end(args);
202 
203 }

References flint_current_module_name, flint_messages_file, fprintf(), no_message, and number_of_messages.

Referenced by check_overlap_in_common().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ flinter()

bool flinter ( const string  module_name)

Routine of global module verification

user_error() is not used in flint, no need for an exception handler

Getting parsed code of module

the last parameter should be pure=true; the code should not be modified!

Resource to trace uninitialized variables:

what is done

checking commons

checking syntax

final message

Should have worked:

Parameters
module_nameodule_name

Definition at line 54 of file flint.c.

55 {
58  statement module_stat;
59  string localfilename = NULL;
60  string filename = NULL;
61 
62  /* user_error() is not used in flint, no need for an exception handler */
63 
64  debug_on("FLINT_DEBUG_LEVEL");
65 
69  no_message = true;
70 
71  debug(1, "flinter", "flinting module %s\n", module_name);
72 
73  /* Getting parsed code of module */
74  /* the last parameter should be pure=true; the code should not be modified! */
75  module_stat = (statement)
76  db_get_memory_resource(DBR_CODE, module_name, true);
77 
78  /* Resource to trace uninitialized variables: */
80  (graph) db_get_memory_resource(DBR_CHAINS, module_name, true);
81  set_ordering_to_statement(module_stat);
82 
84  db_get_memory_resource(DBR_PROPER_EFFECTS,
86  true));
87  set_current_module_statement(module_stat);
89 
90  localfilename = db_build_file_resource_name(DBR_FLINTED_FILE,
92  ".flinted");
94  "/", localfilename, NULL));
96  (FILE *) safe_fopen(filename, "w");
97 
98  /* what is done */
99  pips_debug(3, "checking uninitialized variables\n");
101 
102  debug(3, "flinter", "checking commons\n");
103  check_commons(module); /* checking commons */
104 
105  debug(3, "flinter", "checking statements\n");
106  flint_statement(module_stat); /* checking syntax */
107 
108  if (no_message) /* final message */
110  "%s has been flinted : everything is ok.\n",
111  module_name);
112  else
114  "number of messages from flint for %s : %d\n",
115  module_name,
117 
118  safe_fclose(flint_messages_file, filename);
119  DB_PUT_FILE_RESOURCE(DBR_FLINTED_FILE, strdup(module_name),
120  localfilename);
121  free(filename);
122 
125  number_of_messages = 0;
126  no_message = true;
127 
132 
133  debug_off();
134 
135  /* Should have worked: */
136  return true;
137 }
static graph dependence_graph
Definition: delay.c:93
struct _newgen_struct_statement_ * statement
Definition: cloning.h:21
void reset_proper_rw_effects(void)
void set_proper_rw_effects(statement_effects)
const char * module_name(const char *s)
Return the module part of an entity name.
Definition: entity_names.c:296
FILE * safe_fopen(const char *filename, const char *what)
Definition: file.c:67
int safe_fclose(FILE *stream, const char *filename)
Definition: file.c:77
bool check_commons(entity)
Definition: flint_check.c:632
void flint_uninitialized_variables(graph, statement)
uninitialized_variables.c
statement flint_statement(statement)
Definition: flint_walk.c:278
void free(void *)
struct _newgen_struct_graph_ * graph
Definition: graph.h:31
void reset_current_module_entity(void)
Reset the current module entity.
Definition: static.c:97
void reset_current_module_statement(void)
Reset the current module statement.
Definition: static.c:221
statement set_current_module_statement(statement)
Set the current module statement.
Definition: static.c:165
entity set_current_module_entity(entity)
static.c
Definition: static.c:66
string db_get_memory_resource(const char *rname, const char *oname, bool pure)
Return the pointer to the resource, whatever it is.
Definition: database.c:755
#define DB_PUT_FILE_RESOURCE
Put a file resource into the current workspace database.
Definition: pipsdbm-local.h:85
string db_build_file_resource_name(const char *rname, const char *oname, const char *suffix)
returns an allocated file name for a file resource.
Definition: lowlevel.c:169
#define debug_on(env)
Definition: misc-local.h:157
#define pips_debug
these macros use the GNU extensions that allow variadic macros, including with an empty list.
Definition: misc-local.h:145
#define debug_off()
Definition: misc-local.h:160
void debug(const int the_expected_debug_level, const char *calling_function_name, const char *a_message_format,...)
ARARGS0.
Definition: debug.c:189
string concatenate(const char *,...)
Return the concatenation of the given strings.
Definition: string.c:183
hash_table set_ordering_to_statement(statement s)
To be used instead of initialize_ordering_to_statement() to make sure that the hash table ots is in s...
Definition: ordering.c:172
void reset_ordering_to_statement(void)
Reset the mapping from ordering to statement.
Definition: ordering.c:185
static char * module
Definition: pips.c:74
string db_get_current_workspace_directory(void)
Definition: workspace.c:96
entity local_name_to_top_level_entity(const char *n)
This function try to find a top-level entity from a local name.
Definition: entity.c:1450
#define statement_undefined
Definition: ri.h:2419
char * strdup()

References check_commons(), concatenate(), db_build_file_resource_name(), db_get_current_workspace_directory(), db_get_memory_resource(), DB_PUT_FILE_RESOURCE, debug(), debug_off, debug_on, dependence_graph, flint_current_module_name, flint_current_statement, flint_messages_file, flint_statement(), flint_uninitialized_variables(), fprintf(), free(), local_name_to_top_level_entity(), module, module_name(), no_message, number_of_messages, pips_debug, reset_current_module_entity(), reset_current_module_statement(), reset_ordering_to_statement(), reset_proper_rw_effects(), safe_fclose(), safe_fopen(), set_current_module_entity(), set_current_module_statement(), set_ordering_to_statement(), set_proper_rw_effects(), statement_undefined, and strdup().

+ Here is the call graph for this function:

◆ raw_flint_message()

void raw_flint_message ( bool  count,
char *  fmt,
  ... 
)

Same as flint_message but a bare bones version

count is used to decide if we count tjis message or not.

Parameters
countount
fmtmt

Definition at line 211 of file flint.c.

214 {
215  va_list args;
216 
217  va_start(args, fmt);
218 
219  no_message = false;
220  if (count)
222 
223  (void) vfprintf(flint_messages_file, fmt, args);
224 
225  va_end(args);
226 }
static int count
Definition: SDG.c:519

References count, flint_messages_file, no_message, and number_of_messages.

Referenced by flint_check_uninitialized_variables_in_statement(), and flint_uninitialized_variables().

+ Here is the caller graph for this function:

Variable Documentation

◆ flint_current_module_name

char* flint_current_module_name
static

name of module being flinted

Definition at line 49 of file flint.c.

Referenced by flint_message(), flint_message_2(), and flinter().

◆ flint_current_statement

statement flint_current_statement = statement_undefined

cproto-generated files

Warning! Do not modify this file that is automatically generated!

flint.c

Definition at line 46 of file flint.c.

Referenced by flint_message(), flint_statement(), and flinter().

◆ flint_messages_file

FILE* flint_messages_file = NULL
static

internal variables

Definition at line 43 of file flint.c.

Referenced by flint_message(), flint_message_2(), flinter(), and raw_flint_message().

◆ no_message

bool no_message = true
static

Definition at line 44 of file flint.c.

Referenced by flint_message(), flint_message_2(), flinter(), and raw_flint_message().

◆ number_of_messages

int number_of_messages = 0
static

Definition at line 45 of file flint.c.

Referenced by flint_message(), flint_message_2(), flinter(), and raw_flint_message().