Turn on -Wold-style-cast and fix the errors.
A couple of dodgy cases where we cast away const, but otherwise pretty boring.
Change-Id: Ibc39ebd525377792b5911464be842121c20f03b9
diff --git a/libc/stdio/fileext.h b/libc/stdio/fileext.h
index 75230cd..209815a 100644
--- a/libc/stdio/fileext.h
+++ b/libc/stdio/fileext.h
@@ -47,7 +47,12 @@
bool _stdio_handles_locking; /* __fsetlocking support */
};
+#if defined(__cplusplus)
+#define _EXT(fp) reinterpret_cast<__sfileext*>((fp)->_ext._base)
+#else
#define _EXT(fp) ((struct __sfileext *)((fp)->_ext._base))
+#endif
+
#define _UB(fp) _EXT(fp)->_ub
#define _FLOCK(fp) _EXT(fp)->_lock
diff --git a/libc/stdio/local.h b/libc/stdio/local.h
index 7033eda..ce04141 100644
--- a/libc/stdio/local.h
+++ b/libc/stdio/local.h
@@ -124,6 +124,7 @@
#define __sferror(p) (((p)->_flags & __SERR) != 0)
#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
#define __sfileno(p) ((p)->_file)
+#if !defined(__cplusplus)
#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
static __inline int __sputc(int _c, FILE* _p) {
if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) {
@@ -132,6 +133,7 @@
return (__swbuf(_c, _p));
}
}
+#endif
/* OpenBSD declares these in fvwrite.h but we want to ensure they're hidden. */
struct __suio;