Blob Blame History Raw
--- xen-4.18.0/stubdom/newlib-makedoc.patch.orig	2023-11-16 21:44:21.000000000 +0000
+++ xen-4.18.0/stubdom/newlib-makedoc.patch	2024-02-01 20:32:40.565785056 +0000
@@ -33,3 +33,385 @@
  #include <ctype.h>
  
  #define DEF_SIZE 5000
+---
+
+patch makedoc.c for gcc14 build
+
+--- newlib-1.16.0/newlib/doc/makedoc.c.orig	2007-01-02 16:59:59.000000000 +0000
++++ newlib-1.16.0/newlib/doc/makedoc.c	2024-02-01 20:26:32.415396758 +0000
+@@ -63,25 +63,20 @@
+ 
+ 
+ 
+-static void DEFUN(init_string_with_size,(buffer, size),
+-	   string_type *buffer AND
+-	   unsigned int size )
++static void init_string_with_size (string_type *buffer, unsigned int size)
+ {
+   buffer->write_idx = 0;
+   buffer->size = size;
+   buffer->ptr = malloc(size);
+ }
+ 
+-static void DEFUN(init_string,(buffer),
+-	   string_type *buffer)
++static void init_string (string_type *buffer)
+ {
+     init_string_with_size(buffer, DEF_SIZE);
+ 
+ }
+ 
+-static int DEFUN(find, (str, what),
+-	  string_type *str AND
+-	  char *what)
++static int find (string_type *str, char *what)
+ {
+     unsigned int i;
+     char *p;
+@@ -97,30 +92,24 @@
+     
+ }
+ 
+-static void DEFUN(write_buffer,(buffer),
+-	   string_type *buffer)
++static void write_buffer (string_type *buffer)
+ {
+     fwrite(buffer->ptr, buffer->write_idx, 1, stdout);
+ }
+ 
+ 
+-static void DEFUN(delete_string,(buffer),
+-	   string_type *buffer)
++static void delete_string (string_type *buffer)
+ {
+     free(buffer->ptr);
+ }
+ 
+ 
+-static char *DEFUN(addr, (buffer, idx),
+-	    string_type *buffer AND
+-	    unsigned int idx)
++static char * addr (string_type *buffer, unsigned int idx)
+ {
+     return buffer->ptr + idx;
+ }
+ 
+-static char DEFUN(at,(buffer, pos),
+-	   string_type *buffer AND
+-	   unsigned int pos) 
++static char at (string_type *buffer, unsigned int pos) 
+ {
+     if ( pos >= buffer->write_idx) 
+     {
+@@ -129,9 +118,7 @@
+     return buffer->ptr[pos];
+ }
+ 
+-static void DEFUN(catchar,(buffer, ch), 
+-	   string_type *buffer AND
+-	   char ch)
++static void catchar (string_type *buffer, char ch)
+ {
+   if (buffer->write_idx == buffer->size) 
+   {
+@@ -143,9 +130,7 @@
+ }
+ 
+ 
+-static void DEFUN(overwrite_string,(dst,   src),
+-	   string_type *dst AND
+-	   string_type *src)
++static void overwrite_string (string_type *dst, string_type *src)
+ {
+     free(dst->ptr);
+     dst->size = src->size;
+@@ -153,9 +138,7 @@
+     dst->ptr = src->ptr;
+ }
+ 
+-static void DEFUN(catstr,(dst, src),
+-	   string_type *dst AND
+-	   string_type *src)
++static void catstr ( string_type *dst, string_type *src)
+ {
+     unsigned int i;
+     for (i = 0; i < src->write_idx; i++) 
+@@ -165,9 +148,7 @@
+ }
+ 
+ 
+-static void DEFUN(cattext,(buffer, string),
+-	   string_type *buffer AND
+-	   char *string)
++static void cattext (string_type *buffer, char *string)
+ {
+     
+     while (*string) 
+@@ -177,10 +158,7 @@
+     }
+ }
+ 
+-static void DEFUN(catbuf,(buffer, buf, len),
+-	   string_type *buffer AND
+-	   char *buf AND
+-	   unsigned int len)
++static void catbuf ( string_type *buffer, char *buf, unsigned int len)
+ {
+     
+     while (len--) 
+@@ -192,10 +170,7 @@
+ 
+ 
+ 
+-static unsigned int 
+-DEFUN(skip_white_and_stars,(src, idx),
+-      string_type *src AND
+-      unsigned int idx)
++static unsigned int skip_white_and_stars (string_type *src, unsigned int idx)
+ {
+     while (isspace(at(src,idx)) 
+ 	   || (at(src,idx) == '*' && at(src,idx +1) !='/')) 
+@@ -216,10 +191,23 @@
+ stinst_type *pc;
+ stinst_type sstack[STACK];
+ stinst_type *ssp = &sstack[0];
+-int istack[STACK];
+-int *isp = &istack[0];
+ 
+-typedef int *word_type;
++#if defined(__PTRDIFF_TYPE__)
++typedef signed __PTRDIFF_TYPE__ intptr_t;
++typedef unsigned __PTRDIFF_TYPE__ uintptr_t;
++#else
++/*
++ * Fallback to hardcoded values,
++ * should be valid on cpu's with 32bit int/32bit void*
++ */
++typedef signed long intptr_t;
++typedef unsigned long uintptr_t;
++#endif
++
++uintptr_t istack[STACK];
++uintptr_t *isp = &istack[0];
++
++typedef uintptr_t *word_type;
+ 
+ 
+ 
+@@ -236,8 +224,7 @@
+ typedef struct dict_struct dict_type;
+ #define WORD(x) static void x()
+ 
+-static void DEFUN(exec,(word),
+-		  dict_type *word)
++static void exec (dict_type *word)
+ {
+     pc = word->code;
+     while (*pc) 
+@@ -267,7 +254,7 @@
+ {
+     isp++;
+     pc++;
+-    *isp = (int)(*pc);
++    *isp = (uintptr_t)(*pc);
+     pc++;
+     
+ }
+@@ -294,10 +281,7 @@
+    Blank lines are turned into one blank line
+  */
+ 
+-static void 
+-DEFUN(remove_noncomments,(src,dst),
+-	   string_type *src AND
+-	   string_type *dst)
++static void remove_noncomments (string_type *src, string_type *dst)
+ {
+     unsigned int idx = 0;
+     
+@@ -349,8 +333,7 @@
+ 
+  */
+ 
+-static void
+-DEFUN_VOID(exfunstuff)
++static void exfunstuff (void)
+ {
+     unsigned int openp;
+     unsigned int fname;
+@@ -522,8 +505,7 @@
+ }
+ 
+ /* Mod tos so that only lines with leading dots remain */
+-static void
+-DEFUN_VOID(outputdots)
++static void (outputdots (void))
+ {
+     unsigned int idx = 0;
+     string_type out;
+@@ -772,10 +754,7 @@
+     
+ }
+ /* A command is all upper case,and alone on a line */
+-static int 
+-DEFUN( iscommand,(ptr, idx),
+-      string_type *ptr AND
+-      unsigned int idx)
++static int iscommand (string_type *ptr, unsigned int idx)
+ {
+     unsigned int len = 0;
+     while (at(ptr,idx)) {
+@@ -797,10 +776,7 @@
+ }
+ 
+ 
+-DEFUN(copy_past_newline,(ptr, idx, dst),
+-      string_type *ptr AND
+-      unsigned int idx AND
+-      string_type *dst)
++unsigned int copy_past_newline (string_type *ptr, unsigned int idx, string_type *dst)
+ {
+     while (at(ptr, idx) && at(ptr, idx) != '\n') 
+     {
+@@ -1060,10 +1036,7 @@
+     
+ }
+ 
+-char *
+-DEFUN(nextword,(string, word),
+-      char *string AND
+-      char **word)
++char * nextword (char *string, char **word)
+ {
+   char *word_start;
+   int idx;
+@@ -1138,9 +1111,7 @@
+     
+ }
+ dict_type *root;
+-dict_type *
+-DEFUN(lookup_word,(word),
+-      char *word)
++dict_type * lookup_word (char *word)
+ {
+     dict_type *ptr = root;
+     while (ptr) {
+@@ -1154,7 +1125,7 @@
+     
+ }
+ 
+-static void DEFUN_VOID(perform)
++static int perform (void)
+ {
+     tos = stack;
+     
+@@ -1192,9 +1163,7 @@
+ 	}
+ }
+ 
+-dict_type *
+-DEFUN(newentry,(word),
+-      char *word)
++dict_type * newentry (char *word)
+ {
+     dict_type *new = (dict_type *)malloc(sizeof(dict_type));
+     new->word = word;
+@@ -1208,10 +1177,7 @@
+ }
+ 
+ 
+-unsigned int
+-DEFUN(add_to_definition,(entry, word), 
+-      dict_type *entry AND
+-      stinst_type word)
++unsigned int add_to_definition (dict_type *entry, stinst_type word)
+ {
+     if (entry->code_end == entry->code_length) 
+     {
+@@ -1232,9 +1198,7 @@
+ 
+ 
+ void
+-DEFUN(add_intrinsic,(name, func),
+-      char *name AND
+-      void (*func)())
++add_intrinsic (char *name, void (*func)(void))
+ {
+     dict_type *new = newentry(name);
+     add_to_definition(new, func);
+@@ -1247,9 +1211,7 @@
+ 
+ }
+ 
+-void
+-DEFUN(add_var,(name),
+-      char *name)
++void add_var (char *name)
+ {
+     dict_type *new = newentry(name);
+     add_to_definition(new, push_number);
+@@ -1262,8 +1224,7 @@
+ 
+ 
+ void 
+-DEFUN(compile, (string), 
+-      char *string)
++compile (char *string)
+ 
+ {
+     int jstack[STACK];
+@@ -1315,11 +1276,11 @@
+ 		     /* Got a number, embedd the magic push number
+ 			function */
+ 		     add_to_definition(ptr, push_number);
+-		     add_to_definition(ptr, atol(word));
++		     add_to_definition(ptr, (stinst_type)atol(word));
+ 		     break;
+ 		   default:
+ 		     add_to_definition(ptr, call);
+-		     add_to_definition(ptr, lookup_word(word));
++                     add_to_definition(ptr, (stinst_type)lookup_word(word));
+ 		 }
+ 
+ 		string = nextword(string, &word);		     
+@@ -1336,9 +1297,9 @@
+ }
+ 
+  
+-static void DEFUN_VOID(bang)
++static void bang (void)
+ {
+-*(int *)((isp[0])) = isp[-1];
++*(uintptr_t *)((isp[0])) = isp[-1];
+ isp-=2;
+ pc++;
+ 
+@@ -1359,9 +1320,7 @@
+ 
+ 
+ 
+-static void DEFUN(read_in, (str, file), 
+-	   string_type *str AND
+-		  FILE *file)
++static void read_in (string_type *str, FILE *file)
+ {
+     char buff[10000];    
+     unsigned int r;
+@@ -1378,15 +1337,13 @@
+ }
+ 
+ 
+-static void DEFUN_VOID(usage)
++static void usage (void)
+ {
+     fprintf(stderr,"usage: -[d|i|g] <file >file\n");
+     exit(33);    
+ }
+ 
+-int DEFUN(main,(ac,av),
+-int ac AND
+-char *av[])
++int main (int ac, char *av[])
+ {
+     unsigned int i;
+