--- old/usr/src/tools/smatch/src/lib.h	Mon Nov 18 13:18:59 2019
+++ new/usr/src/tools/smatch/src/lib.h	Mon Nov 18 13:18:59 2019
@@ -1,6 +1,7 @@
 #ifndef LIB_H
 #define LIB_H
 
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stddef.h>
 
@@ -32,6 +33,8 @@
 
 #include "compat.h"
 #include "ptrlist.h"
+#include "utils.h"
+#include "bits.h"
 
 #define DO_STRINGIFY(x) #x
 #define STRINGIFY(x) DO_STRINGIFY(x)
@@ -40,12 +43,15 @@
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
 #endif
 
-extern int verbose, optimize, optimize_size, preprocessing;
+extern int verbose, optimize_level, optimize_size, preprocessing;
 extern int die_if_error;
 extern int parse_error;
-extern int repeat_phase, merge_phi_sources;
+extern int repeat_phase;
+extern int do_output;
 extern int gcc_major, gcc_minor, gcc_patchlevel;
 
+extern const char *base_filename;
+
 extern unsigned int hexval(unsigned int c);
 
 struct position {
@@ -83,6 +89,8 @@
 
 struct token *skip_to(struct token *, int);
 struct token *expect(struct token *, int, const char *);
+void unexpected(struct token *, const char *errmsg);
+
 #ifdef __GNUC__
 #define FORMAT_ATTR(pos) __attribute__ ((__format__ (__printf__, pos, pos+1)))
 #define NORETURN_ATTR __attribute__ ((__noreturn__))
@@ -108,7 +116,24 @@
 #define	ERROR_PREV_PHASE	(1 << 1)
 extern int has_error;
 
+
+enum phase {
+	PASS__PARSE,
+	PASS__LINEARIZE,
+	PASS__MEM2REG,
+	PASS__OPTIM,
+	PASS__FINAL,
+};
+
+#define	PASS_PARSE		(1UL << PASS__PARSE)
+#define	PASS_LINEARIZE		(1UL << PASS__LINEARIZE)
+#define	PASS_MEM2REG		(1UL << PASS__MEM2REG)
+#define	PASS_OPTIM		(1UL << PASS__OPTIM)
+#define	PASS_FINAL		(1UL << PASS__FINAL)
+
+
 extern void add_pre_buffer(const char *fmt, ...) FORMAT_ATTR(1);
+extern void predefine(const char *name, int weak, const char *fmt, ...) FORMAT_ATTR(3);
 
 extern int preprocess_only;
 
@@ -115,6 +140,8 @@
 extern int Waddress;
 extern int Waddress_space;
 extern int Wbitwise;
+extern int Wbitwise_pointer;
+extern int Wcast_from_as;
 extern int Wcast_to_as;
 extern int Wcast_truncate;
 extern int Wconstant_suffix;
@@ -130,6 +157,7 @@
 extern int Wsparse_error;
 extern int Wimplicit_int;
 extern int Winit_cstring;
+extern int Wint_to_pointer_cast;
 extern int Wmemcpy_max_count;
 extern int Wnon_pointer_null;
 extern int Wold_initializer;
@@ -140,9 +168,12 @@
 extern int Woverride_init_whole_range;
 extern int Wparen_string;
 extern int Wpointer_arith;
+extern int Wpointer_to_int_cast;
 extern int Wptr_subtraction_blows;
 extern int Wreturn_void;
 extern int Wshadow;
+extern int Wshift_count_negative;
+extern int Wshift_count_overflow;
 extern int Wsizeof_bool;
 extern int Wstrict_prototypes;
 extern int Wtautological_compare;
@@ -154,20 +185,27 @@
 extern int Wvla;
 
 extern int dump_macro_defs;
+extern int dump_macros_only;
 
-extern int dbg_entry;
+extern int dbg_compound;
 extern int dbg_dead;
+extern int dbg_domtree;
+extern int dbg_entry;
+extern int dbg_ir;
+extern int dbg_postorder;
 
+extern unsigned int fmax_warnings;
 extern int fmem_report;
-extern int fdump_linearize;
+extern unsigned long fdump_ir;
 extern unsigned long long fmemcpy_max_count;
+extern unsigned long fpasses;
+extern int funsigned_char;
 
 extern int arch_m64;
 extern int arch_msize_long;
 extern int arch_big_endian;
+extern int arch_mach;
 
-extern void declare_builtin_functions(void);
-extern void create_builtin_stream(void);
 extern void dump_macro_definitions(void);
 extern struct symbol_list *sparse_initialize(int argc, char **argv, struct string_list **files);
 extern struct symbol_list *__sparse(char *filename);
@@ -207,7 +245,7 @@
 
 static inline void free_instruction_list(struct instruction_list **head)
 {
-	free_ptr_list((struct ptr_list **)head);
+	free_ptr_list(head);
 }
 
 static inline struct instruction * delete_last_instruction(struct instruction_list **head)
@@ -215,11 +253,6 @@
 	return undo_ptr_list_last((struct ptr_list **)head);
 }
 
-static inline struct basic_block * delete_last_basic_block(struct basic_block_list **head)
-{
-	return delete_ptr_list_last((struct ptr_list **)head);
-}
-
 static inline struct basic_block *first_basic_block(struct basic_block_list *head)
 {
 	return first_ptr_list((struct ptr_list *)head);
