mirror of https://github.com/xzeldon/htop.git
Resolve complation issues with -fno-common (default from gcc-10)
Extends the MakeHeader script to auto-generate correct "extern" function declarations in some cases that it currently does not. Related to https://github.com/hishamhm/htop/pull/981
This commit is contained in:
parent
402e46bb82
commit
dfd9279f87
4
CRT.c
4
CRT.c
|
@ -131,9 +131,9 @@ typedef enum ColorElements_ {
|
||||||
LAST_COLORELEMENT
|
LAST_COLORELEMENT
|
||||||
} ColorElements;
|
} ColorElements;
|
||||||
|
|
||||||
void CRT_fatalError(const char* note) __attribute__ ((noreturn));
|
extern void CRT_fatalError(const char* note) __attribute__ ((noreturn));
|
||||||
|
|
||||||
void CRT_handleSIGSEGV(int sgn);
|
extern void CRT_handleSIGSEGV(int sgn);
|
||||||
|
|
||||||
#define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A'))
|
#define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A'))
|
||||||
|
|
||||||
|
|
28
CRT.h
28
CRT.h
|
@ -119,9 +119,9 @@ typedef enum ColorElements_ {
|
||||||
LAST_COLORELEMENT
|
LAST_COLORELEMENT
|
||||||
} ColorElements;
|
} ColorElements;
|
||||||
|
|
||||||
void CRT_fatalError(const char* note) __attribute__ ((noreturn));
|
extern void CRT_fatalError(const char* note) __attribute__ ((noreturn));
|
||||||
|
|
||||||
void CRT_handleSIGSEGV(int sgn);
|
extern void CRT_handleSIGSEGV(int sgn);
|
||||||
|
|
||||||
#define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A'))
|
#define KEY_ALT(x) (KEY_F(64 - 26) + (x - 'A'))
|
||||||
|
|
||||||
|
@ -140,7 +140,7 @@ extern const char **CRT_treeStr;
|
||||||
|
|
||||||
extern int CRT_delay;
|
extern int CRT_delay;
|
||||||
|
|
||||||
int* CRT_colors;
|
extern int* CRT_colors;
|
||||||
|
|
||||||
extern int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT];
|
extern int CRT_colorSchemes[LAST_COLORSCHEME][LAST_COLORELEMENT];
|
||||||
|
|
||||||
|
@ -150,21 +150,21 @@ extern int CRT_scrollHAmount;
|
||||||
|
|
||||||
extern int CRT_scrollWheelVAmount;
|
extern int CRT_scrollWheelVAmount;
|
||||||
|
|
||||||
char* CRT_termType;
|
extern char* CRT_termType;
|
||||||
|
|
||||||
// TODO move color scheme to Settings, perhaps?
|
// TODO move color scheme to Settings, perhaps?
|
||||||
|
|
||||||
extern int CRT_colorScheme;
|
extern int CRT_colorScheme;
|
||||||
|
|
||||||
void *backtraceArray[128];
|
extern void *backtraceArray[128];
|
||||||
|
|
||||||
#if HAVE_SETUID_ENABLED
|
#if HAVE_SETUID_ENABLED
|
||||||
|
|
||||||
#define DIE(msg) do { CRT_done(); fprintf(stderr, msg); exit(1); } while(0)
|
#define DIE(msg) do { CRT_done(); fprintf(stderr, msg); exit(1); } while(0)
|
||||||
|
|
||||||
void CRT_dropPrivileges();
|
extern void CRT_dropPrivileges();
|
||||||
|
|
||||||
void CRT_restorePrivileges();
|
extern void CRT_restorePrivileges();
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -179,18 +179,18 @@ void CRT_restorePrivileges();
|
||||||
|
|
||||||
// TODO: pass an instance of Settings instead.
|
// TODO: pass an instance of Settings instead.
|
||||||
|
|
||||||
void CRT_init(int delay, int colorScheme);
|
extern void CRT_init(int delay, int colorScheme);
|
||||||
|
|
||||||
void CRT_done();
|
extern void CRT_done();
|
||||||
|
|
||||||
void CRT_fatalError(const char* note);
|
extern void CRT_fatalError(const char* note);
|
||||||
|
|
||||||
int CRT_readKey();
|
extern int CRT_readKey();
|
||||||
|
|
||||||
void CRT_disableDelay();
|
extern void CRT_disableDelay();
|
||||||
|
|
||||||
void CRT_enableDelay();
|
extern void CRT_enableDelay();
|
||||||
|
|
||||||
void CRT_setColors(int colorScheme);
|
extern void CRT_setColors(int colorScheme);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -154,7 +154,8 @@ typedef struct LinuxProcess_ {
|
||||||
|
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
long long btime; /* semi-global */
|
/* semi-global */
|
||||||
|
long long btime;
|
||||||
|
|
||||||
ProcessFieldData Process_fields[] = {
|
ProcessFieldData Process_fields[] = {
|
||||||
[0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, },
|
[0] = { .name = "", .title = NULL, .description = NULL, .flags = 0, },
|
||||||
|
|
|
@ -144,7 +144,8 @@ typedef struct LinuxProcess_ {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
long long btime; /* semi-global */
|
/* semi-global */
|
||||||
|
extern long long btime;
|
||||||
|
|
||||||
extern ProcessFieldData Process_fields[];
|
extern ProcessFieldData Process_fields[];
|
||||||
|
|
||||||
|
@ -152,9 +153,9 @@ extern ProcessPidColumn Process_pidColumns[];
|
||||||
|
|
||||||
extern ProcessClass LinuxProcess_class;
|
extern ProcessClass LinuxProcess_class;
|
||||||
|
|
||||||
LinuxProcess* LinuxProcess_new(Settings* settings);
|
extern LinuxProcess* LinuxProcess_new(Settings* settings);
|
||||||
|
|
||||||
void Process_delete(Object* cast);
|
extern void Process_delete(Object* cast);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
[1] Note that before kernel 2.6.26 a process that has not asked for
|
[1] Note that before kernel 2.6.26 a process that has not asked for
|
||||||
|
@ -166,19 +167,19 @@ extern io_priority;
|
||||||
*/
|
*/
|
||||||
#define LinuxProcess_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->super.nice + 20) / 5) : p_->ioPriority)
|
#define LinuxProcess_effectiveIOPriority(p_) (IOPriority_class(p_->ioPriority) == IOPRIO_CLASS_NONE ? IOPriority_tuple(IOPRIO_CLASS_BE, (p_->super.nice + 20) / 5) : p_->ioPriority)
|
||||||
|
|
||||||
IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this);
|
extern IOPriority LinuxProcess_updateIOPriority(LinuxProcess* this);
|
||||||
|
|
||||||
bool LinuxProcess_setIOPriority(LinuxProcess* this, IOPriority ioprio);
|
extern bool LinuxProcess_setIOPriority(LinuxProcess* this, IOPriority ioprio);
|
||||||
|
|
||||||
#ifdef HAVE_DELAYACCT
|
#ifdef HAVE_DELAYACCT
|
||||||
void LinuxProcess_printDelay(float delay_percent, char* buffer, int n);
|
extern void LinuxProcess_printDelay(float delay_percent, char* buffer, int n);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field);
|
extern void LinuxProcess_writeField(Process* this, RichString* str, ProcessField field);
|
||||||
|
|
||||||
long LinuxProcess_compare(const void* v1, const void* v2);
|
extern long LinuxProcess_compare(const void* v1, const void* v2);
|
||||||
|
|
||||||
bool Process_isThread(Process* this);
|
extern bool Process_isThread(Process* this);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -54,8 +54,10 @@ for line in file.readlines():
|
||||||
elif line.startswith("typedef struct"):
|
elif line.startswith("typedef struct"):
|
||||||
state = SKIP
|
state = SKIP
|
||||||
elif line[-1] == "{":
|
elif line[-1] == "{":
|
||||||
out.write( line[:-2].replace("inline", "extern") + ";\n" )
|
out.write("extern " + line[:-2].replace("inline ", "") + ";\n")
|
||||||
state = SKIP
|
state = SKIP
|
||||||
|
elif line[-1] == ";":
|
||||||
|
out.write("extern " + line + "\n")
|
||||||
else:
|
else:
|
||||||
out.write( line + "\n")
|
out.write( line + "\n")
|
||||||
is_blank = False
|
is_blank = False
|
||||||
|
|
Loading…
Reference in New Issue