From 88e2cd4eefc0fb24595c8857022540222611ef9f Mon Sep 17 00:00:00 2001 From: Sergiu Deitsch Date: Fri, 24 Feb 2023 20:15:03 +0100 Subject: [PATCH] avoid anonymous struct typedefs (#900) --- src/demangle.cc | 8 ++++---- src/stacktrace_unwind-inl.h | 5 ++--- src/windows/dirent.h | 7 +------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/demangle.cc b/src/demangle.cc index 9276c5b..281ac0c 100644 --- a/src/demangle.cc +++ b/src/demangle.cc @@ -46,10 +46,10 @@ _START_GOOGLE_NAMESPACE_ #if !defined(GLOG_OS_WINDOWS) -typedef struct { +struct AbbrevPair { const char *abbrev; const char *real_name; -} AbbrevPair; +}; // List of operators from Itanium C++ ABI. static const AbbrevPair kOperatorList[] = { @@ -148,7 +148,7 @@ static const AbbrevPair kSubstitutionList[] = { }; // State needed for demangling. -typedef struct { +struct State { const char *mangled_cur; // Cursor of mangled name. char *out_cur; // Cursor of output string. const char *out_begin; // Beginning of output string. @@ -158,7 +158,7 @@ typedef struct { short nest_level; // For nested names. bool append; // Append flag. bool overflowed; // True if output gets overflowed. -} State; +}; // We don't use strlen() in libc since it's not guaranteed to be async // signal safe. diff --git a/src/stacktrace_unwind-inl.h b/src/stacktrace_unwind-inl.h index dc1665b..15000e8 100644 --- a/src/stacktrace_unwind-inl.h +++ b/src/stacktrace_unwind-inl.h @@ -38,13 +38,12 @@ _START_GOOGLE_NAMESPACE_ -typedef struct { +struct trace_arg_t { void **result; int max_depth; int skip_count; int count; -} trace_arg_t; - +}; // Workaround for the malloc() in _Unwind_Backtrace() issue. static _Unwind_Reason_Code nop_backtrace(struct _Unwind_Context */*uc*/, void */*opq*/) { diff --git a/src/windows/dirent.h b/src/windows/dirent.h index 12cf00a..94f739c 100644 --- a/src/windows/dirent.h +++ b/src/windows/dirent.h @@ -237,11 +237,10 @@ struct _wdirent { /* File name */ wchar_t d_name[PATH_MAX+1]; }; -typedef struct _wdirent _wdirent; struct _WDIR { /* Current directory entry */ - struct _wdirent ent; + _wdirent ent; /* Private file data */ WIN32_FIND_DATAW data; @@ -255,7 +254,6 @@ struct _WDIR { /* Initial directory name */ wchar_t *patt; }; -typedef struct _WDIR _WDIR; /* Multi-byte character version */ struct dirent { @@ -277,14 +275,11 @@ struct dirent { /* File name */ char d_name[PATH_MAX+1]; }; -typedef struct dirent dirent; struct DIR { struct dirent ent; struct _WDIR *wdirp; }; -typedef struct DIR DIR; - /* Dirent functions */ static DIR *opendir (const char *dirname);