summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2008-03-11 21:50:47 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2008-03-11 21:50:47 (GMT)
commiteb45846b46b9f702d6a97b60f2d79c44bfe8c9da (patch) (side-by-side diff)
tree745407914177dcde05eaace53c427bbc71283b38
parent5d124d1e813155c931b6476a261514fd54b7bc30 (diff)
downloadmailfromd-eb45846b46b9f702d6a97b60f2d79c44bfe8c9da.tar.gz
mailfromd-eb45846b46b9f702d6a97b60f2d79c44bfe8c9da.tar.bz2
Fix handling of handler/handler name clashes.
* mfd/drivers.c (code_type_progdecl): Warn if a header is redeclared. * doc/mailfromd.texi: Document resolving of handler/handler name clashes. git-svn-id: file:///svnroot/mailfromd/trunk@1641 7a8a7f39-df28-0410-adc6-e0d955640f24
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--ChangeLog11
-rw-r--r--doc/mailfromd.texi13
-rw-r--r--mfd/drivers.c10
3 files changed, 29 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 11588d5..fdc1f0b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-11 Sergey Poznyakoff <gray@gnu.org.ua>
+
+ Fix handling of handler/handler name clashes.
+
+ * mfd/drivers.c (code_type_progdecl): Warn if a header is
+ redeclared.
+ * doc/mailfromd.texi: Document resolving of handler/handler name
+ clashes.
+
2008-03-10 Sergey Poznyakoff <gray@gnu.org.ua>
* mflib/strip_domain_part.mf, mflib/heloarg_test.mf,
@@ -13,7 +22,7 @@
* configure.ac, NEWS: Version 4.4
* mfd/mailfromd.h (enum mf_status_code): Add a comma and a count
- definition, needed for make check-exceptions in docs.
+ definition, needed for `make check-exceptions' in docs.
* mfd/status.mfi (m4_ifdef): Use OLD_EXCEPTION_CODES instead of
COMPAT_4_3.
* mfd/main.c: New command line options: -D (--define), and -U
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi
index 387308e..85c65f0 100644
--- a/doc/mailfromd.texi
+++ b/doc/mailfromd.texi
@@ -8800,9 +8800,16 @@ done
@end smallexample
@item handler -- handler
-As of version @value{VERSION}, multiple definitions of a handler are
-compiled without warnings. However, only the last definition is used.
-This may change in future releases.
+If two handlers with the same name are defined, the definition that
+appears further in the source text replaces the previous one. A
+warning message is issued, indicating locations of both definitions,
+e.g.:
+
+@smallexample
+mailfromd: sample.rc:116: Warning: Redefinition of handler `envfrom'
+mailfromd: sample.rc:34: Warning: This is the location of the
+previous definition
+@end smallexample
@item variable -- variable
@cindex variable shadowing
diff --git a/mfd/drivers.c b/mfd/drivers.c
index 44067c4..72c3b89 100644
--- a/mfd/drivers.c
+++ b/mfd/drivers.c
@@ -2238,8 +2238,16 @@ code_type_progdecl(NODE *node, struct locus **old_locus)
enum smtp_state tag;
tag = node->v.progdecl.tag;
+
+ if (root_node[tag]) {
+ parse_warning_locus(&node->locus,
+ _("Redefinition of handler `%s'"),
+ state_to_string(tag));
+ parse_warning_locus(&root_node[tag]->locus,
+ _("This is the location of the previous definition"));
+ }
+
root_node[tag] = node->v.progdecl.tree;
-
if (codegen(&entry_point[tag],
node->v.progdecl.tree, 1,
node->v.progdecl.auto_count) == 0)

Return to:

Send suggestions and report system problems to the System administrator.