PIPS
misc.h
Go to the documentation of this file.
1 /* Warning! Do not modify this file that is automatically generated! */
2 /* Modify src/Libs/misc/misc-local.h instead, to add your own modifications. */
3 
4 /* header file built by cproto */
5 
6 #ifndef misc_header_included
7 #define misc_header_included
8 /* misc-local.h */
9 /*
10 
11  $Id: misc-local.h 23642 2021-03-10 09:40:38Z coelho $
12 
13  Copyright 1989-2016 MINES ParisTech
14 
15  This file is part of PIPS.
16 
17  PIPS is free software: you can redistribute it and/or modify it
18  under the terms of the GNU General Public License as published by
19  the Free Software Foundation, either version 3 of the License, or
20  any later version.
21 
22  PIPS is distributed in the hope that it will be useful, but WITHOUT ANY
23  WARRANTY; without even the implied warranty of MERCHANTABILITY or
24  FITNESS FOR A PARTICULAR PURPOSE.
25 
26  See the GNU General Public License for more details.
27 
28  You should have received a copy of the GNU General Public License
29  along with PIPS. If not, see <http://www.gnu.org/licenses/>.
30 
31 */
32 
33 #include <stdarg.h>
34 #include <stdlib.h>
35 #include <setjmp.h>
36 
37 // different type of logs...
38 // pg: debug, log, notice, warning, error, fatal, panic
39 typedef enum {
40  none_log, // nought
41  info_log, // some information
42  warning_log, // just a warning
45  user_error_log, // phase is stopped because of user, exception
46  internal_error_log, // phase is stopped because of pips, exception
47  irrecoverable_error_log // phase is stopped because of pips + exit/abort
49 
50 // logic: 128 + SIGALRM==14 == 142
51 #define TIMEOUT_CODE (128+14)
52 
53 /* To generate a string from a macro: */
54 #define STRINGIFY_SECOND_STAGE(symbol) #symbol
55 /* If not using this 2-stage macro evaluation, the generated string is not
56  the value of the macro but the name of the macro... Who said C was a
57  simple language? :-/ */
58 #define STRINGIFY(symbol) STRINGIFY_SECOND_STAGE(symbol)
59 
60 // yep, override system abort/exit...
61 #define abort() pips_stop(internal_error_log, -1, "abort() called")
62 #define exit(code) pips_stop(user_error_log, code, "exit(%d) called", code)
63 
64 /* Measurement type for mem_spy.c */
66 
67 # if defined(CURRENT_FUNCTION)
68 # undef CURRENT_FUNCTION
69 # endif // CURRENT_FUNCTION
70 
71 #define pips_unknown_function "Unknown Function Name"
72 
73 # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) // C99
74 # define CURRENT_FUNCTION __func__
75 # else
76 # if defined(__GNUC__) // GCC
77 # define CURRENT_FUNCTION __FUNCTION__
78 # else
79 # define CURRENT_FUNCTION pips_unknown_function
80 # endif // __GNUC__
81 # endif // C99
82 
83 /* these macros use the GNU extensions that allow variadic macros,
84  * including with an empty list.
85  *
86  * if not available, function calls are used.
87  *
88  * a slightly better job could be done if C99 is assumed.
89  */
90 
91 #if defined(__GNUC__) // GCC
92 
93 // Use the old "do {...} while(0)" C hack to allow a macro with arbitrary
94 // code to be used everywhere
95 
96 #define pips_debug(level, format, args...) \
97  do { \
98  ifdebug(level) { \
99  fprintf(stderr, "[%s] " format, CURRENT_FUNCTION, ##args); \
100  } \
101  } while(0)
102 
103 #define pips_user_warning(format, args...) \
104  pips_user_warning_func(CURRENT_FUNCTION, __FILE__, __LINE__, format, ##args)
105 
106 #define pips_user_error(format, args...) \
107  pips_user_error_func(CURRENT_FUNCTION, __FILE__, __LINE__, format, ##args)
108 
109 #define pips_user_irrecoverable_error(format, args...) \
110  pips_user_irrecoverable_error_func(CURRENT_FUNCTION, __FILE__, __LINE__, \
111  format, ##args)
112 
113 // internal errors add file/line information
114 #define pips_internal_error(format, args...) \
115  pips_internal_error_func(CURRENT_FUNCTION, __FILE__ , __LINE__, \
116  format, ##args)
117 
118 #define pips_log(args...) \
119  pips_log_func(CURRENT_FUNCTION, __FILE__, __LINE__, ##args)
120 
121 #define pips_stop(args...) \
122  pips_stop_func(CURRENT_FUNCTION, __FILE__, __LINE__, ##args)
123 
124 #elif defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) // C99
125 
126 #define pips_debug(level, ...) \
127  do { \
128  ifdebug(level) \
129  pips_debug_func(level, CURRENT_FUNCTION, __VA_ARGS__); \
130  } while (0)
131 
132 #define pips_user_warning(...) \
133  pips_user_warning_func(CURRENT_FUNCTION, __FILE__, __LINE__, __VA_ARGS__)
134 
135 #define pips_user_error(...) \
136  pips_user_error_func(CURRENT_FUNCTION, __FILE__, __LINE__, __VA_ARGS__)
137 
138 #define pips_user_irrecoverable_error(...) \
139  pips_user_irrecoverable_error_func(CURRENT_FUNCTION, __FILE__, __LINE__, \
140  __VA_ARGS__)
141 
142 #define pips_internal_error(...) \
143  pips_internal_error_func(CURRENT_FUNCTION, __FILE__ , __LINE__, \
144  __VA_ARGS__)
145 
146 #define pips_log(...) \
147  pips_log_func(CURRENT_FUNCTION, __FILE__, __LINE__, __VA_ARGS__)
148 
149 #define pips_stop(...) \
150  pips_log_func(CURRENT_FUNCTION, __FILE__, __LINE__, __VA_ARGS__)
151 
152 #else // others, function name, file and line is lost
153 #define pips_debug pips_debug_func2
154 #define pips_user_warning pips_user_warning_func2
155 #define pips_user_error pips_user_error_func2
156 #define pips_user_irrecoverable_error pips_user_irrecoverable_error_func2
157 #define pips_internal_error pips_internal_error_func2
158 #define pips_log pips_log_func2
159 #define pips_stop pips_stop_func2
160 #endif
161 
162 #define pips_where(out) \
163  fprintf(out, "[%s] (%s:%d) ", CURRENT_FUNCTION, __FILE__, __LINE__)
164 
165 #define debug_on(env) \
166  debug_on_function(env, CURRENT_FUNCTION, __FILE__, __LINE__)
167 
168 #define debug_off() \
169  debug_off_function(CURRENT_FUNCTION, __FILE__, __LINE__)
170 
171 /* common macros, two flavors depending on NDEBUG */
172 #ifdef NDEBUG
173 
174 #define pips_assert(what, predicate)
175 #define pips_user_assert(what, predicate)
176 #define ifdebug(l) if(0)
177 
178 #else
179 
180 #define pips_assert(what, predicate) \
181  do { \
182  if (!(predicate)) { \
183  pips_internal_error("assertion failed\n\n '%s' not verified\n\n", \
184  what); \
185  abort(); \
186  } \
187  } while(0)
188 
189 #define pips_user_assert(what, predicate) \
190  do { \
191  if (!(predicate)) { \
192  pips_user_error("assertion failed\n\n '%s' not verified\n\n" \
193  "this is a USER ERROR, I guess\n", what); \
194  } \
195  } while(0)
196 
197 #define ifdebug(l) if (the_current_debug_level>=(l))
198 
199 #endif
200 
201 #define pips_exit(code, format, args...) \
202  pips_user_warning(format, ##args), exit(code)
203 
204 /* FI:need to breakpoint while inlining is available */
205 /* #define same_string_p(s1, s2) (strcmp((s1), (s2)) == 0)*/
206 #define same_string_p(s1, s2) function_same_string_p(s1,s2)
207 #define same_stringn_p(a,b,c) (!strncmp((a),(b),(c)))
208 
209 /* MAXPATHLEN is defined in <sys/param.h> for SunOS... but not for all OS! */
210 #ifndef MAXPATHLEN
211 #define MAXPATHLEN 1024
212 #endif
213 
214 #define PIPS_CATCH(what) \
215  if (push_debug_status(), \
216  setjmp(*push_exception_on_stack(what, __CURRENT_FUNCTION_NAME__, \
217  __FILE__, __LINE__, pop_debug_status)))
218 
219 /* SG moved there from transformation.h */
220 #define SIGN_EQ(a,b) ((((a)>0 && (b)>0) || ((a)<0 && (b)<0)) ? true : false)
221 #define FORTRAN_DIV(n,d) (SIGN_EQ((n),(d)) ? ABS(n)/ABS(d) : -(ABS(n)/ABS(d)))
222 #define C_DIVISION(n,d) ((n)/(d))
223 #define FORTRAN_MOD(n,m) (SIGN_EQ((n),(m)) ? ABS(n)%ABS(m) : -(ABS(n)%ABS(m)))
224 #define C_MODULO(n,m) ((n)%(m))
225 
226 // redundant declaration to ease bootstrapping
227 extern int the_current_debug_level;
228 
229 // a reset functions is just something to call...
230 typedef void (*reset_func_t)(void);
231 
232 // to avoid compiler warnings...
233 #define asprintf safe_asprintf
234 #define vasprintf safe_vasprintf
235 
236 #ifndef __has_attribute
237 #define __has_attribute(att) 0
238 #endif // !__has_attribute
239 
240 #define _UNUSED_ __attribute__((unused))
241 #define _NORETURN_ __attribute__((noreturn))
242 
243 #if __has_attribute(fallthrough)
244 #define _FALLTHROUGH_ __attribute__((fallthrough))
245 #else
246 #define _FALLTHROUGH_
247 #endif // fallthrough
248 
249 /* expecititely declare "noreturn" functions...
250  * because cproto generated headers seem to ignore attributes
251  */
252 void _NORETURN_ pips_stop_func(const char *, const char *, const int,
253  pips_log_t, int, const string, ...);
254 void _NORETURN_ pips_internal_error_func(const char *, const char *, const int,
255  const char *, ...);
256 void _NORETURN_ pips_user_error_func(const char *, const char *, const int,
257  const char *, ...);
259  const char *, const char *, const int, const char *, va_list *);
261  const char *, const char *, const int, const char *, ...);
262 
263 void _NORETURN_ pips_stop_func2(pips_log_t, int, const string, ...);
264 void _NORETURN_ pips_internal_error_func2(const char *, ...);
265 void _NORETURN_ pips_user_error_func2(const char *, ...);
266 void _NORETURN_ pips_user_irrecoverable_error_func2(const char *, ...);
267 
268 /***************************************************************** OLD STUFF */
269 
270 #define user_warning(fn, ...) \
271  pips_user_warning_func(fn, __FILE__, __LINE__, __VA_ARGS__)
272 
273 #define user_error(fn, ...) \
274  pips_user_error_func(fn, __FILE__, __LINE__, __VA_ARGS__)
275 /* cproto-generated files */
276 /* debug.c */
278 extern void set_debug_level(const int /*l*/);
279 extern int get_debug_level(void);
280 extern _int get_debug_stack_pointer(void);
281 extern void set_debug_stack_pointer(const int /*i*/);
282 extern void debug_on_function(const char */*env*/, const char */*function*/, const char */*file*/, const int /*line*/);
283 extern void debug_off_function(const char */*function*/, const char */*file*/, const int /*line*/);
284 extern void print_debug_stack(void);
285 extern void debug(const int /*the_expected_debug_level*/, const char */*calling_function_name*/, const char */*a_message_format*/, ...);
286 extern void pips_debug_function(const int /*the_expected_debug_level*/, const char */*a_message_format*/, ...);
287 extern double get_process_memory_size(void);
288 extern double get_process_gross_heap_size(void);
289 /* file.c */
290 extern FILE *check_fopen(const char */*file*/, const char */*mode*/);
291 extern FILE *safe_fopen(const char */*filename*/, const char */*what*/);
292 extern int safe_fclose(FILE */*stream*/, const char */*filename*/);
293 extern int safe_fflush(FILE */*stream*/, char */*filename*/);
294 extern FILE *safe_freopen(char */*filename*/, char */*what*/, FILE */*stream*/);
295 extern int safe_fseek(FILE */*stream*/, long int /*offset*/, int /*wherefrom*/, char */*filename*/);
296 extern long int safe_ftell(FILE */*stream*/, char */*filename*/);
297 extern void safe_rewind(FILE */*stream*/, char */*filename*/);
298 extern int safe_fgetc(FILE */*stream*/, char */*filename*/);
299 extern int safe_getc(FILE */*stream*/, char */*filename*/);
300 extern char *safe_fgets(char */*s*/, int /*n*/, FILE */*stream*/, char */*filename*/);
301 extern int safe_fputc(int /*c*/, FILE */*stream*/, char */*filename*/);
302 extern int safe_putc(int /*c*/, FILE */*stream*/, char */*filename*/);
303 extern int safe_fputs(char */*s*/, FILE */*stream*/, char */*filename*/);
304 extern int safe_fread(char */*ptr*/, int /*element_size*/, int /*count*/, FILE */*stream*/, char */*filename*/);
305 extern int safe_fwrite(char */*ptr*/, int /*element_size*/, int /*count*/, FILE */*stream*/, char */*filename*/);
306 extern int safe_list_files_in_directory(gen_array_t /*files*/, string /*dir*/, string /*re*/, bool (* /*file_name_predicate*/)(const char *));
307 extern void list_files_in_directory(gen_array_t /*files*/, string /*dir*/, string /*re*/, bool (* /*file_name_predicate*/)(const char *));
308 extern bool directory_exists_p(const char */*name*/);
309 extern bool file_exists_p(const char */*name*/);
310 extern char *strescape(const char */*source*/);
311 extern string nth_path(const char */*path_list*/, int /*n*/);
312 extern char *find_file_in_directories(const char */*file_name*/, const char */*dir_path*/);
313 extern bool file_readable_p(char */*name*/);
314 extern bool create_directory(char */*name*/);
315 extern bool purge_directory(char */*name*/);
316 extern char *get_cwd(void);
317 extern char *safe_readline(FILE */*file*/);
318 extern string safe_read_nth_line(string /*fn*/, int /*n*/);
319 extern string safe_get_line_interval(const string /*fn*/, int /*f*/, int /*l*/);
320 extern void safe_copy_line_interval(string /*fn*/, int /*f*/, int /*l*/, FILE */*out*/);
321 extern char *safe_readfile(FILE */*file*/);
322 extern void safe_cat(FILE */*out*/, FILE */*in*/);
323 extern void safe_append(FILE */*out*/, char */*file*/, int /*margin*/, bool /*but_comments*/);
324 extern void safe_copy(char */*source*/, char */*target*/);
325 extern int safe_display(char */*fname*/);
326 extern char *pips_filename(char */*fullpath*/, char */*suffix*/, bool /*short_p*/);
327 extern char *pips_basename(char */*fullpath*/, char */*suffix*/);
328 extern char *pips_initial_filename(char */*fullpath*/, char */*suffix*/);
329 extern char *pips_dirname(char */*fullpath*/);
330 extern void safe_unlink(const char */*file_name*/);
331 extern void safe_symlink(const char */*topath*/, const char */*frompath*/);
332 extern void safe_link(const char */*topath*/, const char */*frompath*/);
333 extern char *safe_system_output(char */*what*/);
334 extern char *safe_system_substitute(char */*what*/);
335 extern char *safe_new_tmp_file(char */*prefix*/);
336 extern FILE *fopen_config(const char */*canonical_name*/, const char */*cproperty*/, const char */*cenv*/);
337 /* message.c */
338 extern void set_pips_current_computation(const char */*rname*/, const char */*oname*/);
339 extern string get_pips_current_pass_name(void);
340 extern string get_pips_current_module(void);
341 extern void reset_pips_current_computation(void);
342 extern void set_pips_meta_informations(const char */*revs*/, const char */*date*/, const char */*comp*/);
343 extern string default_user_request(const char */*fmt*/, va_list */*args*/);
344 extern string (*pips_request_handler)(const char *, va_list *);
345 extern string user_request(const char */*a_message_format*/, ...);
346 extern void close_log_file(void);
347 extern void open_log_file(const string /*dir*/);
348 extern void log_on_file(const char */*desc*/);
349 extern void (*pips_log_handler)(const char *fmt, va_list *args);
350 extern void pips_user_log_func(const char */*format*/, ...);
351 extern void user_log(const char */*format*/, ...);
352 extern void pips_thanks(string /*name*/, string /*path*/);
353 extern void open_warning_file(const char */*dir*/);
354 extern void close_warning_file(void);
355 extern void append_to_warning_file(const char */*calling_function_name*/, const char */*format*/, va_list */*args*/);
356 extern void (*pips_warning_handler)(const char *, const char *, va_list *);
357 extern void pips_user_warning_alist(const char */*function_name*/, const char */*funcfile*/, const int /*funcline*/, const char */*format*/, va_list */*args*/);
358 extern void pips_user_warning_func(const char */*calling_function_name*/, const char */*funcfile*/, const int /*funcline*/, const char */*format*/, ...);
359 extern void pips_user_warning_func2(const char */*format*/, ...);
360 extern void pips_internal_error_func(const char */*funcname*/, const char */*funcfile*/, const int /*funcline*/, const char */*fmt*/, ...);
361 extern void pips_internal_error_func2(const char */*format*/, ...);
362 extern void (*pips_error_handler)(const char *, const char *, va_list *);
363 extern void pips_user_error_func(const char */*func_name*/, const char */*funcfile*/, const int /*funcline*/, const char */*format*/, ...);
364 extern void pips_user_error_func2(const char */*format*/, ...);
365 extern void (*pips_internal_error_handler)(const char *, const char *, ...);
366 extern void pips_user_irrecoverable_error_alist(const char */*func_name*/, const char */*funcfile*/, const int /*funcline*/, const char */*format*/, va_list */*args*/);
367 extern void pips_user_irrecoverable_error_func(const char */*func_name*/, const char */*funcfile*/, const int /*funcline*/, const char */*format*/, ...);
368 extern void pips_user_irrecoverable_error_func2(const char */*format*/, ...);
369 extern bool function_same_string_p(const char */*s1*/, const char */*s2*/);
370 extern void open_xml_logfile(const char */*filename*/);
371 extern void close_xml_logfile(void);
372 extern void pips_stop_func(const char */*pips_func*/, const char */*pips_file*/, const int /*pips_line*/, pips_log_t tag, int /*code*/, const string /*format*/, ...);
373 extern void pips_stop_func2(pips_log_t tag, int /*code*/, const string /*format*/, ...);
374 extern string pips_log_tag_name(pips_log_t tag);
375 extern void pips_log_desc(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 /*description*/);
376 extern 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*/);
377 extern void pips_log_func(const string /*pips_func*/, const string /*pips_file*/, const int /*pips_line*/, const pips_log_t tag, const string /*pips_pass*/, const string /*pips_owner*/, 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*/, ...);
378 extern void pips_log_stop(const char */*function*/, const char */*file*/, const int /*lineno*/, const pips_log_t tag, const int /*code*/, const string /*format*/, ...);
379 extern int safe_vasprintf(char **/*strp*/, const char */*fmt*/, va_list /*args*/);
380 extern int safe_asprintf(char **/*strp*/, const char */*fmt*/, ...);
381 /* dotting.c */
382 extern void start_dotting(FILE */*dotting_file*/, const char /*dotting_character*/, const char */*fmt*/, ...);
383 extern void stop_dotting(void);
384 /* args.c */
385 extern void list_to_array(list /*l*/, gen_array_t /*a*/);
386 extern void update_list_from_array(list /*l*/, gen_array_t /*a*/);
387 extern void sort_list_of_strings(list /*l*/);
388 extern string list_to_string(list /*l*/);
389 /* system.c */
390 extern void safe_system(string /*command*/);
391 extern int safe_system_no_abort(string /*command*/);
392 extern int safe_system_no_abort_no_warning(string /*command*/);
393 /* exception.c */
394 extern void push_pips_context(char const */*file*/, char const */*function*/, int /*line*/);
395 extern void pop_pips_context(char const */*file*/, char const */*function*/, int /*line*/);
396 /* perf_spy.c */
397 extern void push_performance_spy(void);
398 extern void pop_performance_spy(FILE */*f*/, string /*msg*/);
399 /* malloc_debug.c */
400 extern void pips_malloc_debug(void);
401 /* reset_hooks.c */
402 extern void reset_hooks_register(reset_func_t /*function*/);
403 extern void reset_hooks_call(void);
404 extern void reset_hooks_is_empty(void);
405 extern void reset_hooks_unregister(reset_func_t /*function*/);
406 #endif /* misc_header_included */
pips_log_t
Definition: misc-local.h:31
void set_pips_meta_informations(const char *, const char *, const char *)
Definition: message.c:102
void sort_list_of_strings(list)
Sort a list of strings.
Definition: args.c:59
void user_log(const char *,...)
Definition: message.c:234
void set_debug_stack_pointer(const int)
Definition: debug.c:97
long int safe_ftell(FILE *, char *)
Definition: file.c:123
double get_process_memory_size(void)
Definition: debug.c:244
void stop_dotting(void)
Definition: dotting.c:105
void pips_user_warning_func(const char *, const char *, const int, const char *,...)
Definition: message.c:346
void safe_cat(FILE *, FILE *)
Definition: file.c:669
FILE * safe_freopen(char *, char *, FILE *)
Definition: file.c:99
void print_debug_stack(void)
function used to debug (can be called from dbx) BB 6.12.91
Definition: debug.c:164
void pips_log_desc(const pips_log_t tag, const string, const string, const string, const string, const int, const string, const string, const int, const int, const string, const string, const string)
log entry with preprocessed format/arguments
Definition: message.c:1173
void push_pips_context(char const *, char const *, int)
exception.c
Definition: exception.c:43
void _NORETURN_ pips_internal_error_func2(const char *,...)
Definition: message.c:408
void _NORETURN_ pips_user_irrecoverable_error_func2(const char *,...)
Definition: message.c:550
void(* pips_internal_error_handler)(const char *, const char *,...)
PIPS_ERROR is a function that should be called to terminate PIPS execution when data structures are c...
Definition: message.c:511
void safe_symlink(const char *, const char *)
Definition: file.c:862
void pips_user_warning_alist(const char *, const char *, const int, const char *, va_list *)
Definition: message.c:328
void push_performance_spy(void)
perf_spy.c
Definition: perf_spy.c:89
int safe_fputc(int, FILE *, char *)
bool purge_directory(char *)
Definition: file.c:453
void close_log_file(void)
Definition: message.c:162
void pop_performance_spy(FILE *, string)
Definition: perf_spy.c:97
void update_list_from_array(list, gen_array_t)
Just modify the strings in a list from an array of strings.
Definition: args.c:49
void list_files_in_directory(gen_array_t, string, string, bool(*)(const char *))
The same as the previous safe_list_files_in_directory() but with no return code and a call to user er...
Definition: file.c:299
void(* reset_func_t)(void)
Definition: misc.h:230
void append_to_warning_file(const char *, const char *, va_list *)
To be used in error handling functions.
Definition: message.c:306
char * strescape(const char *)
protect a string, for example for use in a system call list of non escaped characters in the macro ab...
Definition: file.c:334
void _NORETURN_ pips_user_irrecoverable_error_alist(const char *, const char *, const int, const char *, va_list *)
Definition: message.c:516
void safe_system(string)
system.c
Definition: system.c:38
string list_to_string(list)
Return the malloc()ed version of the concatenation of all the strings in the list.
Definition: args.c:74
char * pips_initial_filename(char *, char *)
The source file name access path is shortened or not depending on the property.
Definition: file.c:829
void safe_rewind(FILE *, char *)
Definition: file.c:136
int safe_fwrite(char *, int, int, FILE *, char *)
Definition: file.c:227
int safe_getc(FILE *, char *)
Definition: file.c:158
void debug(const int, const char *, const char *,...)
ARARGS0.
Definition: debug.c:189
void pop_pips_context(char const *, char const *, int)
Definition: exception.c:50
char * pips_basename(char *, char *)
Definition: file.c:822
#define _NORETURN_
Definition: misc.h:241
string safe_read_nth_line(string, int)
Assumes "fn" is the name of a text file, opens it, and returns its nth line (starting with 1) in a ne...
Definition: file.c:523
int safe_fputs(char *, FILE *, char *)
Definition: file.c:203
measurement_type
Measurement type for mem_spy.c.
Definition: misc.h:65
@ SBRK_MEASURE
Definition: misc.h:65
@ GROSS_MEASURE
Definition: misc.h:65
@ NET_MEASURE
Definition: misc.h:65
char * get_cwd(void)
returns the current working directory name.
Definition: file.c:486
pips_log_t
Warning! Do not modify this file that is automatically generated!
Definition: misc.h:39
@ warning_log
Definition: misc.h:42
@ internal_error_log
Definition: misc.h:46
@ user_error_log
Definition: misc.h:45
@ spear_warning_log
Definition: misc.h:43
@ spear_error_log
Definition: misc.h:44
@ none_log
Definition: misc.h:40
@ info_log
Definition: misc.h:41
@ irrecoverable_error_log
Definition: misc.h:47
bool file_exists_p(const char *)
Definition: file.c:321
int get_debug_level(void)
GET_DEBUG_LEVEL returns the current debugging level.
Definition: debug.c:67
string nth_path(const char *, int)
Returns the allocated nth path from colon-separated path string.
Definition: file.c:362
void pips_log_func(const string, const string, const int, const pips_log_t tag, const string, const string, const string, const string, const int, const int, const string, const string, const string,...)
direct pips_log call with format and free arguments ("...")
Definition: message.c:1286
char * safe_system_output(char *)
attempt shell substitutions to what.
Definition: file.c:890
char * pips_filename(char *, char *, bool)
Some OS do not define basename and dirname.
Definition: file.c:775
void safe_copy(char *, char *)
Definition: file.c:706
char * safe_readline(FILE *)
returns the allocated line read, whatever its length.
Definition: file.c:497
int safe_fread(char *, int, int, FILE *, char *)
Definition: file.c:214
FILE * safe_fopen(const char *, const char *)
Definition: file.c:67
bool directory_exists_p(const char *)
Definition: file.c:314
void list_to_array(list, gen_array_t)
args.c
Definition: args.c:38
int safe_system_no_abort_no_warning(string)
the command to be executed
Definition: system.c:63
void debug_on_function(const char *, const char *, const char *, const int)
Definition: debug.c:112
bool function_same_string_p(const char *, const char *)
Definition: message.c:560
void _NORETURN_ pips_internal_error_func(const char *, const char *, const int, const char *,...)
Definition: message.c:394
bool file_readable_p(char *)
Definition: file.c:428
int safe_fgetc(FILE *, char *)
Definition: file.c:147
void safe_append(FILE *, char *, int, bool)
Definition: file.c:679
char * safe_system_substitute(char *)
returns what after variable, command and file substitutions.
Definition: file.c:919
void _NORETURN_ pips_user_error_func(const char *, const char *, const int, const char *,...)
Definition: message.c:478
void safe_link(const char *, const char *)
Create a hard link to topath.
Definition: file.c:878
void pips_thanks(string, string)
display pips thanks on startup, if it on a tty.
Definition: message.c:265
void safe_copy_line_interval(string, int, int, FILE *)
Assumes "fn" is the name of a text file, opens it, and copies the lines whose number belongs to [f....
Definition: file.c:601
string safe_get_line_interval(const string, int, int)
return lines f-l from file fn as a string
Definition: file.c:539
int safe_list_files_in_directory(gen_array_t, string, string, bool(*)(const char *))
returns a sorted arg list of files matching regular expression re in directory 'dir' and with file_na...
Definition: file.c:250
int safe_fflush(FILE *, char *)
Definition: file.c:90
void reset_hooks_is_empty(void)
check that the stack was cleaned.
Definition: reset_hooks.c:66
void open_warning_file(const char *)
Definition: message.c:286
void close_warning_file(void)
Definition: message.c:293
int safe_display(char *)
Display a file through $PIPS_MORE (or $PAGER) if stdout is a TTY, on stdout otherwise.
Definition: file.c:722
string user_request(const char *,...)
void open_log_file(const string)
Definition: message.c:171
int the_current_debug_level
cproto-generated files
Definition: misc.h:277
char * find_file_in_directories(const char *, const char *)
returns an allocated string pointing to the file, possibly with an additional path taken from colon-s...
Definition: file.c:399
string get_pips_current_pass_name(void)
Export this piece of information to customize warning functions in passes.
Definition: message.c:77
void reset_pips_current_computation(void)
Definition: message.c:87
char * safe_fgets(char *, int, FILE *, char *)
Definition: file.c:170
char * safe_new_tmp_file(char *)
SunOS forgets to declare this one.
Definition: file.c:935
void pips_debug_function(const int, const char *,...)
pips_debug is a nice macro that depends on gcc to generate the function name and to handle a variable...
Definition: debug.c:224
void(* pips_log_handler)(const char *fmt, va_list *args)
USER_LOG is a function that should be called to log the current PIPS request, as soon as it is releva...
Definition: message.c:216
string(* pips_request_handler)(const char *, va_list *)
default assignment of pips_request_handler is default_user_request.
Definition: message.c:139
void reset_hooks_unregister(reset_func_t)
remove registered cleanup hook.
Definition: reset_hooks.c:73
string pips_log_tag_name(pips_log_t tag)
Definition: message.c:938
void _NORETURN_ pips_user_error_func2(const char *,...)
Definition: message.c:492
FILE * check_fopen(const char *, const char *)
file.c
Definition: file.c:56
void start_dotting(FILE *, const char, const char *,...)
dotting.c
Definition: dotting.c:78
void(* pips_error_handler)(const char *, const char *, va_list *)
PROMPT_USER schould be implemented.
Definition: message.c:455
void safe_unlink(const char *)
Delete the given file.
Definition: file.c:852
bool create_directory(char *)
Definition: file.c:435
string get_pips_current_module(void)
Definition: message.c:82
char * pips_dirname(char *)
Definition: file.c:837
void pips_user_log_func(const char *,...)
Definition: message.c:225
string default_user_request(const char *, va_list *)
USER_REQUEST is a function that should be called to request some data from the user.
Definition: message.c:124
int safe_asprintf(char **, const char *,...)
Definition: message.c:1408
int safe_fclose(FILE *, const char *)
Definition: file.c:77
void reset_hooks_register(reset_func_t)
reset_hooks.c
Definition: reset_hooks.c:44
void _NORETURN_ pips_stop_func(const char *, const char *, const int, pips_log_t, int, const string,...)
expecititely declare "noreturn" functions...
Definition: message.c:904
double get_process_gross_heap_size(void)
Definition: debug.c:254
void log_on_file(const char *)
Definition: message.c:190
_int get_debug_stack_pointer(void)
The pair get_ and set_debug_stack_pointer() should never be used except to clean up the stack after a...
Definition: debug.c:92
void reset_hooks_call(void)
this function is expected to be called when catching an exception.
Definition: reset_hooks.c:53
int safe_fseek(FILE *, long int, int, char *)
Definition: file.c:112
void pips_malloc_debug(void)
malloc_debug.c
Definition: malloc_debug.c:34
void debug_off_function(const char *, const char *, const int)
Definition: debug.c:135
FILE * fopen_config(const char *, const char *, const char *)
Definition: file.c:952
void pips_log_stop(const char *, const char *, const int, const pips_log_t tag, const int, const string,...)
quick log and stop, called on timeout this must not invoke malloc as it may still held locks if inter...
Definition: message.c:1323
int safe_putc(int, FILE *, char *)
int safe_system_no_abort(string)
the command to be executed
Definition: system.c:47
void close_xml_logfile(void)
Definition: message.c:631
void open_xml_logfile(const char *)
Definition: message.c:607
char * safe_readfile(FILE *)
returns the file as an allocated string.
Definition: file.c:650
void set_pips_current_computation(const char *, const char *)
message.c
Definition: message.c:65
void pips_log_alist(const pips_log_t tag, const string, const string, const string, const string, const int, const string, const string, const int, const int, const string, const string, const string, va_list *)
log entry with unprocessed format/alist arguments
Definition: message.c:1200
void(* pips_warning_handler)(const char *, const char *, va_list *)
default assignment of pips_warning_handler is default_user_warning.
Definition: message.c:325
void set_debug_level(const int)
SET_DEBUG_LEVEL is a function that sets the current debuging level to the value passed as argument.
Definition: debug.c:60
void _NORETURN_ pips_stop_func2(pips_log_t, int, const string,...)
Definition: message.c:924
void _NORETURN_ pips_user_irrecoverable_error_func(const char *, const char *, const int, const char *,...)
Definition: message.c:535
int safe_vasprintf(char **, const char *, va_list)
Definition: message.c:1398
void pips_user_warning_func2(const char *,...)
fallback version without a calling function name
Definition: message.c:362
int tag
TAG.
Definition: newgen_types.h:92
char * string
STRING.
Definition: newgen_types.h:39
intptr_t _int
_INT
Definition: newgen_types.h:53
The structure used to build lists in NewGen.
Definition: newgen_list.h:41