This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 3/3] makedoc: Don't interpret license text as a command


Align makedoc's iscommand() with it's documentation, and don't allow commands to
contain a space.  A command is a line containing only a sequence of capital
letters or '_', followed by optional spaces.

This prevents "IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE" (the only line in the license text which consists of only
capitals and spaces, without any punctuation) from being interepreted as a
makedoc command, leading to:

"Can't find IMPLIED"
"warning, IMPLIED is not recognised"

being emitted by makedoc, (which is normally un-noticed because makedoc's stderr
is redirected to a .ref file)

2015-11-06  Jon Turney  <jon.turney@dronecode.org.uk>

	* doc/makedoc.c (iscommand): Only allow commands to have trailing
	spaces, not space separated words.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
 newlib/ChangeLog     |  5 +++++
 newlib/doc/makedoc.c | 19 +++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/newlib/ChangeLog b/newlib/ChangeLog
index 5934f06..4704f7e 100644
--- a/newlib/ChangeLog
+++ b/newlib/ChangeLog
@@ -1,5 +1,10 @@
 2015-11-06  Jon Turney  <jon.turney@dronecode.org.uk>
 
+	* doc/makedoc.c (iscommand): Only allow commands to have trailing
+	spaces, not space separated words.
+
+2015-11-06  Jon Turney  <jon.turney@dronecode.org.uk>
+
 	* libm/mathfp/s_acos.c: Fix QUICKREF.
 	* libm/mathfp/e_acosh.c: Ditto.
 	* libm/math/w_asin.c: Ditto.
diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c
index 7188642..96362f7 100644
--- a/newlib/doc/makedoc.c
+++ b/newlib/doc/makedoc.c
@@ -777,14 +777,18 @@ DEFUN( iscommand,(ptr, idx),
       unsigned int idx)
 {
     unsigned int len = 0;
-    while (at(ptr,idx)) {
-	    if (isupper(at(ptr,idx)) || at(ptr,idx) == ' ' ||
-		at(ptr,idx) == '_') 
-	    {
+
+    while (isupper(at(ptr,idx)) || at(ptr,idx) == '_') {
 	     len++;
 	     idx++;
-	 }
-	    else if(at(ptr,idx) == '\n')
+    }
+
+    while (at(ptr,idx) == ' ') {
+	     len++;
+	     idx++;
+    }
+
+    if(at(ptr,idx) == '\n')
 	    {
 		/* The length check will never fail on a real command
 		 * because the commands are screened as the definitions file
@@ -792,8 +796,7 @@ DEFUN( iscommand,(ptr, idx),
 		if (len >= MIN_CMDLEN) return 1;
 		return 0;
 	    }
-	    else return 0;
-	}
+
     return 0;
 
 }
-- 
2.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]