openbcm

Git mirror of https://github.com/Broadcom-Network-Switching-Software/OpenBCM
git clone git://git.finwo.net/mirror/broadcom/openbcm
Log | Files | Refs | README

cint_error.h (1580B)


      1 /*
      2  * 
      3  * This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
      4  * 
      5  * Copyright 2007-2019 Broadcom Inc. All rights reserved.
      6  *
      7  * File:        cint_error.h
      8  * Purpose:     CINT error handling interfaces
      9  */
     10 
     11 #ifndef __CINT_ERROR_H__
     12 #define __CINT_ERROR_H__
     13 
     14 #include "cint_porting.h"
     15 #include "cint_ast.h"
     16 
     17 /*
     18  * Error Conditions
     19  */
     20 typedef enum cint_error_e {
     21     
     22     CINT_E_NONE =             0, 
     23     CINT_E_START =            -100,
     24 
     25 #define CINT_ERROR_LIST_ENTRY(_entry) CINT_E_##_entry , 
     26 #include "cint_error_entry.h"
     27 
     28     CINT_E_LAST
     29     
     30 } cint_error_t; 
     31     
     32 extern const char* cint_error_name(int err); 
     33 
     34 /* Global Error Conditions */
     35 extern volatile cint_error_t cint_errno;
     36 
     37 /*
     38  * Internal Interpreter Errors
     39  */
     40 extern void cint_internal_error(const char* f, int l, const char* fmt, ...)
     41      COMPILER_ATTRIBUTE((format (printf, 3, 4))); 
     42 
     43 /*
     44  * Execution errors and warnings
     45  */
     46 extern void cint_error(const char* f, int l, cint_error_t e, const char* fmt, ...)
     47      COMPILER_ATTRIBUTE((format (printf, 4, 5))); 
     48 extern void cint_warn(const char* f, int l, const char* fmt, ...)
     49      COMPILER_ATTRIBUTE((format (printf, 3, 4))); 
     50 
     51 extern int cint_ast_error(const cint_ast_t* ast, cint_error_t e, const char* fmt, ...)
     52      COMPILER_ATTRIBUTE((format (printf, 3, 4))); 
     53 extern int cint_ast_warn(const cint_ast_t* ast, const char* fmt, ...)
     54      COMPILER_ATTRIBUTE((format (printf, 2, 3))); 
     55 
     56 
     57 #define CINT_ERRNO_IS(_type) (cint_errno == CINT_E_##_type)
     58 
     59 
     60 #endif /* __CINT_ERROR_H__ */