]> git.draconx.ca Git - cdecl99.git/blobdiff - src/explain.c
Minor portability improvements.
[cdecl99.git] / src / explain.c
index 41d4f7be744c4ce23de7adbbe6ed9a6d9dc33b62..0d9c95740ca03ece599a610c881db74ccdcc540e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Render C declarations as English.
- *  Copyright © 2011 Nick Bowler
+ *  Copyright © 2011, 2021 Nick Bowler
  *
  *  This program is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
  *  You should have received a copy of the GNU General Public License
  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
+
+#include <config.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
+#include <inttypes.h>
 #include <stdbool.h>
 #include <assert.h>
 
 #include "cdecl.h"
-#include "output.h"
+#include "cdecl-internal.h"
 
 /*
  * Renders the start of the thing being declared.  If top is true, print
@@ -48,6 +51,8 @@ explain_prologue(char *buf, size_t n, struct cdecl_declarator *d, bool top)
 
                d = d->child;
        }
+
+       assert(0);
 }
 
 static size_t
@@ -55,7 +60,7 @@ explain_pointer(char *buf, size_t n, struct cdecl_pointer *p)
 {
        size_t ret = 0, rc;
 
-       rc = cdecl__explain_qualifiers(buf, n, p->qualifiers);
+       rc = cdecl__explain_specs(buf, n, p->qualifiers, CDECL_SPEC_QUAL);
        ret += cdecl__advance(&buf, &n, rc);
 
        return ret + snprintf(buf, n, "pointer to");
@@ -76,7 +81,7 @@ explain_array(char *buf, size_t n, struct cdecl_array *a)
                rc = snprintf(buf, n, "%s", a->vla);
                ret += cdecl__advance(&buf, &n, rc);
        } else if (a->length) {
-               rc = snprintf(buf, n, "%ju", a->length);
+               rc = snprintf(buf, n, "%" PRIuMAX, a->length);
                ret += cdecl__advance(&buf, &n, rc);
        }