diff options
author | Nguyễn Gia Phong <cnx@loang.net> | 2024-01-25 15:22:01 +0900 |
---|---|---|
committer | Nguyễn Gia Phong <cnx@loang.net> | 2024-01-25 15:22:01 +0900 |
commit | aef964cf547e4085f86b1e286f9d69a72032a78a (patch) | |
tree | 128813f588ed7967a3f919c13c5e26f01fd5ba36 | |
parent | d7e58053447c41178e17118151e300b66743ede6 (diff) | |
download | bux-psychic.tar.gz |
Adapt to psychic's new meta utils psychic
-rw-r--r-- | grep/8f08d8e2.meta.patch | 120 |
1 files changed, 35 insertions, 85 deletions
diff --git a/grep/8f08d8e2.meta.patch b/grep/8f08d8e2.meta.patch index 91eabd8..44c4ad2 100644 --- a/grep/8f08d8e2.meta.patch +++ b/grep/8f08d8e2.meta.patch @@ -1,22 +1,8 @@ -diff --git a/NEWS b/NEWS -index ba021869b184..a9acb822e95d 100644 ---- a/NEWS -+++ b/NEWS -@@ -10,6 +10,9 @@ GNU grep NEWS -*- outline -*- - Character ranges would not work in single-byte character sets other - than C (for example, ISO-8859-1 or KOI8-R). [bug introduced in 2.6] - -+ The output of grep was incorrect for whole-word (-w) matches if the -+ patterns included a backreference. -+ - ** Portability - - Avoid a link failure on Solaris 8. diff --git a/src/dfasearch.c b/src/dfasearch.c -index a43f822aafa0..2dbe6b11bcc4 100644 +index a43f822aafa0..36db6965b0c3 100644 --- a/src/dfasearch.c +++ b/src/dfasearch.c -@@ -18,6 +18,57 @@ +@@ -18,6 +18,46 @@ /* Written August 1992 by Mike Haertel. */ @@ -24,93 +10,57 @@ index a43f822aafa0..2dbe6b11bcc4 100644 +#include <stdint.h> +#include <stdlib.h> + ++void klee_make_symbolic(void *addr, size_t nbytes, const char *name) {} +void klee_assume(uintptr_t x) {} -+void klee_mark_patch(uint64_t patch_num) {} -+ -+bool __klee_runtime = true; -+void -+klee_make_symbolic(void *addr, size_t nbytes, const char *name) -+{ -+ __klee_runtime = false; -+} -+ -+int -+__choose(const char *switch_id) ++int __choose(const char *switch_id) +{ -+ char *env = getenv(switch_id); -+ if (env == NULL) -+ return 0; -+ int result=atoi(env); -+ return result; ++ char *env = getenv("KLEE_META"); ++ if (env == NULL) ++ return 0; ++ int result=atoi(env); ++ return result; +} + +#define MAX_NAME_LENGTH 1000 -+#define SYMBOLIC_OUTPUT_PROTO(type, typestr) \ -+type \ -+angelix_symbolic_output_##type(type expr, char* id) \ -+{ \ -+ if (!__klee_runtime) \ -+ return expr; \ -+ static int instance = 0; \ -+ char name[MAX_NAME_LENGTH]; \ -+ sprintf(name, "out!%s!%d", id, instance++); \ -+ type s; \ -+ klee_make_symbolic(&s, sizeof(s), name); \ -+ klee_assume(s == expr); \ -+ return s; \ ++#define SYMBOLIC_OUTPUT_PROTO(type) \ ++ type __klee_symbolic_output_##type(type expr, char* id) { \ ++ static int instance = 0; \ ++ char name[MAX_NAME_LENGTH]; \ ++ sprintf(name, "out!%s!%d", id, instance++); \ ++ type s; \ ++ klee_make_symbolic(&s, sizeof(s), name); \ ++ klee_assume(s == expr); \ ++ return expr; \ +} -+SYMBOLIC_OUTPUT_PROTO(int, "int") -+SYMBOLIC_OUTPUT_PROTO(long, "long") -+SYMBOLIC_OUTPUT_PROTO(size_t, "size_t") -+SYMBOLIC_OUTPUT_PROTO(bool, "bool") -+SYMBOLIC_OUTPUT_PROTO(char, "char") ++SYMBOLIC_OUTPUT_PROTO(int) ++SYMBOLIC_OUTPUT_PROTO(long) ++SYMBOLIC_OUTPUT_PROTO(bool) ++SYMBOLIC_OUTPUT_PROTO(char) +#undef SYMBOLIC_OUTPUT_PROTO + -+#define ANGELIX_OUTPUT(type, expr, name) \ -+ angelix_symbolic_output_##type((expr), (name)) -+ -+#define __COMPILE_40 ++#ifdef KLEE_RUNTIME ++#define KLEE_OUTPUT(type, expr, name) \ ++ __klee_symbolic_output_##type((expr), (name)) ++int printf (const char *__restrict __format, ...) { return 0; } ++#else ++#define KLEE_OUTPUT(type, expr, name) (expr) ++#endif + #include <config.h> #include "search.h" #include "dfa.h" -@@ -357,8 +408,20 @@ EGexecute (char const *buf, size_t size, size_t *match_size, +@@ -357,8 +397,14 @@ EGexecute (char const *buf, size_t size, size_t *match_size, { /* Good enough for a non-exact match. No need to look at further patterns, if any. */ -+char __choose2 = __choose("__SWITCH2"); -+klee_make_symbolic(&__choose2, sizeof(__choose2), "__choose2"); -+if (__choose2 == 0) -+ { ++int __choose0 = __choose("__SWITCH0"); ++klee_make_symbolic(&__choose0, sizeof(__choose0), "__choose0"); ++if (__choose0 == 0) { beg = match; goto success_in_len; -+ } -+#ifdef __COMPILE_40 -+else if (__choose2 == 3) -+ { -+ klee_mark_patch(40); ++} else if (__choose0 == 1) { + goto success; -+ } -+#endif ++} } if (match < best_match || (match == best_match && len > best_len)) { -@@ -388,5 +451,6 @@ EGexecute (char const *buf, size_t size, size_t *match_size, - *match_size = len; - ret_val = beg - buf; - out: -+ ANGELIX_OUTPUT(size_t, *match_size, "match_size"); - return ret_val; - } -diff --git a/tests/Makefile.am b/tests/Makefile.am -index 02db64c44ab3..59ed67223445 100644 ---- a/tests/Makefile.am -+++ b/tests/Makefile.am -@@ -16,6 +16,7 @@ - - TESTS = \ - backref.sh \ -+ backref-word \ - bre.sh \ - case-fold-backref \ - case-fold-backslash-w \ |