-
Notifications
You must be signed in to change notification settings - Fork 273
Fix dump-c output involving typedef names #858
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
5938ecb
dump-c: Try to guess further system headers
tautschnig c54ddb8
Typedef names are symbols
tautschnig dc5ae8c
Fix dump-c output involving typedef names
tautschnig f56a398
No special handling of $link. This might appear due to unknown reasons.
stahlbauer 2aa140c
Do not dump certain types if they are defined in system headers
stahlbauer b0e0c0a
Do not dump anonymous types from system headers
stahlbauer ac270c5
Dump the global declarations after the included system headers
stahlbauer fe04e59
Locate var args use even when va_arg_next is not used
tautschnig 0428f6a
Output _Noreturn qualifier at appropriate place
tautschnig 3a57645
Do not dump internal $object declarations
tautschnig f6509c3
Output float literals in a GCC-compatible fashion
tautschnig ad55c4f
bswap is not a library function; use __builtin_bswap[bit-suffix] instead
tautschnig a9dca20
Improve --use-system-headers output for GCC compatibility
tautschnig 38b4c48
dump-c: respect local translation bounds in resolving switch/case
tautschnig e2cfed3
Use invariant annotations instead of asserts
tautschnig 34a476f
dump-c: Replace --use-system-headers by --no-system-headers
tautschnig File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#include<stdarg.h> | ||
#include<stdlib.h> | ||
|
||
void bb_verror_msg(const char *s, va_list p, const char *strerr) { | ||
} | ||
|
||
void bb_error_msg(const char *s, ...) | ||
{ | ||
va_list p; | ||
va_start(p, s); | ||
bb_verror_msg(s, p, NULL); | ||
va_end(p); | ||
} | ||
|
||
int main() { | ||
bb_error_msg("FOOO"); | ||
return 0; | ||
} | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
--dump-c | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
va_list | ||
-- | ||
^warning: ignoring |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
typedef long int off_t; | ||
typedef signed char smallint; | ||
|
||
typedef struct chain_s { | ||
struct node_s *first; | ||
struct node_s *last; | ||
const char *programname; | ||
} chain; | ||
|
||
typedef struct func_s { | ||
struct chain_s body; | ||
} func; | ||
|
||
typedef struct node_s { | ||
struct node_s *n; | ||
} node; | ||
|
||
typedef struct dumper_t_x { | ||
node n; | ||
off_t dump_skip; | ||
signed int dump_length; | ||
smallint dump_vflag; | ||
} dumper_t; | ||
|
||
typedef struct FS_x { | ||
struct FS *nextfs; | ||
signed int bcnt; | ||
} FS; | ||
|
||
dumper_t * alloc_dumper(void) { | ||
return (void*) 0; | ||
} | ||
|
||
typedef unsigned int uint32_t; | ||
|
||
const uint32_t xx[2]; | ||
|
||
typedef struct node_s2 { | ||
uint32_t info; | ||
} node2; | ||
|
||
typedef struct { | ||
int x; | ||
} anon_name; | ||
|
||
typedef struct node_s3 { | ||
union { | ||
struct node_s *n; | ||
func *f; | ||
} r; | ||
} node3; | ||
|
||
typedef int x_int; | ||
typedef int y_int; | ||
typedef x_int *p_int; | ||
|
||
int main() { | ||
node n; | ||
chain c; | ||
dumper_t a; | ||
dumper_t b[3]; | ||
node2* sn; | ||
anon_name d; | ||
node3* s3; | ||
y_int y; | ||
p_int p; | ||
alloc_dumper(); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
--dump-c | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
This test should be run via chain.sh, which will try to recompile the dumped C | ||
code. Missing/incomplete typedef output would cause a failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
typedef struct | ||
{ | ||
char bogus; | ||
} bb_mbstate_t; | ||
|
||
int bb_wcrtomb(char *s, char wc, bb_mbstate_t *ps); | ||
|
||
int bb_wcrtomb(char *s, char wc, bb_mbstate_t *ps) | ||
{ | ||
return 1; | ||
} | ||
|
||
int main() { | ||
bb_wcrtomb("foo", 'Z', (void*)1); | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
--dump-c | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
This test should be run via chain.sh, which will try to recompile the dumped C | ||
code. Missing/incomplete typedef output would cause a failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
extern void* memset(void *, int, unsigned long); | ||
|
||
typedef void (*__sighandler_t) (int); | ||
|
||
typedef __sighandler_t sighandler_t; | ||
|
||
typedef struct siginfo { | ||
int si_signo; | ||
} siginfo_t; | ||
|
||
struct sigaction { | ||
union { | ||
__sighandler_t _sa_handler; | ||
void (*_sa_sigaction)(int, struct siginfo *, void *); | ||
} _u; | ||
}; | ||
|
||
#define sa_sigaction _u._sa_sigaction | ||
#define sa_handler _u._sa_handler | ||
|
||
static void askpass_timeout(signed int ignore) { | ||
; | ||
} | ||
|
||
int main() { | ||
struct sigaction sa, oldsa; | ||
memset(&sa, 0, sizeof(sa)); | ||
sa.sa_handler = askpass_timeout; | ||
return 0; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
--dump-c | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
This test should be run via chain.sh, which will try to recompile the dumped C | ||
code. Missing/incomplete typedef output would cause a failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#ifndef _WIN32 | ||
|
||
#include <signal.h> | ||
#include <stdlib.h> | ||
|
||
void sig_block(int sig) | ||
{ | ||
sigset_t ss; | ||
sigemptyset(&ss); | ||
sigaddset(&ss, sig); | ||
sigprocmask(SIG_BLOCK, &ss, NULL); | ||
} | ||
|
||
int main() { | ||
sig_block(0); | ||
return 0; | ||
} | ||
#else | ||
int main() | ||
{ | ||
return 0; | ||
} | ||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
CORE | ||
main.c | ||
--dump-c | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
-- | ||
^warning: ignoring | ||
-- | ||
This test should be run via chain.sh, which will try to recompile the dumped C | ||
code. Missing/incomplete typedef output would cause a failure. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't clear to me what this test actually checks - could you perhaps add some matching lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added comments in the test to clarify!