summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2024-06-07 14:50:18 -0400
committerJakob Kaivo <jkk@ung.org>2024-06-07 14:50:18 -0400
commitfd466889b49dfe528567587183c2aedd27836f27 (patch)
tree02802cd3785b46a627530427d0e8774742754a7a
parentc195cb021ead7de765a0b37f5ab793802be46731 (diff)
split formatted I/O header, unify undefined behavior reporting with UNDEFINED_FMT() macro
-rw-r--r--mk/__conv.d2
-rw-r--r--mk/__printf.d2
-rw-r--r--mk/__scanf.d2
-rw-r--r--mk/fprintf.d2
-rw-r--r--mk/fprintf_s.d2
-rw-r--r--mk/fscanf.d2
-rw-r--r--mk/fscanf_s.d2
-rw-r--r--mk/printf.d2
-rw-r--r--mk/printf_s.d2
-rw-r--r--mk/scanf.d2
-rw-r--r--mk/scanf_s.d2
-rw-r--r--mk/snprintf.d2
-rw-r--r--mk/snprintf_s.d2
-rw-r--r--mk/sprintf.d2
-rw-r--r--mk/sprintf_s.d2
-rw-r--r--mk/sscanf.d2
-rw-r--r--mk/sscanf_s.d2
-rw-r--r--mk/vfprintf.d2
-rw-r--r--mk/vfprintf_s.d2
-rw-r--r--mk/vfscanf.d2
-rw-r--r--mk/vfscanf_s.d2
-rw-r--r--mk/vprintf.d2
-rw-r--r--mk/vprintf_s.d2
-rw-r--r--mk/vscanf.d2
-rw-r--r--mk/vscanf_s.d2
-rw-r--r--mk/vsnprintf.d2
-rw-r--r--mk/vsnprintf_s.d2
-rw-r--r--mk/vsprintf.d2
-rw-r--r--mk/vsprintf_s.d2
-rw-r--r--mk/vsscanf.d2
-rw-r--r--mk/vsscanf_s.d2
-rw-r--r--src/stdio/__conv.c24
-rw-r--r--src/stdio/__printf.c3
-rw-r--r--src/stdio/__scanf.c3
-rw-r--r--src/stdio/_format.h82
-rw-r--r--src/stdio/_stdio.h71
-rw-r--r--src/stdio/fgetpos.c13
-rw-r--r--src/stdio/fprintf.c2
-rw-r--r--src/stdio/fprintf_s.c2
-rw-r--r--src/stdio/freopen.c4
-rw-r--r--src/stdio/fscanf.c2
-rw-r--r--src/stdio/fscanf_s.c2
-rw-r--r--src/stdio/fsetpos.c2
-rw-r--r--src/stdio/printf.c2
-rw-r--r--src/stdio/printf_s.c2
-rw-r--r--src/stdio/scanf.c2
-rw-r--r--src/stdio/scanf_s.c2
-rw-r--r--src/stdio/snprintf.c2
-rw-r--r--src/stdio/snprintf_s.c2
-rw-r--r--src/stdio/sprintf.c2
-rw-r--r--src/stdio/sprintf_s.c2
-rw-r--r--src/stdio/sscanf.c2
-rw-r--r--src/stdio/sscanf_s.c2
-rw-r--r--src/stdio/vfprintf.c2
-rw-r--r--src/stdio/vfprintf_s.c2
-rw-r--r--src/stdio/vfscanf.c2
-rw-r--r--src/stdio/vfscanf_s.c2
-rw-r--r--src/stdio/vprintf.c2
-rw-r--r--src/stdio/vprintf_s.c2
-rw-r--r--src/stdio/vscanf.c2
-rw-r--r--src/stdio/vscanf_s.c2
-rw-r--r--src/stdio/vsnprintf.c2
-rw-r--r--src/stdio/vsnprintf_s.c2
-rw-r--r--src/stdio/vsprintf.c2
-rw-r--r--src/stdio/vsprintf_s.c2
-rw-r--r--src/stdio/vsscanf.c2
-rw-r--r--src/stdio/vsscanf_s.c2
67 files changed, 184 insertions, 136 deletions
diff --git a/mk/__conv.d b/mk/__conv.d
index 3512ad7f..93c8552d 100644
--- a/mk/__conv.d
+++ b/mk/__conv.d
@@ -3,7 +3,7 @@ libc.a(__conv.o): $(OBJDIR)/__conv.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/__conv.o: src/stdio/__conv.c
-$(OBJDIR)/__conv.o: src/stdio/_stdio.h
+$(OBJDIR)/__conv.o: src/stdio/_format.h
$(OBJDIR)/__conv.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/__conv.c
diff --git a/mk/__printf.d b/mk/__printf.d
index 472b91b5..f6e20da6 100644
--- a/mk/__printf.d
+++ b/mk/__printf.d
@@ -4,7 +4,7 @@ libc.a(__printf.o): $(OBJDIR)/__printf.o
$(OBJDIR)/__printf.o: src/stdio/__printf.c
$(OBJDIR)/__printf.o: src/_forced/strdup.h
-$(OBJDIR)/__printf.o: src/stdio/_stdio.h
+$(OBJDIR)/__printf.o: src/stdio/_format.h
$(OBJDIR)/__printf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/__printf.c
diff --git a/mk/__scanf.d b/mk/__scanf.d
index 930313ea..fe2530d2 100644
--- a/mk/__scanf.d
+++ b/mk/__scanf.d
@@ -3,7 +3,7 @@ libc.a(__scanf.o): $(OBJDIR)/__scanf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/__scanf.o: src/stdio/__scanf.c
-$(OBJDIR)/__scanf.o: src/stdio/_stdio.h
+$(OBJDIR)/__scanf.o: src/stdio/_format.h
$(OBJDIR)/__scanf.o: src/_safety.h
$(OBJDIR)/__scanf.o:
@mkdir -p $(@D)
diff --git a/mk/fprintf.d b/mk/fprintf.d
index 59961d11..c9eadc6d 100644
--- a/mk/fprintf.d
+++ b/mk/fprintf.d
@@ -3,7 +3,7 @@ libc.a(fprintf.o): $(OBJDIR)/fprintf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/fprintf.o: src/stdio/fprintf.c
-$(OBJDIR)/fprintf.o: src/stdio/_stdio.h
+$(OBJDIR)/fprintf.o: src/stdio/_format.h
$(OBJDIR)/fprintf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/fprintf.c
diff --git a/mk/fprintf_s.d b/mk/fprintf_s.d
index 933cff73..b54a5f65 100644
--- a/mk/fprintf_s.d
+++ b/mk/fprintf_s.d
@@ -3,7 +3,7 @@ libc.a(fprintf_s.o): $(OBJDIR)/fprintf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/fprintf_s.o: src/stdio/fprintf_s.c
-$(OBJDIR)/fprintf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/fprintf_s.o: src/stdio/_format.h
$(OBJDIR)/fprintf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/fprintf_s.c
diff --git a/mk/fscanf.d b/mk/fscanf.d
index c99d121b..e2feb8a6 100644
--- a/mk/fscanf.d
+++ b/mk/fscanf.d
@@ -3,7 +3,7 @@ libc.a(fscanf.o): $(OBJDIR)/fscanf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/fscanf.o: src/stdio/fscanf.c
-$(OBJDIR)/fscanf.o: src/stdio/_stdio.h
+$(OBJDIR)/fscanf.o: src/stdio/_format.h
$(OBJDIR)/fscanf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/fscanf.c
diff --git a/mk/fscanf_s.d b/mk/fscanf_s.d
index cfef8588..2961461b 100644
--- a/mk/fscanf_s.d
+++ b/mk/fscanf_s.d
@@ -3,7 +3,7 @@ libc.a(fscanf_s.o): $(OBJDIR)/fscanf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/fscanf_s.o: src/stdio/fscanf_s.c
-$(OBJDIR)/fscanf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/fscanf_s.o: src/stdio/_format.h
$(OBJDIR)/fscanf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/fscanf_s.c
diff --git a/mk/printf.d b/mk/printf.d
index f6268e62..a8cac79b 100644
--- a/mk/printf.d
+++ b/mk/printf.d
@@ -3,7 +3,7 @@ libc.a(printf.o): $(OBJDIR)/printf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/printf.o: src/stdio/printf.c
-$(OBJDIR)/printf.o: src/stdio/_stdio.h
+$(OBJDIR)/printf.o: src/stdio/_format.h
$(OBJDIR)/printf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/printf.c
diff --git a/mk/printf_s.d b/mk/printf_s.d
index a81dfe49..514a7322 100644
--- a/mk/printf_s.d
+++ b/mk/printf_s.d
@@ -3,7 +3,7 @@ libc.a(printf_s.o): $(OBJDIR)/printf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/printf_s.o: src/stdio/printf_s.c
-$(OBJDIR)/printf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/printf_s.o: src/stdio/_format.h
$(OBJDIR)/printf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/printf_s.c
diff --git a/mk/scanf.d b/mk/scanf.d
index 57ee458d..25409a70 100644
--- a/mk/scanf.d
+++ b/mk/scanf.d
@@ -3,7 +3,7 @@ libc.a(scanf.o): $(OBJDIR)/scanf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/scanf.o: src/stdio/scanf.c
-$(OBJDIR)/scanf.o: src/stdio/_stdio.h
+$(OBJDIR)/scanf.o: src/stdio/_format.h
$(OBJDIR)/scanf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/scanf.c
diff --git a/mk/scanf_s.d b/mk/scanf_s.d
index 1a65a5a2..c4fe17e2 100644
--- a/mk/scanf_s.d
+++ b/mk/scanf_s.d
@@ -3,7 +3,7 @@ libc.a(scanf_s.o): $(OBJDIR)/scanf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/scanf_s.o: src/stdio/scanf_s.c
-$(OBJDIR)/scanf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/scanf_s.o: src/stdio/_format.h
$(OBJDIR)/scanf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/scanf_s.c
diff --git a/mk/snprintf.d b/mk/snprintf.d
index 1ed073a2..79a1d4a4 100644
--- a/mk/snprintf.d
+++ b/mk/snprintf.d
@@ -3,7 +3,7 @@ libc.a(snprintf.o): $(OBJDIR)/snprintf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/snprintf.o: src/stdio/snprintf.c
-$(OBJDIR)/snprintf.o: src/stdio/_stdio.h
+$(OBJDIR)/snprintf.o: src/stdio/_format.h
$(OBJDIR)/snprintf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/snprintf.c
diff --git a/mk/snprintf_s.d b/mk/snprintf_s.d
index b2c1fdbd..805a2d90 100644
--- a/mk/snprintf_s.d
+++ b/mk/snprintf_s.d
@@ -3,7 +3,7 @@ libc.a(snprintf_s.o): $(OBJDIR)/snprintf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/snprintf_s.o: src/stdio/snprintf_s.c
-$(OBJDIR)/snprintf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/snprintf_s.o: src/stdio/_format.h
$(OBJDIR)/snprintf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/snprintf_s.c
diff --git a/mk/sprintf.d b/mk/sprintf.d
index 384da76c..f42eade9 100644
--- a/mk/sprintf.d
+++ b/mk/sprintf.d
@@ -3,7 +3,7 @@ libc.a(sprintf.o): $(OBJDIR)/sprintf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/sprintf.o: src/stdio/sprintf.c
-$(OBJDIR)/sprintf.o: src/stdio/_stdio.h
+$(OBJDIR)/sprintf.o: src/stdio/_format.h
$(OBJDIR)/sprintf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/sprintf.c
diff --git a/mk/sprintf_s.d b/mk/sprintf_s.d
index 65c99698..dd99120d 100644
--- a/mk/sprintf_s.d
+++ b/mk/sprintf_s.d
@@ -3,7 +3,7 @@ libc.a(sprintf_s.o): $(OBJDIR)/sprintf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/sprintf_s.o: src/stdio/sprintf_s.c
-$(OBJDIR)/sprintf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/sprintf_s.o: src/stdio/_format.h
$(OBJDIR)/sprintf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/sprintf_s.c
diff --git a/mk/sscanf.d b/mk/sscanf.d
index 3c6aac2c..18723f33 100644
--- a/mk/sscanf.d
+++ b/mk/sscanf.d
@@ -3,7 +3,7 @@ libc.a(sscanf.o): $(OBJDIR)/sscanf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/sscanf.o: src/stdio/sscanf.c
-$(OBJDIR)/sscanf.o: src/stdio/_stdio.h
+$(OBJDIR)/sscanf.o: src/stdio/_format.h
$(OBJDIR)/sscanf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/sscanf.c
diff --git a/mk/sscanf_s.d b/mk/sscanf_s.d
index ec0e0749..490c0a46 100644
--- a/mk/sscanf_s.d
+++ b/mk/sscanf_s.d
@@ -3,7 +3,7 @@ libc.a(sscanf_s.o): $(OBJDIR)/sscanf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/sscanf_s.o: src/stdio/sscanf_s.c
-$(OBJDIR)/sscanf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/sscanf_s.o: src/stdio/_format.h
$(OBJDIR)/sscanf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/sscanf_s.c
diff --git a/mk/vfprintf.d b/mk/vfprintf.d
index 9aff877d..9f680028 100644
--- a/mk/vfprintf.d
+++ b/mk/vfprintf.d
@@ -3,7 +3,7 @@ libc.a(vfprintf.o): $(OBJDIR)/vfprintf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vfprintf.o: src/stdio/vfprintf.c
-$(OBJDIR)/vfprintf.o: src/stdio/_stdio.h
+$(OBJDIR)/vfprintf.o: src/stdio/_format.h
$(OBJDIR)/vfprintf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vfprintf.c
diff --git a/mk/vfprintf_s.d b/mk/vfprintf_s.d
index 6e63c760..30bbed60 100644
--- a/mk/vfprintf_s.d
+++ b/mk/vfprintf_s.d
@@ -3,7 +3,7 @@ libc.a(vfprintf_s.o): $(OBJDIR)/vfprintf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vfprintf_s.o: src/stdio/vfprintf_s.c
-$(OBJDIR)/vfprintf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/vfprintf_s.o: src/stdio/_format.h
$(OBJDIR)/vfprintf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vfprintf_s.c
diff --git a/mk/vfscanf.d b/mk/vfscanf.d
index caf1f99b..eb9df79c 100644
--- a/mk/vfscanf.d
+++ b/mk/vfscanf.d
@@ -3,7 +3,7 @@ libc.a(vfscanf.o): $(OBJDIR)/vfscanf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vfscanf.o: src/stdio/vfscanf.c
-$(OBJDIR)/vfscanf.o: src/stdio/_stdio.h
+$(OBJDIR)/vfscanf.o: src/stdio/_format.h
$(OBJDIR)/vfscanf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vfscanf.c
diff --git a/mk/vfscanf_s.d b/mk/vfscanf_s.d
index 30c708c6..d9520908 100644
--- a/mk/vfscanf_s.d
+++ b/mk/vfscanf_s.d
@@ -3,7 +3,7 @@ libc.a(vfscanf_s.o): $(OBJDIR)/vfscanf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vfscanf_s.o: src/stdio/vfscanf_s.c
-$(OBJDIR)/vfscanf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/vfscanf_s.o: src/stdio/_format.h
$(OBJDIR)/vfscanf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vfscanf_s.c
diff --git a/mk/vprintf.d b/mk/vprintf.d
index 66825ea0..88d686a8 100644
--- a/mk/vprintf.d
+++ b/mk/vprintf.d
@@ -3,7 +3,7 @@ libc.a(vprintf.o): $(OBJDIR)/vprintf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vprintf.o: src/stdio/vprintf.c
-$(OBJDIR)/vprintf.o: src/stdio/_stdio.h
+$(OBJDIR)/vprintf.o: src/stdio/_format.h
$(OBJDIR)/vprintf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vprintf.c
diff --git a/mk/vprintf_s.d b/mk/vprintf_s.d
index ee2d1d17..fac05326 100644
--- a/mk/vprintf_s.d
+++ b/mk/vprintf_s.d
@@ -3,7 +3,7 @@ libc.a(vprintf_s.o): $(OBJDIR)/vprintf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vprintf_s.o: src/stdio/vprintf_s.c
-$(OBJDIR)/vprintf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/vprintf_s.o: src/stdio/_format.h
$(OBJDIR)/vprintf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vprintf_s.c
diff --git a/mk/vscanf.d b/mk/vscanf.d
index dee498c8..9e10c118 100644
--- a/mk/vscanf.d
+++ b/mk/vscanf.d
@@ -3,7 +3,7 @@ libc.a(vscanf.o): $(OBJDIR)/vscanf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vscanf.o: src/stdio/vscanf.c
-$(OBJDIR)/vscanf.o: src/stdio/_stdio.h
+$(OBJDIR)/vscanf.o: src/stdio/_format.h
$(OBJDIR)/vscanf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vscanf.c
diff --git a/mk/vscanf_s.d b/mk/vscanf_s.d
index 0078e109..37a03f7b 100644
--- a/mk/vscanf_s.d
+++ b/mk/vscanf_s.d
@@ -3,7 +3,7 @@ libc.a(vscanf_s.o): $(OBJDIR)/vscanf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vscanf_s.o: src/stdio/vscanf_s.c
-$(OBJDIR)/vscanf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/vscanf_s.o: src/stdio/_format.h
$(OBJDIR)/vscanf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vscanf_s.c
diff --git a/mk/vsnprintf.d b/mk/vsnprintf.d
index 19fa6b69..6f482567 100644
--- a/mk/vsnprintf.d
+++ b/mk/vsnprintf.d
@@ -3,7 +3,7 @@ libc.a(vsnprintf.o): $(OBJDIR)/vsnprintf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vsnprintf.o: src/stdio/vsnprintf.c
-$(OBJDIR)/vsnprintf.o: src/stdio/_stdio.h
+$(OBJDIR)/vsnprintf.o: src/stdio/_format.h
$(OBJDIR)/vsnprintf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vsnprintf.c
diff --git a/mk/vsnprintf_s.d b/mk/vsnprintf_s.d
index 72f8afbf..92d6bc51 100644
--- a/mk/vsnprintf_s.d
+++ b/mk/vsnprintf_s.d
@@ -3,7 +3,7 @@ libc.a(vsnprintf_s.o): $(OBJDIR)/vsnprintf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vsnprintf_s.o: src/stdio/vsnprintf_s.c
-$(OBJDIR)/vsnprintf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/vsnprintf_s.o: src/stdio/_format.h
$(OBJDIR)/vsnprintf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vsnprintf_s.c
diff --git a/mk/vsprintf.d b/mk/vsprintf.d
index e449cd0f..b4af0dec 100644
--- a/mk/vsprintf.d
+++ b/mk/vsprintf.d
@@ -3,7 +3,7 @@ libc.a(vsprintf.o): $(OBJDIR)/vsprintf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vsprintf.o: src/stdio/vsprintf.c
-$(OBJDIR)/vsprintf.o: src/stdio/_stdio.h
+$(OBJDIR)/vsprintf.o: src/stdio/_format.h
$(OBJDIR)/vsprintf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vsprintf.c
diff --git a/mk/vsprintf_s.d b/mk/vsprintf_s.d
index 806a6e70..3add5ac1 100644
--- a/mk/vsprintf_s.d
+++ b/mk/vsprintf_s.d
@@ -3,7 +3,7 @@ libc.a(vsprintf_s.o): $(OBJDIR)/vsprintf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vsprintf_s.o: src/stdio/vsprintf_s.c
-$(OBJDIR)/vsprintf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/vsprintf_s.o: src/stdio/_format.h
$(OBJDIR)/vsprintf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vsprintf_s.c
diff --git a/mk/vsscanf.d b/mk/vsscanf.d
index b6ebc798..a0d6af5a 100644
--- a/mk/vsscanf.d
+++ b/mk/vsscanf.d
@@ -3,7 +3,7 @@ libc.a(vsscanf.o): $(OBJDIR)/vsscanf.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vsscanf.o: src/stdio/vsscanf.c
-$(OBJDIR)/vsscanf.o: src/stdio/_stdio.h
+$(OBJDIR)/vsscanf.o: src/stdio/_format.h
$(OBJDIR)/vsscanf.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vsscanf.c
diff --git a/mk/vsscanf_s.d b/mk/vsscanf_s.d
index 1a9e2436..6cd54265 100644
--- a/mk/vsscanf_s.d
+++ b/mk/vsscanf_s.d
@@ -3,7 +3,7 @@ libc.a(vsscanf_s.o): $(OBJDIR)/vsscanf_s.o
@$(AR) $(ARFLAGS) $@ $(OBJDIR)/$%
$(OBJDIR)/vsscanf_s.o: src/stdio/vsscanf_s.c
-$(OBJDIR)/vsscanf_s.o: src/stdio/_stdio.h
+$(OBJDIR)/vsscanf_s.o: src/stdio/_format.h
$(OBJDIR)/vsscanf_s.o:
@mkdir -p $(@D)
$(CC) -c -o $@ $(CFLAGS) src/stdio/vsscanf_s.c
diff --git a/src/stdio/__conv.c b/src/stdio/__conv.c
index 994bb072..2b317400 100644
--- a/src/stdio/__conv.c
+++ b/src/stdio/__conv.c
@@ -1,7 +1,7 @@
#include <inttypes.h>
#include <ctype.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
static char *length_names[] = {
[L_hh] = "hh",
@@ -39,7 +39,7 @@ size_t __conv(const char *format, struct io_conversion *conv, va_list arg)
if (conv->dir == IO_IN) {
if ((conv->flags & ~(F_STAR)) != 0) {
- UNDEFINED("Flag '%c' is not valid for formatted input", format[ret]);
+ UNDEFINED_FMT(conv, "Flag '%c' is not valid for formatted input", format[ret]);
}
} else {
if (conv->flags & F_STAR) {
@@ -101,7 +101,7 @@ size_t __conv(const char *format, struct io_conversion *conv, va_list arg)
case 'd':
case 'i':
if (conv->length == L_L) {
- UNDEFINED("In call to %s(): Length '%s' is not supported with conversion specifier '%c'", conv->func, length_names[conv->length], conv->spec);
+ UNDEFINED_FMT(conv, "Length '%s' is not supported with conversion specifier '%c'", length_names[conv->length], conv->spec);
}
break;
@@ -110,7 +110,7 @@ size_t __conv(const char *format, struct io_conversion *conv, va_list arg)
case 'x':
case 'X':
if (conv->length == L_L) {
- UNDEFINED("In call to %s(): Length '%s' is not supported with conversion specifier '%c'", conv->func, length_names[conv->length], conv->spec);
+ UNDEFINED_FMT(conv, "Length '%s' is not supported with conversion specifier '%c'", length_names[conv->length], conv->spec);
}
break;
@@ -123,20 +123,20 @@ size_t __conv(const char *format, struct io_conversion *conv, va_list arg)
case 'a':
case 'A':
if (conv->length != L_L && conv->length) {
- UNDEFINED("In call to %s(): Length '%s' is not supported with conversion specifier '%c'", conv->func, length_names[conv->length], conv->spec);
+ UNDEFINED_FMT(conv, "Length '%s' is not supported with conversion specifier '%c'", length_names[conv->length], conv->spec);
}
break;
case 'c':
if (conv->flags & F_PRECISION) {
- UNDEFINED("In call to %s(): Precision is not supported with conversion specifier '%c'", conv->func, conv->spec);
+ UNDEFINED_FMT(conv, "Precision is not supported with conversion specifier '%c'", conv->spec);
}
/* FALLTHRU */
case 's':
case '[':
if (conv->length != L_l && conv->length) {
- UNDEFINED("In call to %s(): Length '%s' is not supported with conversion specifier '%c'", conv->func, length_names[conv->length], conv->spec);
+ UNDEFINED_FMT(conv, "Length '%s' is not supported with conversion specifier '%c'", length_names[conv->length], conv->spec);
}
break;
@@ -144,21 +144,21 @@ size_t __conv(const char *format, struct io_conversion *conv, va_list arg)
case 'n':
case '%':
if (conv->flags & F_WIDTH) {
- UNDEFINED("In call to %s(): Field width is not supported with conversion specififier '%c'", conv->func, conv->spec);
+ UNDEFINED_FMT(conv, "Field width is not supported with conversion specififier '%c'", conv->spec);
}
if (conv->flags & F_PRECISION) {
- UNDEFINED("In call to %s(): Precision is not supported with conversion specififier '%c'", conv->func, conv->spec);
+ UNDEFINED_FMT(conv, "Precision is not supported with conversion specififier '%c'", conv->spec);
}
if (conv->flags) {
- UNDEFINED("In call to %s(): Flags are not supported with conversion specifier '%c'", conv->func, conv->spec);
+ UNDEFINED_FMT(conv, "Flags are not supported with conversion specifier '%c'", conv->spec);
}
if (conv->length) {
- UNDEFINED("In call to %s(): Length '%s' is not supported with conversion specifier '%c'", conv->func, length_names[conv->length], conv->spec);
+ UNDEFINED_FMT(conv, "Length '%s' is not supported with conversion specifier '%c'", length_names[conv->length], conv->spec);
}
break;
default:
- UNDEFINED("In call to %s(): Unknown conversion specifier '%c'", conv->func, conv->spec);
+ UNDEFINED_FMT(conv, "Unknown conversion specifier '%c'", conv->spec);
}
return ret;
diff --git a/src/stdio/__printf.c b/src/stdio/__printf.c
index d0672d14..3471db74 100644
--- a/src/stdio/__printf.c
+++ b/src/stdio/__printf.c
@@ -10,7 +10,7 @@
#endif
#include "_forced/strdup.h"
-#include "_stdio.h"
+#include "_format.h"
#define NUMBUFLEN 64
@@ -129,6 +129,7 @@ int __printf(struct io_options *opt, const char * format, va_list arg)
struct io_conversion conv = {
.func = opt->fnname,
.dir = IO_OUT,
+ .fmt = format,
};
int base = 10;
diff --git a/src/stdio/__scanf.c b/src/stdio/__scanf.c
index 5e43303e..f39fdfc0 100644
--- a/src/stdio/__scanf.c
+++ b/src/stdio/__scanf.c
@@ -5,7 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
#include "_safety.h"
#pragma GCC diagnostic ignored "-Wint-conversion"
@@ -129,6 +129,7 @@ int __scanf(struct io_options *opt, const char * format, va_list arg)
struct io_conversion conv = {
.func = opt->fnname,
.dir = IO_IN,
+ .fmt = format,
};
if (isspace(*format)) {
diff --git a/src/stdio/_format.h b/src/stdio/_format.h
new file mode 100644
index 00000000..5930fdb6
--- /dev/null
+++ b/src/stdio/_format.h
@@ -0,0 +1,82 @@
+#ifndef __STDIO__FORMAT_H__
+#define __STDIO__FORMAT_H__
+
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include "_stdio.h"
+#include "_safety.h"
+
+#define UNDEFINED_FMT(__conv, __fmt, ...) do { \
+ char __buf[128]; \
+ snprintf(__buf, sizeof(__buf), "In call to %s() with format string \"%s\": Invalid conversion specification: ", __conv->func, __conv->fmt); \
+ __undefined("%s" __fmt, __buf, __VA_ARGS__); \
+} while (0)
+
+struct io_options {
+ const char *fnname; /* the calling function */
+ char *string; /* NULL or the output string */
+ wchar_t *wstring; /* NULL or the output wide string */
+ FILE *stream; /* NULL or the output stream */
+ int fd; /* -1 or the output file descriptor */
+ size_t maxlen; /* max number of bytes to write to string */
+ size_t pos; /* current index in string */
+ int ret; /* return value */
+};
+
+struct io_conversion {
+ const char *func;
+ const char *fmt;
+ enum { IO_IN, IO_OUT } dir;
+ enum conversion_flags {
+ /* explicit */
+ F_STAR = (1<<0),
+ F_LEFT = (1<<1),
+ F_SIGN = (1<<2),
+ F_SPACE = (1<<3),
+ F_ALT = (1<<4),
+ F_ZERO = (1<<5),
+
+ /* inferred */
+ F_UPPER = (1<<10),
+ F_WIDTH = (1<<11),
+ F_PRECISION = (1<<12),
+ } flags;
+ enum conversion_length {
+ L_default,
+ L_hh,
+ L_ll,
+ L_h,
+ L_l,
+ L_j,
+ L_z,
+ L_t,
+ L_L,
+ } length;
+ uintmax_t width;
+ uintmax_t precision;
+ char spec;
+ union {
+ uintmax_t u;
+ intmax_t i;
+ float f;
+ double d;
+ long double ld;
+ char *s;
+ wchar_t *wcs;
+ char c;
+ wchar_t wc;
+ void *ptr;
+ } val;
+};
+
+size_t __conv(const char *, struct io_conversion *, va_list);
+int __printf(struct io_options * restrict, const char * restrict, va_list);
+int __scanf(struct io_options * restrict, const char * restrict, va_list);
+
+/*
+STDC(-1)
+*/
+
+#endif
diff --git a/src/stdio/_stdio.h b/src/stdio/_stdio.h
index 1894e956..8cbf453c 100644
--- a/src/stdio/_stdio.h
+++ b/src/stdio/_stdio.h
@@ -46,6 +46,13 @@
UNDEFINED("In call to %s(): Requested %s operation on %s oriented stream", __func__, (__orientation) > 0 ? "wide" : "byte", ((__stream)->orientation) > 0 ? "wide" : "byte"); \
} \
} while (0)
+
+#define ASSERT_FPOS(__stream, __pos) do { \
+ if (!(__pos->__impl >= __stream->fpos && __pos->__impl <= __stream->fpos + __stream->nfpos)) { \
+ UNDEFINED("In call to %s(): %s must be previously set by calling fesetpos()", __func__, #__pos); \
+ } \
+} while (0)
+
#endif
struct __FILE {
@@ -79,72 +86,16 @@ struct __FILE {
pid_t pipe_pid; /* if stream is a pipe, the child pid */
#endif
- fpos_t *valid_fpos;
- size_t nvalid_fpos;
+ struct __fpos_t *fpos;
+ size_t nfpos;
long int *valid_ftell;
size_t nvalid_ftell;
};
-struct io_options {
- const char *fnname; /* the calling function */
- char *string; /* NULL or the output string */
- wchar_t *wstring; /* NULL or the output wide string */
- FILE *stream; /* NULL or the output stream */
- int fd; /* -1 or the output file descriptor */
- size_t maxlen; /* max number of bytes to write to string */
- size_t pos; /* current index in string */
- int ret; /* return value */
+struct __fpos_t {
+ size_t pos;
};
-struct io_conversion {
- const char *func;
- enum { IO_IN, IO_OUT } dir;
- enum conversion_flags {
- /* explicit */
- F_STAR = (1<<0),
- F_LEFT = (1<<1),
- F_SIGN = (1<<2),
- F_SPACE = (1<<3),
- F_ALT = (1<<4),
- F_ZERO = (1<<5),
-
- /* inferred */
- F_UPPER = (1<<10),
- F_WIDTH = (1<<11),
- F_PRECISION = (1<<12),
- } flags;
- enum conversion_length {
- L_default,
- L_hh,
- L_ll,
- L_h,
- L_l,
- L_j,
- L_z,
- L_t,
- L_L,
- } length;
- uintmax_t width;
- uintmax_t precision;
- char spec;
- union {
- uintmax_t u;
- intmax_t i;
- float f;
- double d;
- long double ld;
- char *s;
- wchar_t *wcs;
- char c;
- wchar_t wc;
- void *ptr;
- } val;
-};
-
-size_t __conv(const char *, struct io_conversion *, va_list);
-int __printf(struct io_options * restrict, const char * restrict, va_list);
-int __scanf(struct io_options * restrict, const char * restrict, va_list);
-
extern struct __stdio_h {
struct __FILE FILES[FOPEN_MAX];
char **formatted_pointers;
diff --git a/src/stdio/fgetpos.c b/src/stdio/fgetpos.c
index 8e6d201e..2f105f6a 100644
--- a/src/stdio/fgetpos.c
+++ b/src/stdio/fgetpos.c
@@ -6,10 +6,21 @@
int fgetpos(FILE * restrict stream, fpos_t * restrict pos)
{
SIGNAL_SAFE(0);
+ ASSERT_STREAM(stream, 0, 0);
+ ASSERT_NONNULL(pos);
ASSERT_NOOVERLAP(stream, sizeof(*stream), pos, sizeof(*pos));
flockfile(stream);
- *pos = stream->pos;
+ if (!(pos->__impl >= stream->fpos && pos->__impl <= stream->fpos + stream->nfpos)) {
+ struct __fpos_t *tmp = realloc(stream->fpos, sizeof(*stream->fpos) * (stream->nfpos + 1));
+ if (tmp == NULL) {
+ abort();
+ }
+ stream->fpos = tmp;
+ pos->__impl = &(stream->fpos[stream->nfpos++]);
+ }
+
+ pos->__impl->pos = ftell(stream);
funlockfile(stream);
return 0;
}
diff --git a/src/stdio/fprintf.c b/src/stdio/fprintf.c
index bab6455a..c773a72a 100644
--- a/src/stdio/fprintf.c
+++ b/src/stdio/fprintf.c
@@ -1,7 +1,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a file stream **/
diff --git a/src/stdio/fprintf_s.c b/src/stdio/fprintf_s.c
index 83843f78..8fc38f9f 100644
--- a/src/stdio/fprintf_s.c
+++ b/src/stdio/fprintf_s.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a file stream **/
int fprintf_s(FILE * restrict stream, const char * restrict format, ...)
diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c
index 60394ca6..941ffb9b 100644
--- a/src/stdio/freopen.c
+++ b/src/stdio/freopen.c
@@ -82,8 +82,8 @@ FILE * freopen(const char * restrict filename, const char * restrict mode, FILE
stream->buf = stream->ibuf;
}
- free(stream->valid_fpos);
- stream->nvalid_fpos = 0;
+ free(stream->fpos);
+ stream->nfpos = 0;
free(stream->valid_ftell);
stream->nvalid_ftell = 0;
diff --git a/src/stdio/fscanf.c b/src/stdio/fscanf.c
index 2299fd11..718cd0d4 100644
--- a/src/stdio/fscanf.c
+++ b/src/stdio/fscanf.c
@@ -1,7 +1,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** read formatted input from a file stream **/
diff --git a/src/stdio/fscanf_s.c b/src/stdio/fscanf_s.c
index 310ca5da..a82c45ec 100644
--- a/src/stdio/fscanf_s.c
+++ b/src/stdio/fscanf_s.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** read formatted input from a file stream **/
int fscanf_s(FILE * restrict stream, const char * restrict format, ...)
diff --git a/src/stdio/fsetpos.c b/src/stdio/fsetpos.c
index c75fed41..f4aaf71c 100644
--- a/src/stdio/fsetpos.c
+++ b/src/stdio/fsetpos.c
@@ -6,6 +6,8 @@
int fsetpos(FILE *stream, const fpos_t *pos)
{
SIGNAL_SAFE(0);
+ ASSERT_STREAM(stream, 0, 0);
+ ASSERT_FPOS(stream, pos);
ASSERT_NOOVERLAP(stream, sizeof(*stream), pos, sizeof(*pos));
(void)stream; (void)pos;
diff --git a/src/stdio/printf.c b/src/stdio/printf.c
index 03b6df2a..793462ff 100644
--- a/src/stdio/printf.c
+++ b/src/stdio/printf.c
@@ -1,6 +1,6 @@
#include <stdarg.h>
#include <stdio.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output **/
diff --git a/src/stdio/printf_s.c b/src/stdio/printf_s.c
index 92b4ca7c..3ba50642 100644
--- a/src/stdio/printf_s.c
+++ b/src/stdio/printf_s.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output **/
int printf_s(const char *format, ...)
diff --git a/src/stdio/scanf.c b/src/stdio/scanf.c
index d7de9a7c..49935f1a 100644
--- a/src/stdio/scanf.c
+++ b/src/stdio/scanf.c
@@ -1,6 +1,6 @@
#include <stdarg.h>
#include <stdio.h>
-#include "_stdio.h"
+#include "_format.h"
/** read formatted input **/
diff --git a/src/stdio/scanf_s.c b/src/stdio/scanf_s.c
index d4618cd7..add9f703 100644
--- a/src/stdio/scanf_s.c
+++ b/src/stdio/scanf_s.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
-#include "_stdio.h"
+#include "_format.h"
/** read formatted input **/
int scanf_s(const char * restrict format, ...)
diff --git a/src/stdio/snprintf.c b/src/stdio/snprintf.c
index c77239c4..05d22c95 100644
--- a/src/stdio/snprintf.c
+++ b/src/stdio/snprintf.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
GCC_SSE_HACK
int snprintf(char * restrict s, size_t n, const char * restrict format, ...)
diff --git a/src/stdio/snprintf_s.c b/src/stdio/snprintf_s.c
index b3b8c0fc..6f6ac1df 100644
--- a/src/stdio/snprintf_s.c
+++ b/src/stdio/snprintf_s.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
int snprintf_s( char * restrict s, rsize_t n, const char * restrict format, ...)
{
diff --git a/src/stdio/sprintf.c b/src/stdio/sprintf.c
index fcb1ddac..3b815ab7 100644
--- a/src/stdio/sprintf.c
+++ b/src/stdio/sprintf.c
@@ -1,6 +1,6 @@
#include <stdarg.h>
#include <stdio.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a string **/
diff --git a/src/stdio/sprintf_s.c b/src/stdio/sprintf_s.c
index e640abf7..e2914e13 100644
--- a/src/stdio/sprintf_s.c
+++ b/src/stdio/sprintf_s.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a string **/
int sprintf_s(char * restrict s, rsize_t n, const char * restrict format, ...)
diff --git a/src/stdio/sscanf.c b/src/stdio/sscanf.c
index 4fab8b61..c9f1c1f6 100644
--- a/src/stdio/sscanf.c
+++ b/src/stdio/sscanf.c
@@ -1,7 +1,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** read formatted input from a string **/
diff --git a/src/stdio/sscanf_s.c b/src/stdio/sscanf_s.c
index 08bbd6e5..159b2893 100644
--- a/src/stdio/sscanf_s.c
+++ b/src/stdio/sscanf_s.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** read formatted input from a string **/
int sscanf_s(const char * restrict s, const char * restrict format, ...)
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 958e04fe..5cfb3afa 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -1,7 +1,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a file stream **/
diff --git a/src/stdio/vfprintf_s.c b/src/stdio/vfprintf_s.c
index b11f27e8..434f5cf5 100644
--- a/src/stdio/vfprintf_s.c
+++ b/src/stdio/vfprintf_s.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a file stream **/
int vfprintf_s(FILE * restrict stream, const char * restrict format, va_list arg)
diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c
index af0dc289..79694ab9 100644
--- a/src/stdio/vfscanf.c
+++ b/src/stdio/vfscanf.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg)
{
diff --git a/src/stdio/vfscanf_s.c b/src/stdio/vfscanf_s.c
index 7654abd3..47add45c 100644
--- a/src/stdio/vfscanf_s.c
+++ b/src/stdio/vfscanf_s.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
int vfscanf_s(FILE * restrict stream, const char * restrict format, va_list arg)
{
diff --git a/src/stdio/vprintf.c b/src/stdio/vprintf.c
index 00c21419..8db52891 100644
--- a/src/stdio/vprintf.c
+++ b/src/stdio/vprintf.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <stdarg.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output **/
int vprintf(const char * restrict format, va_list arg)
diff --git a/src/stdio/vprintf_s.c b/src/stdio/vprintf_s.c
index 5f462e7e..b08b6da6 100644
--- a/src/stdio/vprintf_s.c
+++ b/src/stdio/vprintf_s.c
@@ -1,5 +1,5 @@
#include <stdio.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output **/
int vprintf_s(const char * restrict format, va_list arg)
diff --git a/src/stdio/vscanf.c b/src/stdio/vscanf.c
index 701ac478..2b94b61c 100644
--- a/src/stdio/vscanf.c
+++ b/src/stdio/vscanf.c
@@ -1,5 +1,5 @@
#include <stdio.h>
-#include "_stdio.h"
+#include "_format.h"
int vscanf(const char * restrict format, va_list arg)
{
diff --git a/src/stdio/vscanf_s.c b/src/stdio/vscanf_s.c
index d8bf0418..9c96df0f 100644
--- a/src/stdio/vscanf_s.c
+++ b/src/stdio/vscanf_s.c
@@ -1,5 +1,5 @@
#include <stdio.h>
-#include "_stdio.h"
+#include "_format.h"
int vscanf_s(const char * restrict format, va_list arg)
{
diff --git a/src/stdio/vsnprintf.c b/src/stdio/vsnprintf.c
index 87deb169..373ab5a0 100644
--- a/src/stdio/vsnprintf.c
+++ b/src/stdio/vsnprintf.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
int vsnprintf(char * restrict s, size_t n, const char *format, va_list arg)
{
diff --git a/src/stdio/vsnprintf_s.c b/src/stdio/vsnprintf_s.c
index 2f980931..e302a19c 100644
--- a/src/stdio/vsnprintf_s.c
+++ b/src/stdio/vsnprintf_s.c
@@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
int vsnprintf_s(char * restrict s, rsize_t n, const char * restrict format, va_list arg)
{
diff --git a/src/stdio/vsprintf.c b/src/stdio/vsprintf.c
index 6edf9f2f..c218a3da 100644
--- a/src/stdio/vsprintf.c
+++ b/src/stdio/vsprintf.c
@@ -1,6 +1,6 @@
#include <stdarg.h>
#include <stdio.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a string **/
diff --git a/src/stdio/vsprintf_s.c b/src/stdio/vsprintf_s.c
index 38500801..7e226765 100644
--- a/src/stdio/vsprintf_s.c
+++ b/src/stdio/vsprintf_s.c
@@ -2,7 +2,7 @@
#include <stdarg.h>
#include <stdint.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
/** write formatted output to a string **/
int vsprintf_s(char *s, rsize_t n, const char *format, va_list arg)
diff --git a/src/stdio/vsscanf.c b/src/stdio/vsscanf.c
index 183d9f2d..5113c34e 100644
--- a/src/stdio/vsscanf.c
+++ b/src/stdio/vsscanf.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
int vsscanf(const char * restrict s, const char * restrict format, va_list arg)
{
diff --git a/src/stdio/vsscanf_s.c b/src/stdio/vsscanf_s.c
index 63ec80bf..f5a0a31b 100644
--- a/src/stdio/vsscanf_s.c
+++ b/src/stdio/vsscanf_s.c
@@ -1,6 +1,6 @@
#include <stdarg.h>
#include <string.h>
-#include "_stdio.h"
+#include "_format.h"
int vsscanf_s(const char * restrict s, const char * restrict format, va_list arg)
{