Author gvanem
Recipients gvanem
Date 2020-10-19.07:03:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1603091022.29.0.567599284376.issue42078@roundup.psfhosted.org>
In-reply-to
Content
Related to:
  https://bugs.python.org/issue33351

where I commented above the following. 
When using `clang-cl` to build, I get the following error:
```
Modules/_tracemalloc.c(55,9): error: declaration of anonymous struct must be a definition
typedef struct
        ^
Modules/_tracemalloc.c(55,1): warning: typedef requires a name [-Wmissing-declarations]
typedef struct
^~~~~~~
Modules/_tracemalloc.c(68,9): warning: #pragma pack(pop, ...) failed: stack empty [-Wignored-pragmas]
#pragma pack(pop)
        ^
Modules/_tracemalloc.c(78,5): error: unknown type name 'frame_t'
    frame_t frames[1];
    ^
Modules/_tracemalloc.c(87,103): error: use of undeclared identifier 'frame_t'
static const unsigned long MAX_NFRAME = Py_MIN(UINT16_MAX, ((SIZE_MAX - sizeof(traceback_t)) / sizeof(frame_t) + 1));
                                                                                                      ^
Modules/_tracemalloc.c(87,103): error: use of undeclared identifier 'frame_t'
Modules/_tracemalloc.c(286,15): error: unknown type name 'frame_t'; did you mean 'trace_t'?
        const frame_t *frame1 = &traceback1->frames[i];
              ^~~~~~~
              trace_t
Modules/_tracemalloc.c(100,3): note: 'trace_t' declared here
} trace_t;
  ^
```

An easy fix is to patch it:
```
--- a/_tracemalloc.c 2020-10-18 12:06:55
+++ b/_tracemalloc.c 2020-10-19 09:02:17
@@ -52,11 +52,11 @@

 /* Pack the frame_t structure to reduce the memory footprint on 64-bit
    architectures: 12 bytes instead of 16. */
-typedef struct
 #ifdef __GNUC__
-__attribute__((packed))
+typedef struct __attribute__((packed))
 #elif defined(_MSC_VER)
 #pragma pack(push, 4)
+typedef struct
 #endif
 {
     /* filename cannot be NULL: "<unknown>" is used if the Python frame
```

(I'm amazed it's not done before).
History
Date User Action Args
2020-10-19 07:03:42gvanemsetrecipients: + gvanem
2020-10-19 07:03:42gvanemsetmessageid: <1603091022.29.0.567599284376.issue42078@roundup.psfhosted.org>
2020-10-19 07:03:42gvanemlinkissue42078 messages
2020-10-19 07:03:40gvanemcreate