Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QUIET macro not defined on non-__GNUC__ compiler #520

Open
fuhsnn opened this issue Sep 27, 2024 · 0 comments
Open

QUIET macro not defined on non-__GNUC__ compiler #520

fuhsnn opened this issue Sep 27, 2024 · 0 comments

Comments

@fuhsnn
Copy link

fuhsnn commented Sep 27, 2024

The macro is only defined on gcc or clang:

toybox/lib/portability.h

Lines 44 to 54 in 9cde583

#ifdef __GNUC__
#ifndef __clang__
#define QUIET = 0 // shut up false positive "may be used uninitialized" warning
#else
#define QUIET
#endif
#define printf_format __attribute__((format(printf, 1, 2)))
#else
#define printf_format
#endif

For a compiler that doesn't define __GNUC__, it will be undefined when encountered here:

char *ret QUIET, *ss QUIET;

Adding a dummy define here could be a fix.

diff --git a/lib/portability.h b/lib/portability.h
index 0b9e282..49cee36 100644
--- a/lib/portability.h
+++ b/lib/portability.h
@@ -50,6 +50,7 @@
 #endif
 #define printf_format  __attribute__((format(printf, 1, 2)))
 #else
+#define QUIET
 #define printf_format
 #endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant