diff options
| -rw-r--r-- | builtins/bool.c | 2 | ||||
| -rw-r--r-- | builtins/bool.h | 2 | ||||
| -rw-r--r-- | builtins/integers.c | 2 | ||||
| -rw-r--r-- | builtins/integers.h | 2 | ||||
| -rw-r--r-- | builtins/memory.c | 2 | ||||
| -rw-r--r-- | builtins/memory.h | 2 | ||||
| -rw-r--r-- | builtins/nums.c | 4 | ||||
| -rw-r--r-- | builtins/nums.h | 4 | ||||
| -rw-r--r-- | builtins/string.c | 2 | ||||
| -rw-r--r-- | builtins/string.h | 2 | ||||
| -rw-r--r-- | builtins/types.c | 10 | ||||
| -rw-r--r-- | builtins/types.h | 4 |
12 files changed, 18 insertions, 20 deletions
diff --git a/builtins/bool.c b/builtins/bool.c index 774ccff9..257de6cb 100644 --- a/builtins/bool.c +++ b/builtins/bool.c @@ -23,7 +23,7 @@ public CORD Bool__as_str(const bool *b, bool colorize, const TypeInfo *type) return *b ? "yes" : "no"; } -public TypeInfo Bool = { +public const TypeInfo Bool = { .size=sizeof(bool), .align=__alignof__(bool), .tag=CustomInfo, diff --git a/builtins/bool.h b/builtins/bool.h index 2d1a6f88..5df30893 100644 --- a/builtins/bool.h +++ b/builtins/bool.h @@ -11,6 +11,6 @@ CORD Bool__as_str(const bool *b, bool colorize, const TypeInfo *type); -extern TypeInfo Bool; +extern const TypeInfo Bool; // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 diff --git a/builtins/integers.c b/builtins/integers.c index b221a8ba..ab61b3b9 100644 --- a/builtins/integers.c +++ b/builtins/integers.c @@ -48,7 +48,7 @@ } \ public const c_type KindOfInt##__min = min_val; \ public const c_type KindOfInt##__max = max_val; \ - public TypeInfo KindOfInt = { \ + public const TypeInfo KindOfInt = { \ .size=sizeof(c_type), \ .align=__alignof__(c_type), \ .tag=CustomInfo, \ diff --git a/builtins/integers.h b/builtins/integers.h index bbb92f91..85b6e928 100644 --- a/builtins/integers.h +++ b/builtins/integers.h @@ -23,7 +23,7 @@ CORD type_name ## __octal(c_type i, int64_t digits, bool prefix); \ c_type type_name ## __random(int64_t min, int64_t max); \ extern const c_type type_name ## __min, type_name##__max; \ - extern TypeInfo type_name; + extern const TypeInfo type_name; DEFINE_INT_TYPE(int64_t, Int64); DEFINE_INT_TYPE(int32_t, Int32); diff --git a/builtins/memory.c b/builtins/memory.c index bfc0b5ca..2ce2422e 100644 --- a/builtins/memory.c +++ b/builtins/memory.c @@ -21,7 +21,7 @@ public CORD Memory__as_str(const void *p, bool colorize, const TypeInfo *type) { return cord; } -public TypeInfo Memory = { +public const TypeInfo Memory = { .size=0, .align=0, .tag=CustomInfo, diff --git a/builtins/memory.h b/builtins/memory.h index 0860905a..ac041b36 100644 --- a/builtins/memory.h +++ b/builtins/memory.h @@ -5,7 +5,7 @@ #include "types.h" -extern TypeInfo Memory; +extern const TypeInfo Memory; CORD Memory__as_str(const void *p, bool colorize, const TypeInfo *type); // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 diff --git a/builtins/nums.c b/builtins/nums.c index 3f924ac3..419a3667 100644 --- a/builtins/nums.c +++ b/builtins/nums.c @@ -54,7 +54,7 @@ public bool Num64__isinf(double n) { return isinf(n); } public bool Num64__finite(double n) { return finite(n); } public bool Num64__isnan(double n) { return isnan(n); } -public TypeInfo Num64 = { +public const TypeInfo Num64 = { .size=sizeof(double), .align=__alignof__(double), .tag=CustomInfo, @@ -109,7 +109,7 @@ public bool Num32__isinf(float n) { return isinf(n); } public bool Num32__finite(float n) { return finite(n); } public bool Num32__isnan(float n) { return isnan(n); } -public TypeInfo Num32 = { +public const TypeInfo Num32 = { .size=sizeof(float), .align=__alignof__(float), .tag=CustomInfo, diff --git a/builtins/nums.h b/builtins/nums.h index 7529a5df..aeeeaa85 100644 --- a/builtins/nums.h +++ b/builtins/nums.h @@ -39,7 +39,7 @@ F(tan) F(tanh) F(tgamma) F(trunc) F(y0) F(y1) #define F(name) double (*Num64__##name)(double x, double y) = name; F(atan2) F(copysign) F(fdim) F(hypot) F(nextafter) F(pow) F(remainder) #undef F -extern TypeInfo Num64; +extern const TypeInfo Num64; CORD Num32__as_str(const float *f, bool colorize, const TypeInfo *type); int32_t Num32__compare(const float *x, const float *y, const TypeInfo *type); @@ -70,6 +70,6 @@ F(tan) F(tanh) F(tgamma) F(trunc) F(y0) F(y1) #define F(name) float (*Num32__##name)(float x, float y) = name##f; F(atan2) F(copysign) F(fdim) F(hypot) F(nextafter) F(pow) F(remainder) #undef F -extern TypeInfo Num32; +extern const TypeInfo Num32; // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 diff --git a/builtins/string.c b/builtins/string.c index 91ef5ff7..c8aaf90d 100644 --- a/builtins/string.c +++ b/builtins/string.c @@ -254,7 +254,7 @@ public CORD Str__join(CORD glue, Str_Array_t pieces) return ret; } -public TypeInfo Str = { +public const TypeInfo Str = { .size=sizeof(CORD), .align=__alignof__(CORD), .tag=CustomInfo, diff --git a/builtins/string.h b/builtins/string.h index 278a2f9c..a4bb6f2b 100644 --- a/builtins/string.h +++ b/builtins/string.h @@ -39,6 +39,6 @@ CORD Str__replace(CORD text, CORD pat, CORD replacement, int64_t limit); Str_Array_t Str__split(CORD str, CORD split); CORD Str__join(CORD glue, Str_Array_t pieces); -extern TypeInfo Str; +extern const TypeInfo Str; // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 diff --git a/builtins/types.c b/builtins/types.c index 6fe3f682..f016ae24 100644 --- a/builtins/types.c +++ b/builtins/types.c @@ -23,19 +23,15 @@ public CORD Type__as_str(const void *typeinfo, bool colorize, const TypeInfo *ty return c; } -public TypeInfo TypeInfo_info = { +public const TypeInfo TypeInfo_info = { .size=sizeof(TypeInfo), .align=__alignof__(TypeInfo), .tag=CustomInfo, .TypeInfoInfo.type_str="TypeInfo", }; -public struct { - TypeInfo type; -} Void = {.type={.size=0, .align=0}}; -public struct { - TypeInfo type; -} Abort = {.type={.size=0, .align=0}}; +public const TypeInfo Void = {.size=0, .align=0}; +public const TypeInfo Abort = {.size=0, .align=0}; public CORD Func__as_str(const void *fn, bool colorize, const TypeInfo *type) { diff --git a/builtins/types.h b/builtins/types.h index 32080975..a11a95c7 100644 --- a/builtins/types.h +++ b/builtins/types.h @@ -55,7 +55,9 @@ typedef struct TypeInfo { #define $TypeInfoInfo(typestr) &((TypeInfo){.size=sizeof(TypeInfo), .align=__alignof__(TypeInfo), \ .tag=TypeInfoInfo, .TypeInfoInfo.type_str=typestr}) -extern TypeInfo TypeInfo_info; +extern const TypeInfo TypeInfo_info; +extern const TypeInfo Void; +extern const TypeInfo Abort; CORD Type__as_str(const void *typeinfo, bool colorize, const TypeInfo *type); CORD Func__as_str(const void *fn, bool colorize, const TypeInfo *type); |
