summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2014-11-06 16:28:31 -0600
committerJim Meyering <meyering@fb.com>2014-11-30 18:59:35 -0800
commit3e28ea356afdc7b265d07de03d47c929b3bf9bc6 (patch)
tree16951ea66fba1b43eb71ae11cdc9a99e53e5c4f3
parent4916618496e73bc6aca4104e3f19e5c79a9412fc (diff)
downloadsed-3e28ea356afdc7b265d07de03d47c929b3bf9bc6.tar.gz
maint: avoid false-positive used-uninit. warning from gcc
* sed/sed.h (IF_LINT): Define. * sed/compile.c (snarf_char_class) [lint]: Use it to initialize DELIM, so that gcc doesn't report it is used uninitialized.
-rw-r--r--sed/compile.c2
-rw-r--r--sed/sed.h7
2 files changed, 8 insertions, 1 deletions
diff --git a/sed/compile.c b/sed/compile.c
index 77aec27..b94b199 100644
--- a/sed/compile.c
+++ b/sed/compile.c
@@ -439,7 +439,7 @@ snarf_char_class(b, cur_stat)
{
int ch;
int state = 0;
- int delim;
+ int delim IF_LINT ( = 0) ;
bool pending_mb = 0;
ch = inchar();
diff --git a/sed/sed.h b/sed/sed.h
index 1ca489f..5f947e9 100644
--- a/sed/sed.h
+++ b/sed/sed.h
@@ -262,3 +262,10 @@ extern bool is_utf8;
extern int brlen (int ch, mbstate_t *ps);
extern void initialize_mbcs (void);
+
+/* Use this to suppress gcc's '...may be used before initialized' warnings. */
+#ifdef lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif