aboutsummaryrefslogtreecommitdiff
blob: 54835059e71c299bd7f3cb26afcbbceb4d0fb62f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From add8c17b51123f7919ab68e9e6bb8ffa0739ce39 Mon Sep 17 00:00:00 2001
From: Max Tottenham <max@tottenham.io>
Date: Tue, 19 May 2020 09:01:00 +0000
Subject: [PATCH 2/2] [PATCH] musl compat: Correct definition of
 std(out|err|in) in generated code

  * One of the generated C files contains a redefinition of stdout as:

      extern FILE* stdout;

    It also happens to include <stdio.h>, this leads to conflicting
    types for stdout as musl defines these as `extern FILE* const`.

    This patch to rfile.py fixes the generated code to emit `extern
    FILE* const` definitions.
---
 rpython/rlib/rfile.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
index c135cfb..d17c9a7 100644
--- a/rpython/rlib/rfile.py
+++ b/rpython/rlib/rfile.py
@@ -106,11 +106,11 @@ c_feof = llexternal('feof', [FILEP], rffi.INT)
 c_ferror = llexternal('ferror', [FILEP], rffi.INT)
 c_clearerr = llexternal('clearerr', [FILEP], lltype.Void)
 
-c_stdin = rffi.CExternVariable(FILEP, 'stdin', eci, c_type='FILE*',
+c_stdin = rffi.CExternVariable(FILEP, 'stdin', eci, c_type='FILE* const',
                                getter_only=True)
-c_stdout = rffi.CExternVariable(FILEP, 'stdout', eci, c_type='FILE*',
+c_stdout = rffi.CExternVariable(FILEP, 'stdout', eci, c_type='FILE* const',
                                 getter_only=True)
-c_stderr = rffi.CExternVariable(FILEP, 'stderr', eci, c_type='FILE*',
+c_stderr = rffi.CExternVariable(FILEP, 'stderr', eci, c_type='FILE* const',
                                 getter_only=True)
 
 
-- 
2.26.2