FAQ
Reviewers: minux, rsc,

Message:
Hello minux.ma@gmail.com, rsc@golang.org (cc:
golang-dev@googlegroups.com),

I'd like you to review this change to
https://code.google.com/p/go/


Description:
all: cleanup C function prototypes

Please review this at https://codereview.appspot.com/7313070/

Affected files:
M src/cmd/dist/windows.c
M src/cmd/ld/dwarf.c
M src/cmd/prof/main.c
M src/lib9/main.c
M src/lib9/utf/rune.c
M src/lib9/windows.c
M src/libmach/sym.c
M src/pkg/runtime/cgo/gcc_freebsd_arm.c
M src/pkg/runtime/cgo/gcc_linux_arm.c
M src/pkg/runtime/cpuprof.c
M src/pkg/runtime/race0.c
M src/pkg/runtime/signal_freebsd_arm.c
M src/pkg/runtime/signal_linux_arm.c
M src/pkg/runtime/vdso_linux_amd64.c


Index: src/cmd/dist/windows.c
===================================================================
--- a/src/cmd/dist/windows.c
+++ b/src/cmd/dist/windows.c
@@ -852,7 +852,8 @@
}

void
-errprintf(char *fmt, ...) {
+errprintf(char *fmt, ...)
+{
va_list arg;
char *p;
DWORD n, w;
Index: src/cmd/ld/dwarf.c
===================================================================
--- a/src/cmd/ld/dwarf.c
+++ b/src/cmd/ld/dwarf.c
@@ -1936,7 +1936,8 @@
* because we need die->offs and infoo/infosize;
*/
static int
-ispubname(DWDie *die) {
+ispubname(DWDie *die)
+{
DWAttr *a;

switch(die->abbrev) {
@@ -1949,7 +1950,8 @@
}

static int
-ispubtype(DWDie *die) {
+ispubtype(DWDie *die)
+{
return die->abbrev >= DW_ABRV_NULLTYPE;
}

Index: src/cmd/prof/main.c
===================================================================
--- a/src/cmd/prof/main.c
+++ b/src/cmd/prof/main.c
@@ -172,7 +172,8 @@
}

uvlong
-amd64_uregSP(void) {
+amd64_uregSP(void)
+{
return ureg_amd64.sp;
}

Index: src/lib9/main.c
===================================================================
--- a/src/lib9/main.c
+++ b/src/lib9/main.c
@@ -30,7 +30,9 @@
#ifdef WIN32
#include <windows.h>

-static void crashhandler(int sig) {
+static void
+crashhandler(int sig)
+{
USED(sig);
fprint(2, "%s: internal fatal error.\n", argv0);
exit(1);
Index: src/lib9/utf/rune.c
===================================================================
--- a/src/lib9/utf/rune.c
+++ b/src/lib9/utf/rune.c
@@ -247,7 +247,8 @@
}

int
-isvalidcharntorune(const char* str, int length, Rune* rune, int* consumed)
{
+isvalidcharntorune(const char* str, int length, Rune* rune, int* consumed)
+{
*consumed = charntorune(rune, str, length);
return *rune != Runeerror || *consumed == 3;
}
Index: src/lib9/windows.c
===================================================================
--- a/src/lib9/windows.c
+++ b/src/lib9/windows.c
@@ -5,22 +5,26 @@
#include <u.h>
#include <libc.h>

-int fork()
+int
+fork(void)
{
return -1;
}

-int p9rfork(int flags)
+int
+p9rfork(int flags)
{
return -1;
}

-Waitmsg *p9wait()
+Waitmsg*
+p9wait(void)
{
return 0;
}

-int p9waitpid()
+int
+p9waitpid(void)
{
return -1;
}
Index: src/libmach/sym.c
===================================================================
--- a/src/libmach/sym.c
+++ b/src/libmach/sym.c
@@ -591,7 +591,8 @@
* strcmp, but allow '_' to match center dot (rune 00b7 == bytes c2 b7)
*/
int
-cdotstrcmp(char *sym, char *user) {
+cdotstrcmp(char *sym, char *user)
+{
for (;;) {
while (*sym == *user) {
if (*sym++ == '\0')
Index: src/pkg/runtime/cgo/gcc_freebsd_arm.c
===================================================================
--- a/src/pkg/runtime/cgo/gcc_freebsd_arm.c
+++ b/src/pkg/runtime/cgo/gcc_freebsd_arm.c
@@ -18,7 +18,10 @@
void __aeabi_read_tp(void) __attribute__((naked));
void cgo_tls_set_gm(void) __attribute__((naked));
void cgo_tls_get_gm(void) __attribute__((naked));
-void __aeabi_read_tp(void) {
+
+void
+__aeabi_read_tp(void)
+{
// read @ 0xffff1000
__asm__ __volatile__ (
"ldr r0, =0xffff1000\n\t"
@@ -26,8 +29,11 @@
"mov pc, lr\n\t"
);
}
+
// g (R10) at 8(TP), m (R9) at 12(TP)
-void cgo_tls_get_gm(void) {
+void
+cgo_tls_get_gm(void)
+{
__asm__ __volatile__ (
"push {lr}\n\t"
"bl __aeabi_read_tp\n\t"
@@ -36,7 +42,10 @@
"pop {pc}\n\t"
);
}
-void cgo_tls_set_gm(void) {
+
+void
+cgo_tls_set_gm(void)
+{
__asm__ __volatile__ (
"push {lr}\n\t"
"bl __aeabi_read_tp\n\t"
@@ -45,6 +54,7 @@
"pop {pc}\n\t"
);
}
+
// both cgo_tls_{get,set}_gm can be called from runtime
void (*cgo_load_gm)(void) = cgo_tls_get_gm;
void (*cgo_save_gm)(void) = cgo_tls_set_gm;
Index: src/pkg/runtime/cgo/gcc_linux_arm.c
===================================================================
--- a/src/pkg/runtime/cgo/gcc_linux_arm.c
+++ b/src/pkg/runtime/cgo/gcc_linux_arm.c
@@ -18,7 +18,10 @@
void __aeabi_read_tp(void) __attribute__((naked));
void cgo_tls_set_gm(void) __attribute__((naked));
void cgo_tls_get_gm(void) __attribute__((naked));
-void __aeabi_read_tp(void) {
+
+void
+__aeabi_read_tp(void)
+{
// b __kuser_get_tls @ 0xffff0fe0
__asm__ __volatile__ (
"mvn r0, #0xf000\n\t"
@@ -26,8 +29,11 @@
"nop\n\tnop\n\t"
);
}
+
// g (R10) at 8(TP), m (R9) at 12(TP)
-void cgo_tls_get_gm(void) {
+void
+cgo_tls_get_gm(void)
+{
__asm__ __volatile__ (
"push {lr}\n\t"
"bl __aeabi_read_tp\n\t"
@@ -36,7 +42,10 @@
"pop {pc}\n\t"
);
}
-void cgo_tls_set_gm(void) {
+
+void
+cgo_tls_set_gm(void)
+{
__asm__ __volatile__ (
"push {lr}\n\t"
"bl __aeabi_read_tp\n\t"
@@ -45,6 +54,7 @@
"pop {pc}\n\t"
);
}
+
// both cgo_tls_{get,set}_gm can be called from runtime
void (*cgo_load_gm)(void) = cgo_tls_get_gm;
void (*cgo_save_gm)(void) = cgo_tls_set_gm;
Index: src/pkg/runtime/cpuprof.c
===================================================================
--- a/src/pkg/runtime/cpuprof.c
+++ b/src/pkg/runtime/cpuprof.c
@@ -115,7 +115,9 @@
// LostProfileData is a no-op function used in profiles
// to mark the number of profiling stack traces that were
// discarded due to slow data writers.
-static void LostProfileData(void) {
+static void
+LostProfileData(void)
+{
}

// SetCPUProfileRate sets the CPU profiling rate.
Index: src/pkg/runtime/race0.c
===================================================================
--- a/src/pkg/runtime/race0.c
+++ b/src/pkg/runtime/race0.c
@@ -128,6 +128,6 @@
}

void
-runtime·racegoend()
+runtime·racegoend(void)
{
}
Index: src/pkg/runtime/signal_freebsd_arm.c
===================================================================
--- a/src/pkg/runtime/signal_freebsd_arm.c
+++ b/src/pkg/runtime/signal_freebsd_arm.c
@@ -170,7 +170,8 @@

#pragma textflag 7
int64
-runtime·cputicks() {
+runtime·cputicks(void)
+{
// Currently cputicks() is used in blocking profiler and to seed
runtime·fastrand1().
// runtime·nanotime() is a poor approximation of CPU ticks that is enough
for the profiler.
// TODO: need more entropy to better seed fastrand1.
Index: src/pkg/runtime/signal_linux_arm.c
===================================================================
--- a/src/pkg/runtime/signal_linux_arm.c
+++ b/src/pkg/runtime/signal_linux_arm.c
@@ -220,7 +220,8 @@

#pragma textflag 7
int64
-runtime·cputicks() {
+runtime·cputicks(void)
+{
// Currently cputicks() is used in blocking profiler and to seed
runtime·fastrand1().
// runtime·nanotime() is a poor approximation of CPU ticks that is enough
for the profiler.
// runtime·randomNumber provides better seeding of fastrand1.
Index: src/pkg/runtime/vdso_linux_amd64.c
===================================================================
--- a/src/pkg/runtime/vdso_linux_amd64.c
+++ b/src/pkg/runtime/vdso_linux_amd64.c
@@ -170,7 +170,9 @@
{ (byte*)"__vdso_clock_gettime", &runtime·__vdso_clock_gettime_sym },
};

-static void vdso_init_from_sysinfo_ehdr(struct vdso_info *vdso_info,
Elf64_Ehdr* hdr) {
+static void
+vdso_init_from_sysinfo_ehdr(struct vdso_info *vdso_info, Elf64_Ehdr* hdr)
+{
uint64 i;
bool found_vaddr = false;

@@ -237,7 +239,9 @@
vdso_info->valid = true;
}

-static int32 vdso_find_version(struct vdso_info *vdso_info, version_key*
ver) {
+static int32
+vdso_find_version(struct vdso_info *vdso_info, version_key* ver)
+{
if(vdso_info->valid == false) {
return 0;
}
@@ -259,7 +263,9 @@
return 0;
}

-static void vdso_parse_symbols(struct vdso_info *vdso_info, int32 version)
{
+static void
+vdso_parse_symbols(struct vdso_info *vdso_info, int32 version)
+{
int32 i, j;

if(vdso_info->valid == false)


--

---
You received this message because you are subscribed to the Google Groups "golang-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Minux Ma at Feb 10, 2013 at 5:24 pm
    LGTM if you're sure you've fixed all the problems :-)

    https://codereview.appspot.com/7313070/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Anthony Martin at Feb 10, 2013 at 6:27 pm

    minux.ma@gmail.com once said:
    LGTM if you're sure you've fixed all the problems :-)
    I think so, if grep hasn't failed me.

    A few files in test/bench/shootout could be changed
    to use our style but I decided against it.

    Anthony

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Minux at Feb 10, 2013 at 6:32 pm

    On Mon, Feb 11, 2013 at 2:27 AM, Anthony Martin wrote:
    A few files in test/bench/shootout could be changed
    to use our style but I decided against it.
    They are external code so i agree with you. let's wait for rsc.

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Akshat Kumar at Feb 10, 2013 at 7:27 pm
    By the way, semantic transformation tools can be quite useful
    for this type of task; a good example is Coccinelle:

    https://github.com/coccinelle/coccinelle
    On 10 February 2013 10:31, minux wrote:
    On Mon, Feb 11, 2013 at 2:27 AM, Anthony Martin wrote:

    A few files in test/bench/shootout could be changed
    to use our style but I decided against it.
    They are external code so i agree with you. let's wait for rsc.

    --

    ---
    You received this message because you are subscribed to the Google Groups
    "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an
    email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Anthony Martin at Feb 13, 2013 at 1:46 am
    PTAL

    I added the changes to the new runtime/cgo/gcc_netbsd_arm.c file.

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Anthony Martin at Feb 20, 2013 at 2:00 am

    minux once said:
    On Mon, Feb 11, 2013 at 2:27 AM, Anthony Martin wrote:

    A few files in test/bench/shootout could be changed
    to use our style but I decided against it.
    They are external code so i agree with you. let's wait for rsc.
    Russ, do you want me to also change the files in
    test/bench/shootout?

    Thanks,
    Anthony

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Brad Fitzpatrick at Feb 20, 2013 at 2:27 am

    On Tue, Feb 19, 2013 at 5:55 PM, Anthony Martin wrote:

    minux <minux.ma@gmail.com> once said:
    On Mon, Feb 11, 2013 at 2:27 AM, Anthony Martin wrote:

    A few files in test/bench/shootout could be changed
    to use our style but I decided against it.
    They are external code so i agree with you. let's wait for rsc.
    Russ, do you want me to also change the files in
    test/bench/shootout?
    I would imagine not, since they're not our code. I think those are all
    just mirrors of upstream's shootout code.

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Minux Ma at Feb 13, 2013 at 4:37 pm
    LGTM.

    https://codereview.appspot.com/7313070/

    --

    ---
    You received this message because you are subscribed to the Google Groups "golang-dev" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-dev+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-dev @
categoriesgo
postedFeb 10, '13 at 3:12a
activeFeb 20, '13 at 2:27a
posts9
users4
websitegolang.org

People

Translate

site design / logo © 2022 Grokbase