Skip to content

Commit

Permalink
Remove uses of deprecated callconv aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
linusg committed Mar 5, 2025
1 parent 05937b3 commit 79460d4
Show file tree
Hide file tree
Showing 251 changed files with 826 additions and 822 deletions.
2 changes: 1 addition & 1 deletion doc/langref/export_builtin.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ comptime {
@export(&internalName, .{ .name = "foo", .linkage = .strong });
}

fn internalName() callconv(.C) void {}
fn internalName() callconv(.c) void {}

// obj
2 changes: 1 addition & 1 deletion doc/langref/test_defining_variadic_function.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const std = @import("std");
const testing = std.testing;
const builtin = @import("builtin");

fn add(count: c_int, ...) callconv(.C) c_int {
fn add(count: c_int, ...) callconv(.c) c_int {
var ap = @cVaStart();
defer @cVaEnd(&ap);
var i: usize = 0;
Expand Down
2 changes: 1 addition & 1 deletion doc/langref/test_functions.zig
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn abort() noreturn {

// The naked calling convention makes a function not have any function prologue or epilogue.
// This can be useful when integrating with assembly.
fn _start() callconv(.Naked) noreturn {
fn _start() callconv(.naked) noreturn {
abort();
}

Expand Down
2 changes: 1 addition & 1 deletion doc/langref/test_opaque.zig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const Derp = opaque {};
const Wat = opaque {};

extern fn bar(d: *Derp) void;
fn foo(w: *Wat) callconv(.C) void {
fn foo(w: *Wat) callconv(.c) void {
bar(w);
}

Expand Down
18 changes: 9 additions & 9 deletions lib/c.zig
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ pub fn panic(msg: []const u8, error_return_trace: ?*std.builtin.StackTrace, _: ?
}

extern fn main(argc: c_int, argv: [*:null]?[*:0]u8) c_int;
fn wasm_start() callconv(.C) void {
fn wasm_start() callconv(.c) void {
_ = main(0, undefined);
}

fn strcpy(dest: [*:0]u8, src: [*:0]const u8) callconv(.C) [*:0]u8 {
fn strcpy(dest: [*:0]u8, src: [*:0]const u8) callconv(.c) [*:0]u8 {
var i: usize = 0;
while (src[i] != 0) : (i += 1) {
dest[i] = src[i];
Expand All @@ -76,7 +76,7 @@ test "strcpy" {
try std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.sliceTo(&s1, 0));
}

fn strncpy(dest: [*:0]u8, src: [*:0]const u8, n: usize) callconv(.C) [*:0]u8 {
fn strncpy(dest: [*:0]u8, src: [*:0]const u8, n: usize) callconv(.c) [*:0]u8 {
var i: usize = 0;
while (i < n and src[i] != 0) : (i += 1) {
dest[i] = src[i];
Expand All @@ -96,7 +96,7 @@ test "strncpy" {
try std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.sliceTo(&s1, 0));
}

fn strcat(dest: [*:0]u8, src: [*:0]const u8) callconv(.C) [*:0]u8 {
fn strcat(dest: [*:0]u8, src: [*:0]const u8) callconv(.c) [*:0]u8 {
var dest_end: usize = 0;
while (dest[dest_end] != 0) : (dest_end += 1) {}

Expand All @@ -119,7 +119,7 @@ test "strcat" {
try std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.sliceTo(&s1, 0));
}

fn strncat(dest: [*:0]u8, src: [*:0]const u8, avail: usize) callconv(.C) [*:0]u8 {
fn strncat(dest: [*:0]u8, src: [*:0]const u8, avail: usize) callconv(.c) [*:0]u8 {
var dest_end: usize = 0;
while (dest[dest_end] != 0) : (dest_end += 1) {}

Expand All @@ -142,19 +142,19 @@ test "strncat" {
try std.testing.expectEqualSlices(u8, "foobarbaz", std.mem.sliceTo(&s1, 0));
}

fn strcmp(s1: [*:0]const u8, s2: [*:0]const u8) callconv(.C) c_int {
fn strcmp(s1: [*:0]const u8, s2: [*:0]const u8) callconv(.c) c_int {
return switch (std.mem.orderZ(u8, s1, s2)) {
.lt => -1,
.eq => 0,
.gt => 1,
};
}

fn strlen(s: [*:0]const u8) callconv(.C) usize {
fn strlen(s: [*:0]const u8) callconv(.c) usize {
return std.mem.len(s);
}

fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) callconv(.C) c_int {
fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) callconv(.c) c_int {
if (_n == 0) return 0;
var l = _l;
var r = _r;
Expand All @@ -167,7 +167,7 @@ fn strncmp(_l: [*:0]const u8, _r: [*:0]const u8, _n: usize) callconv(.C) c_int {
return @as(c_int, l[0]) - @as(c_int, r[0]);
}

fn strerror(errnum: c_int) callconv(.C) [*:0]const u8 {
fn strerror(errnum: c_int) callconv(.c) [*:0]const u8 {
_ = errnum;
return "TODO strerror implementation";
}
Expand Down
4 changes: 2 additions & 2 deletions lib/compiler/test_runner.zig
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ var is_fuzz_test: bool = undefined;
extern fn fuzzer_set_name(name_ptr: [*]const u8, name_len: usize) void;
extern fn fuzzer_init(cache_dir: FuzzerSlice) void;
extern fn fuzzer_init_corpus_elem(input_ptr: [*]const u8, input_len: usize) void;
extern fn fuzzer_start(testOne: *const fn ([*]const u8, usize) callconv(.C) void) void;
extern fn fuzzer_start(testOne: *const fn ([*]const u8, usize) callconv(.c) void) void;
extern fn fuzzer_coverage_id() u64;

pub fn fuzz(
Expand Down Expand Up @@ -382,7 +382,7 @@ pub fn fuzz(
const global = struct {
var ctx: @TypeOf(context) = undefined;

fn fuzzer_one(input_ptr: [*]const u8, input_len: usize) callconv(.C) void {
fn fuzzer_one(input_ptr: [*]const u8, input_len: usize) callconv(.c) void {
@disableInstrumentation();
testing.allocator_instance = .{};
defer if (testing.allocator_instance.deinit() == .leak) std.process.exit(1);
Expand Down
Loading

0 comments on commit 79460d4

Please sign in to comment.