Skip to content

Commit 91c1c59

Browse files
committed
runtime/cgo: use //go:build lines in C and assembly files
Replace deprecated // +build lines by their respective //go:build line counterpart. Also remove build constraints implied by file name or type. Change-Id: I8d18cd40071ca28d7654da8f0d22841f43729ca6 Reviewed-on: https://go-review.googlesource.com/c/go/+/460538 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Tobias Klauser <[email protected]> Reviewed-by: Cherry Mui <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]>
1 parent 0b3f58c commit 91c1c59

24 files changed

+18
-39
lines changed

src/runtime/cgo/asm_mips64x.s

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build mips64 || mips64le
6-
// +build mips64 mips64le
76

87
#include "textflag.h"
98

src/runtime/cgo/asm_mipsx.s

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build mips || mipsle
6-
// +build mips mipsle
76

87
#include "textflag.h"
98

src/runtime/cgo/asm_ppc64x.s

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// license that can be found in the LICENSE file.
44

55
//go:build ppc64 || ppc64le
6-
// +build ppc64 ppc64le
76

87
#include "textflag.h"
98
#include "asm_ppc64x.h"

src/runtime/cgo/gcc_aix_ppc64.S

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build ppc64
6-
// +build aix
7-
85
.file "gcc_aix_ppc64.S"
96

107
/*

src/runtime/cgo/gcc_aix_ppc64.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build aix
6-
// +build ppc64 ppc64le
7-
85
/*
96
* On AIX, call to _cgo_topofstack and Go main are forced to be a longcall.
107
* Without it, ld might add trampolines in the middle of .text section

src/runtime/cgo/gcc_context.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build cgo
6-
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris windows
5+
//go:build unix || windows
76

87
#include "libcgo.h"
98

src/runtime/cgo/gcc_fatalf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build aix !android,linux freebsd
5+
//go:build aix || (!android && linux) || freebsd
66

77
#include <stdarg.h>
88
#include <stdio.h>

src/runtime/cgo/gcc_freebsd_sigaction.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build freebsd,amd64
5+
//go:build freebsd && amd64
66

77
#include <errno.h>
88
#include <stddef.h>

src/runtime/cgo/gcc_libinit.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build cgo
6-
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
5+
//go:build unix
76

87
#include <pthread.h>
98
#include <errno.h>

src/runtime/cgo/gcc_libinit_windows.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build cgo
6-
75
#define WIN32_LEAN_AND_MEAN
86
#include <windows.h>
97
#include <process.h>

src/runtime/cgo/gcc_linux_mips64x.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build cgo
6-
// +build linux
7-
// +build mips64 mips64le
5+
//go:build mips64 || mips64le
86

97
#include <pthread.h>
108
#include <string.h>

src/runtime/cgo/gcc_linux_mipsx.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build cgo
6-
// +build linux
7-
// +build mips mipsle
5+
//go:build mips || mipsle
86

97
#include <pthread.h>
108
#include <string.h>

src/runtime/cgo/gcc_linux_ppc64x.S

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build ppc64 ppc64le
6-
// +build linux
5+
//go:build linux && (ppc64 || ppc64le)
76

87
.file "gcc_linux_ppc64x.S"
98

src/runtime/cgo/gcc_mips64x.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build mips64 mips64le
5+
//go:build mips64 || mips64le
66

77
.file "gcc_mips64x.S"
88

src/runtime/cgo/gcc_mipsx.S

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build mips mipsle
5+
//go:build mips || mipsle
66

77
.file "gcc_mipsx.S"
88

src/runtime/cgo/gcc_mmap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build linux,amd64 linux,arm64 linux,ppc64le freebsd,amd64
5+
//go:build (linux && (amd64 || arm64 || ppc64le)) || (freebsd && amd64)
66

77
#include <errno.h>
88
#include <stdint.h>

src/runtime/cgo/gcc_ppc64x.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build ppc64 ppc64le
5+
//go:build ppc64 || ppc64le
66

77
#include <pthread.h>
88
#include <string.h>

src/runtime/cgo/gcc_setenv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build cgo
6-
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
5+
//go:build unix
76

87
#include "libcgo.h"
98

src/runtime/cgo/gcc_sigaction.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build linux,amd64 linux,arm64 linux,ppc64le
5+
//go:build linux && (amd64 || arm64 || ppc64le)
66

77
#include <errno.h>
88
#include <stddef.h>

src/runtime/cgo/gcc_signal2_ios_arm64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build lldb
5+
//go:build lldb
66

77
// Used by gcc_signal_darwin_arm64.c when doing the test build during cgo.
88
// We hope that for real binaries the definition provided by Go will take precedence

src/runtime/cgo/gcc_signal_ios_arm64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
//
1818
// The dist tool enables this by build flag when testing.
1919

20-
// +build lldb
20+
//go:build lldb
2121

2222
#include <limits.h>
2323
#include <pthread.h>

src/runtime/cgo/gcc_signal_ios_nolldb.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build !lldb
6-
// +build ios
7-
// +build arm64
5+
//go:build !lldb && ios && arm64
86

97
#include <stdint.h>
108

src/runtime/cgo/gcc_traceback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build cgo,darwin cgo,linux
5+
//go:build darwin || linux
66

77
#include <stdint.h>
88
#include "libcgo.h"

src/runtime/cgo/linux_syscall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build linux
5+
//go:build linux
66

77
#ifndef _GNU_SOURCE // setres[ug]id() API.
88
#define _GNU_SOURCE

0 commit comments

Comments
 (0)