Skip to content

Commit 7027f50

Browse files
Denton-Lgitster
authored andcommitted
compat/*.[ch]: remove extern from function declarations using spatch
In 5545442 (*.[ch]: remove extern from function declarations using spatch, 2019-04-29), we removed externs from function declarations using spatch but we intentionally excluded files under compat/ since some are directly copied from an upstream and we should avoid churning them so that manually merging future updates will be simpler. In the last commit, we determined the files which taken from an upstream so we can exclude them and run spatch on the remainder. This was the Coccinelle patch used: @@ type T; identifier f; @@ - extern T f(...); and it was run with: $ git ls-files compat/\*\*.{c,h} | xargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place $ git checkout -- \ compat/regex/ \ compat/inet_ntop.c \ compat/inet_pton.c \ compat/nedmalloc/ \ compat/obstack.{c,h} \ compat/poll/ Coccinelle has some trouble dealing with `__attribute__` and varargs so we ran the following to ensure that no remaining changes were left behind: $ git ls-files compat/\*\*.{c,h} | xargs sed -i'' -e 's/^\(\s*\)extern \([^(]*([^*]\)/\1\2/' $ git checkout -- \ compat/regex/ \ compat/inet_ntop.c \ compat/inet_pton.c \ compat/nedmalloc/ \ compat/obstack.{c,h} \ compat/poll/ Signed-off-by: Denton Liu <[email protected]> Acked-by: Johannes Schindelin <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 552fc50 commit 7027f50

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

compat/mingw.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ typedef _sigset_t sigset_t;
1111
#undef _POSIX_THREAD_SAFE_FUNCTIONS
1212
#endif
1313

14-
extern int mingw_core_config(const char *var, const char *value, void *cb);
14+
int mingw_core_config(const char *var, const char *value, void *cb);
1515
#define platform_core_config mingw_core_config
1616

1717
/*
@@ -443,7 +443,7 @@ static inline void convert_slashes(char *path)
443443
*path = '/';
444444
}
445445
#define PATH_SEP ';'
446-
extern char *mingw_query_user_email(void);
446+
char *mingw_query_user_email(void);
447447
#define query_user_email mingw_query_user_email
448448
#if !defined(__MINGW64_VERSION_MAJOR) && (!defined(_MSC_VER) || _MSC_VER < 1800)
449449
#define PRIuMAX "I64u"
@@ -580,4 +580,4 @@ int main(int argc, const char **argv);
580580
/*
581581
* Used by Pthread API implementation for Windows
582582
*/
583-
extern int err_win_to_posix(DWORD winerr);
583+
int err_win_to_posix(DWORD winerr);

compat/win32/pthread.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ typedef struct {
5050
DWORD tid;
5151
} pthread_t;
5252

53-
extern int pthread_create(pthread_t *thread, const void *unused,
53+
int pthread_create(pthread_t *thread, const void *unused,
5454
void *(*start_routine)(void*), void *arg);
5555

5656
/*
@@ -59,10 +59,10 @@ extern int pthread_create(pthread_t *thread, const void *unused,
5959
*/
6060
#define pthread_join(a, b) win32_pthread_join(&(a), (b))
6161

62-
extern int win32_pthread_join(pthread_t *thread, void **value_ptr);
62+
int win32_pthread_join(pthread_t *thread, void **value_ptr);
6363

6464
#define pthread_equal(t1, t2) ((t1).tid == (t2).tid)
65-
extern pthread_t pthread_self(void);
65+
pthread_t pthread_self(void);
6666

6767
static inline void NORETURN pthread_exit(void *ret)
6868
{

0 commit comments

Comments
 (0)