[PATCH 0/2] make makedoc errors visible

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH 0/2] make makedoc errors visible

Jon TURNEY
Jon Turney (2):
  makedoc: make errors visible
  makedoc: exit with non-zero status on error

 newlib/Makefile.shared |  4 +--
 newlib/doc/doc.str     | 10 +++++---
 newlib/doc/makedoc.c   | 67 +++++++++-----------------------------------------
 3 files changed, 21 insertions(+), 60 deletions(-)

--
2.15.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 1/2] makedoc: make errors visible

Jon TURNEY
Discard QUICKREF sections, rather than writing them to stderr
Discard MATHREF sections, rather than discarding as an error
Pass NOTES sections through to texinfo, rather than discarding as an error
Don't redirect makedoc stderr
Remove makedoc output on error

For ease of reviewing, this patch doesn't contain Makefile.in regneration.

Signed-off-by: Jon Turney <[hidden email]>
---
 newlib/Makefile.shared |  4 ++--
 newlib/doc/doc.str     | 10 +++++++---
 newlib/doc/makedoc.c   | 47 -----------------------------------------------
 3 files changed, 9 insertions(+), 52 deletions(-)

diff --git a/newlib/Makefile.shared b/newlib/Makefile.shared
index c9ce5f468..7059ca7bf 100644
--- a/newlib/Makefile.shared
+++ b/newlib/Makefile.shared
@@ -14,8 +14,8 @@ SUFFIXES = .def .xml
 CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str
 
 .c.def:
- $(CHEW) < $< > $*.def 2> $*.ref
- touch stmp-def
+ $(CHEW) < $< > $*.def || ( rm $*.def && false )
+ @touch stmp-def
 
 TARGETDOC ?= ../tmp.texi
 
diff --git a/newlib/doc/doc.str b/newlib/doc/doc.str
index 3fc1006f8..949c6e794 100644
--- a/newlib/doc/doc.str
+++ b/newlib/doc/doc.str
@@ -17,9 +17,10 @@
 
 : QUICKREF
  skip_past_newline
- get_stuff_in_command
- "&&~&&~&&\cr\tablerule\n"
- quickref
+ ;
+
+: MATHREF
+ skip_past_newline
  ;
 
 : EXAMPLE
@@ -153,6 +154,9 @@
 : SEEALSO
  "@strong{See Also}@*\n" catstr subhead ;
 
+: NOTES
+ "@strong{Notes}@*\n" catstr subhead ;
+
 : INTERNAL_FUNCTION
  ;
 
diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c
index 96362f782..fdcc5b926 100644
--- a/newlib/doc/makedoc.c
+++ b/newlib/doc/makedoc.c
@@ -444,52 +444,6 @@ WORD(translatecomments)
     
 }
 
-/* find something like
-   QUICKREF
-     memchar ansi  pure
-
-     into
-     merge with words on tos and output them to stderror
-
-*/
-WORD(quickref)
-{
-  string_type *nos = tos-1;
-  unsigned int nosscan = 0;
-  unsigned int idx = 0;
-  
-  while (at(tos, idx))
-  {
-    if (at(tos,idx) == '~')
-    {
-      /* Skip the whitespace */
-      while (at(nos, nosscan) == ' ')
-       nosscan++;
-    
-      /* Sub the next word from the nos*/
-      while (at(nos, nosscan) != ' ' &&
-     at(nos, nosscan) != 0)
-      {
- fprintf(stderr, "%c", at(nos, nosscan));
- nosscan++;
-      }
-    }
-  
-    else
-    {
-      fprintf(stderr,"%c", at(tos, idx));
-    
-    }
-    idx++;
-  }
-
-  delete_string(tos);
-  delete_string(nos);
-  tos-=2;
-  pc++;
-  
-}
-
 #if 0
 /* turn everything not starting with a . into a comment */
 
@@ -1428,7 +1382,6 @@ char *av[])
     add_intrinsic("translatecomments", translatecomments );
     add_intrinsic("kill_bogus_lines", kill_bogus_lines);
     add_intrinsic("indent", indent);
-    add_intrinsic("quickref", quickref);
     add_intrinsic("internalmode", internalmode);
     
     /* Put a nl at the start */
--
2.15.1

Reply | Threaded
Open this post in threaded view
|

[PATCH 2/2] makedoc: exit with non-zero status on error

Jon TURNEY
In reply to this post by Jon TURNEY
Signed-off-by: Jon Turney <[hidden email]>
---
 newlib/doc/makedoc.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c
index fdcc5b926..45ddfb81e 100644
--- a/newlib/doc/makedoc.c
+++ b/newlib/doc/makedoc.c
@@ -1113,9 +1113,10 @@ DEFUN(lookup_word,(word),
     
 }
 
-static void DEFUN_VOID(perform)
+static int DEFUN_VOID(perform)
 {
     tos = stack;
+    int errors = 0;
     
     while (at(ptr, idx)) {
     /* It's worth looking through the command list */
@@ -1140,6 +1141,7 @@ static void DEFUN_VOID(perform)
  else
  {
     fprintf(stderr,"warning, %s is not recognised\n",  next);
+    errors++;
     skip_past_newline();
  }
 
@@ -1147,6 +1149,7 @@ static void DEFUN_VOID(perform)
     else skip_past_newline();
 
  }
+    return errors;
 }
 
 dict_type *
@@ -1220,6 +1223,8 @@ DEFUN(compile, (string),
     int  ret=0;
     /* add words to the dictionary */
     char *word;
+    dict_type *lookup;
+
     string = nextword(string, &word);
     while (string && *string && word[0])
     {
@@ -1275,7 +1280,9 @@ DEFUN(compile, (string),
      break;
    default:
      add_to_definition(ptr, call);
-     add_to_definition(ptr, lookup_word(word));
+     lookup = lookup_word(word);
+     if (!lookup) ret++;
+     add_to_definition(ptr, lookup);
  }
 
  string = nextword(string, &word);    
@@ -1349,7 +1356,7 @@ int ac AND
 char *av[])
 {
     unsigned int i;
-    
+    int status = 0;
 
     string_type buffer;
     string_type pptr;
@@ -1410,7 +1417,7 @@ char *av[])
   
  read_in(&b, f);
  if( compile(b.ptr) )  { fclose(f); exit(1); }
- perform();
+ status = perform();
  fclose(f);
     }
     else    if (av[i][1] == 'i')
@@ -1425,8 +1432,5 @@ char *av[])
 
     }      
     write_buffer(stack+0);
-    return 0;
+    return status;
 }
-
-
-
--
2.15.1

Reply | Threaded
Open this post in threaded view
|

Re: [PATCH 0/2] make makedoc errors visible

Corinna Vinschen
In reply to this post by Jon TURNEY
On Dec  5 12:47, Jon Turney wrote:

> Jon Turney (2):
>   makedoc: make errors visible
>   makedoc: exit with non-zero status on error
>
>  newlib/Makefile.shared |  4 +--
>  newlib/doc/doc.str     | 10 +++++---
>  newlib/doc/makedoc.c   | 67 +++++++++-----------------------------------------
>  3 files changed, 21 insertions(+), 60 deletions(-)
>
> --
> 2.15.1
ACK


Thanks,
Corinna

--
Corinna Vinschen
Cygwin Maintainer
Red Hat

signature.asc (836 bytes) Download Attachment