PIPS
utils.c File Reference
#include <stdio.h>
#include "genC.h"
#include "linear.h"
#include "misc.h"
#include "pipsdbm.h"
#include "ri.h"
#include "effects.h"
#include "ri-util.h"
#include "effects-util.h"
#include "text-util.h"
#include "prettyprint.h"
+ Include dependency graph for utils.c:

Go to the source code of this file.

Functions

static void spear_log_alist (const char *pips_func, const char *pips_file, const int pips_line, pips_log_t tag, statement stat, const string hint, const string format, va_list *args)
 internal alist-level processing for spear warning & error logging More...
 
void spear_log_func (const char *pips_func, const char *pips_file, const int pips_line, pips_log_t tag, statement stat, const string hint, const string format,...)
 generate a spear user warning or spear user error. More...
 

Variables

static int spear_warning_count = 0
 keep a count of spear issues More...
 
static int spear_error_count = 0
 

Function Documentation

◆ spear_log_alist()

static void spear_log_alist ( const char *  pips_func,
const char *  pips_file,
const int  pips_line,
pips_log_t  tag,
statement  stat,
const string  hint,
const string  format,
va_list *  args 
)
static

internal alist-level processing for spear warning & error logging

Definition at line 53 of file utils.c.

62 {
63  pips_assert("spear log", tag == spear_warning_log || tag == spear_error_log);
64 
65  if (tag == spear_warning_log)
67  else if (tag == spear_error_log)
69 
71 
72  pips_assert("some current module", module != NULL);
73 
74  // where is the user code?
75  int ln = -1;
76  string sstat = NULL;
77  string stat_file = NULL;
78 
79  if (stat && !statement_undefined_p(stat))
80  {
81  // what is a really the statement number?
82  ln = statement_number(stat);
83  sstat = proper_statement_to_string(stat);
84  stat_file = db_get_memory_resource(DBR_INPUT_FILE_NAME, module, true);
85  }
86 
89  // where in pips
90  (const string) pips_func, (const string) pips_file, pips_line,
91  // where in user code
92  module, stat_file, ln, -1,
93  sstat, hint, format, args);
94 
95  free(sstat);
96 }
void pips_log_alist(const pips_log_t tag, const string pips_pass, const string pips_owner, const string pips_func, const string pips_file, const int pips_line, const string user_func, const string user_file, const int user_line, const int user_line2, const string stmt, const string suggestion, const string format, va_list *args)
log entry with unprocessed format/alist arguments
Definition: message.c:1200
string get_pips_current_pass_name(void)
Export this piece of information to customize warning functions in passes.
Definition: message.c:77
string get_pips_current_module(void)
Definition: message.c:82
void free(void *)
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
@ spear_warning_log
Definition: misc-local.h:35
@ spear_error_log
Definition: misc-local.h:36
#define pips_assert(what, predicate)
common macros, two flavors depending on NDEBUG
Definition: misc-local.h:172
static int spear_warning_count
keep a count of spear issues
Definition: utils.c:48
static int spear_error_count
Definition: utils.c:49
int tag
TAG.
Definition: newgen_types.h:92
static char * module
Definition: pips.c:74
string proper_statement_to_string(statement)
#define statement_undefined_p(x)
Definition: ri.h:2420
#define statement_number(x)
Definition: ri.h:2452

References db_get_memory_resource(), free(), get_pips_current_module(), get_pips_current_pass_name(), module, pips_assert, pips_log_alist(), proper_statement_to_string(), spear_error_count, spear_error_log, spear_warning_count, spear_warning_log, statement_number, and statement_undefined_p.

Referenced by spear_log_func().

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

◆ spear_log_func()

void spear_log_func ( const char *  pips_func,
const char *  pips_file,
const int  pips_line,
pips_log_t  tag,
statement  stat,
const string  hint,
const string  format,
  ... 
)

generate a spear user warning or spear user error.

cproto-generated files

this function is not expected to be called directly, but it should be redirected here from a macro "spear_error(stat, hing, fmt, ...)"

Parameters
pips_funcips_func
pips_fileips_file
pips_lineips_line
stattat
hintint
formatormat

Definition at line 102 of file utils.c.

113 {
114  va_list args;
115  va_start(args, format);
116  spear_log_alist(pips_func, pips_file, pips_line, tag,
117  stat, hint, format, &args);
118  va_end(args);
119 }
static void spear_log_alist(const char *pips_func, const char *pips_file, const int pips_line, pips_log_t tag, statement stat, const string hint, const string format, va_list *args)
internal alist-level processing for spear warning & error logging
Definition: utils.c:53

References spear_log_alist().

+ Here is the call graph for this function:

Variable Documentation

◆ spear_error_count

int spear_error_count = 0
static

Definition at line 49 of file utils.c.

Referenced by spear_log_alist().

◆ spear_warning_count

int spear_warning_count = 0
static

keep a count of spear issues

Definition at line 48 of file utils.c.

Referenced by spear_log_alist().