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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
$NetBSD: patch-hcc_hcc_hc,v 1.1 2011/12/20 16:18:16 dholland Exp $
- use standard headers
- don't croak on platforms where char is unsigned
- const correctness demanded by recent gcc
- declare main's return type
- should match patch-ag
--- hcc/hcc.hc.orig 2011-12-20 14:59:27.000000000 +0000
+++ hcc/hcc.hc
@@ -1,6 +1,5 @@
-#include "bool.h"
#include "stdio.h"
-#include "std.h"
+#include "stdlib.h"
#include "string.h"
#include "ctype.h"
@@ -39,7 +38,7 @@ FILE *src;
-void f_open (FILE *&f, char name [], char mode [])
+void f_open (FILE *&f, const char name [], const char mode [])
{f = fopen (name, mode);
check_error;
@@ -53,7 +52,7 @@ void f_open (FILE *&f, char name [], cha
}
-char *substring (char s [], int from)
+char *substring (const char s [], int from)
{static bool is_init = false;
static char *result;
@@ -74,7 +73,7 @@ char *substring (char s [], int from)
}
-char *substring (char s [], int from, int to)
+char *substring (const char s [], int from, int to)
{static bool is_init = false;
static char *result;
@@ -101,8 +100,8 @@ char *substring (char s [], int from, in
void changeall (char s [],
int max_length_of_s,
- char tmplate [],
- char replacement [])
+ const char tmplate [],
+ const char replacement [])
{char *pos;
@@ -147,7 +146,7 @@ void changeall (char s [],
}
-char *complete (char name [], char tail [])
+char *complete (const char name [], const char tail [])
{static char r [256];
strcpy (r, name);
@@ -198,7 +197,7 @@ void dump_line_cor ()
};
}
-void pass_1_error (int line_no, char msg [], int l)
+void pass_1_error (int line_no, const char msg [], int l)
{char err_msg [256];
char ii [128];
@@ -210,7 +209,7 @@ void pass_1_error (int line_no, char msg
exit (1);
}
-void pass_1_error (int line_no, char msg [])
+void pass_1_error (int line_no, const char msg [])
{fclose (src);
printf ("error : %d : %s\n", line_no, msg);
exit (1);
@@ -226,7 +225,7 @@ bool pass_1 (char src_name [])
char last_last_sym;
int last_ref_sym_line;
int last_ref_sym_no;
- char sym;
+ signed char sym;
int nested_brackets;
bool inside_refinement;
bool inside_string;
@@ -883,7 +882,7 @@ void pass_3 (char src_name [])
}
-main (int num_params, char *shell_params [])
+int main (int num_params, char *shell_params [])
{char gcc_exec [256];
char src_name [256];
char options [256];
|