mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 09:55:29 +02:00
Bug 568079: Activate -Wall -pedantic and fix warnings
Change-Id: I7dac7f9d90dd65cfbff241f9b778bc5ff6bc9db6 Signed-off-by: Torbjörn Svensson <azoff@svenskalinuxforeningen.se>
This commit is contained in:
parent
570c5b7ff0
commit
908aa33b91
18 changed files with 29 additions and 41 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -26,6 +26,7 @@ OS_DIR_LINUX_PPC64LE := ../../org.eclipse.cdt.core.linux.ppc64le/os/linux/ppc64l
|
|||
OS_DIR_MACOS_X86_64 := ../../org.eclipse.cdt.core.macosx/os/macosx/x86_64
|
||||
OS_DIR_MACOS_X86 := ../../org.eclipse.cdt.core.macosx/os/macosx/x86
|
||||
|
||||
COMMON_CFLAGS := -Wall -pedantic
|
||||
|
||||
UNAME = $(shell uname)
|
||||
ifeq ($(UNAME),Linux)
|
||||
|
@ -74,7 +75,7 @@ rebuild: clean all
|
|||
$(OS_DIR_WIN32_X86_64)/starter.exe: win/starter.c
|
||||
mkdir -p $(dir $@) && \
|
||||
$(REPRODUCIBLE_BUILD_WRAPPER) \
|
||||
x86_64-w64-mingw32-gcc -o $@ -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
|
||||
x86_64-w64-mingw32-gcc $(COMMON_CFLAGS) -o $@ -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
|
||||
-DUNICODE \
|
||||
$^ \
|
||||
-lpsapi
|
||||
|
@ -82,7 +83,7 @@ $(OS_DIR_WIN32_X86_64)/starter.exe: win/starter.c
|
|||
$(OS_DIR_WIN32_X86_64)/spawner.dll: win/iostream.c win/raise.c win/spawner.c win/Win32ProcessEx.c
|
||||
mkdir -p $(dir $@) && \
|
||||
$(REPRODUCIBLE_BUILD_WRAPPER) \
|
||||
x86_64-w64-mingw32-gcc -o $@ -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
|
||||
x86_64-w64-mingw32-gcc $(COMMON_CFLAGS) -o $@ -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
|
||||
-DUNICODE \
|
||||
$^ \
|
||||
-Wl,--kill-at --shared
|
||||
|
@ -90,7 +91,7 @@ $(OS_DIR_WIN32_X86_64)/spawner.dll: win/iostream.c win/raise.c win/spawner.c win
|
|||
$(OS_DIR_WIN32_X86_64)/pty.dll: win/pty.cpp win/pty_dllmain.cpp
|
||||
mkdir -p $(dir $@) && \
|
||||
$(REPRODUCIBLE_BUILD_WRAPPER) \
|
||||
x86_64-w64-mingw32-g++ -o $@ -Iinclude -Iwin/include -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
|
||||
x86_64-w64-mingw32-g++ $(COMMON_CFLAGS) -o $@ -Iinclude -Iwin/include -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" \
|
||||
-DUNICODE \
|
||||
$^ \
|
||||
-Wl,--kill-at --shared -L$(OS_DIR_WIN32_X86_64) -lwinpty -static-libstdc++ -static-libgcc
|
||||
|
@ -98,14 +99,14 @@ $(OS_DIR_WIN32_X86_64)/pty.dll: win/pty.cpp win/pty_dllmain.cpp
|
|||
# Linux x86_64
|
||||
$(OS_DIR_LINUX_X86_64)/libspawner.so: unix/spawner.c unix/io.c unix/exec_unix.c unix/exec_pty.c unix/openpty.c unix/pfind.c
|
||||
mkdir -p $(dir $@) && \
|
||||
gcc -m64 -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
x86_64-linux-gnu-gcc $(COMMON_CFLAGS) -m64 -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
-D_REENTRANT -D_GNU_SOURCE \
|
||||
$^ \
|
||||
-shared -lc
|
||||
|
||||
$(OS_DIR_LINUX_X86_64)/libpty.so: unix/openpty.c unix/pty.c unix/ptyio.c
|
||||
mkdir -p $(dir $@) && \
|
||||
gcc -m64 -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
x86_64-linux-gnu-gcc $(COMMON_CFLAGS) -m64 -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
-D_REENTRANT -D_GNU_SOURCE \
|
||||
$^ \
|
||||
-shared -lc
|
||||
|
@ -113,14 +114,14 @@ $(OS_DIR_LINUX_X86_64)/libpty.so: unix/openpty.c unix/pty.c unix/ptyio.c
|
|||
# Linux aarch64
|
||||
$(OS_DIR_LINUX_AARCH64)/libspawner.so: unix/spawner.c unix/io.c unix/exec_unix.c unix/exec_pty.c unix/openpty.c unix/pfind.c
|
||||
mkdir -p $(dir $@) && \
|
||||
aarch64-linux-gnu-gcc -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
aarch64-linux-gnu-gcc $(COMMON_CFLAGS) -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
-D_REENTRANT -D_GNU_SOURCE \
|
||||
$^ \
|
||||
-shared -lc
|
||||
|
||||
$(OS_DIR_LINUX_AARCH64)/libpty.so: unix/openpty.c unix/pty.c unix/ptyio.c
|
||||
mkdir -p $(dir $@) && \
|
||||
aarch64-linux-gnu-gcc -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
aarch64-linux-gnu-gcc $(COMMON_CFLAGS) -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
-D_REENTRANT -D_GNU_SOURCE \
|
||||
$^ \
|
||||
-shared -lc
|
||||
|
@ -128,7 +129,7 @@ $(OS_DIR_LINUX_AARCH64)/libpty.so: unix/openpty.c unix/pty.c unix/ptyio.c
|
|||
# Linux ppc64le
|
||||
$(OS_DIR_LINUX_PPC64LE)/libspawner.so: unix/spawner.c unix/io.c unix/exec_unix.c unix/exec_pty.c unix/openpty.c unix/pfind.c
|
||||
mkdir -p $(dir $@) && \
|
||||
powerpc64le-linux-gnu-gcc -m64 -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
powerpc64le-linux-gnu-gcc $(COMMON_CFLAGS) -m64 -o $@ -Wl,-soname,$(notdir $@) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux -fpic \
|
||||
-D_REENTRANT -D_GNU_SOURCE \
|
||||
$^ \
|
||||
-shared -lc
|
||||
|
@ -143,14 +144,14 @@ $(OS_DIR_LINUX_PPC64LE)/libpty.so: unix/openpty.c unix/pty.c unix/ptyio.c
|
|||
# macos x86_64
|
||||
$(OS_DIR_MACOS_X86_64)/libspawner.jnilib: unix/spawner.c unix/io.c unix/exec_unix.c unix/exec_pty.c unix/openpty.c unix/pfind.c
|
||||
mkdir -p $(dir $@) && \
|
||||
x86_64-apple-darwin17-clang -o $@ -arch x86_64 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
x86_64-apple-darwin17-clang $(COMMON_CFLAGS) -o $@ -arch x86_64 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
-D_REENTRANT \
|
||||
$^ \
|
||||
-dynamiclib -lc -framework JavaVM
|
||||
|
||||
$(OS_DIR_MACOS_X86_64)/libpty.jnilib: unix/openpty.c unix/pty.c unix/ptyio.c
|
||||
mkdir -p $(dir $@) && \
|
||||
x86_64-apple-darwin17-clang -o $@ -arch x86_64 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
x86_64-apple-darwin17-clang $(COMMON_CFLAGS) -o $@ -arch x86_64 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
-D_REENTRANT \
|
||||
$^ \
|
||||
-dynamiclib -lc -framework JavaVM
|
||||
|
@ -158,14 +159,14 @@ $(OS_DIR_MACOS_X86_64)/libpty.jnilib: unix/openpty.c unix/pty.c unix/ptyio.c
|
|||
# macos x86
|
||||
$(OS_DIR_MACOS_X86)/libspawner.jnilib: unix/spawner.c unix/io.c unix/exec_unix.c unix/exec_pty.c unix/openpty.c unix/pfind.c
|
||||
mkdir -p $(dir $@) && \
|
||||
x86_64-apple-darwin17-clang -o $@ -arch i386 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
x86_64-apple-darwin17-clang $(COMMON_CFLAGS) -o $@ -arch i386 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
-D_REENTRANT \
|
||||
$^ \
|
||||
-dynamiclib -lc -framework JavaVM
|
||||
|
||||
$(OS_DIR_MACOS_X86)/libpty.jnilib: unix/openpty.c unix/pty.c unix/ptyio.c
|
||||
mkdir -p $(dir $@) && \
|
||||
x86_64-apple-darwin17-clang -o $@ -arch i386 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
x86_64-apple-darwin17-clang $(COMMON_CFLAGS) -o $@ -arch i386 -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin -fPIC \
|
||||
-D_REENTRANT \
|
||||
$^ \
|
||||
-dynamiclib -lc -framework JavaVM
|
||||
|
|
|
@ -49,7 +49,7 @@ pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const c
|
|||
*/
|
||||
if (channels != NULL && console) {
|
||||
if (pipe(pipe2) < 0) {
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __func__, __LINE__, strerror(errno));
|
||||
free(full_path);
|
||||
return -1;
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const c
|
|||
childpid = fork();
|
||||
|
||||
if (childpid < 0) {
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__,
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __func__,
|
||||
__LINE__, strerror(errno));
|
||||
free(full_path);
|
||||
return -1;
|
||||
|
@ -76,7 +76,7 @@ pid_t exec_pty(const char *path, char *const argv[], char *const envp[], const c
|
|||
|
||||
fds = ptys_open(fdm, pts_name);
|
||||
if (fds < 0) {
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__, __LINE__, strerror(errno));
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __func__, __LINE__, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@ pid_t exec0(const char *path, char *const argv[], char *const envp[], const char
|
|||
*/
|
||||
if (channels != NULL) {
|
||||
if (pipe(pipe0) < 0 || pipe(pipe1) < 0 || pipe(pipe2) < 0) {
|
||||
fprintf(stderr, "%s(%d): returning due to error.\n", __FUNCTION__,
|
||||
fprintf(stderr, "%s(%d): returning due to error.\n", __func__,
|
||||
__LINE__);
|
||||
free(full_path);
|
||||
return -1;
|
||||
|
@ -55,13 +55,10 @@ pid_t exec0(const char *path, char *const argv[], char *const envp[], const char
|
|||
childpid = fork();
|
||||
|
||||
if (childpid < 0) {
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __FUNCTION__,
|
||||
__LINE__, strerror(errno));
|
||||
fprintf(stderr, "%s(%d): returning due to error: %s\n", __func__, __LINE__, strerror(errno));
|
||||
free(full_path);
|
||||
return -1;
|
||||
} else if (childpid == 0) { /* child */
|
||||
char *ptr;
|
||||
|
||||
chdir(dirpath);
|
||||
|
||||
if (channels != NULL) {
|
||||
|
@ -107,9 +104,6 @@ pid_t exec0(const char *path, char *const argv[], char *const envp[], const char
|
|||
_exit(127);
|
||||
|
||||
} else if (childpid != 0) { /* parent */
|
||||
|
||||
char b;
|
||||
|
||||
if (channels != NULL) {
|
||||
/* close the read end of pipe1 */
|
||||
if (close(pipe0[0]) == -1) {
|
||||
|
|
|
@ -84,8 +84,6 @@ extern CRITICAL_SECTION cs;
|
|||
|
||||
extern wchar_t path[MAX_PATH]; // Directory where spawner.dll is located
|
||||
|
||||
static HMODULE hVM = NULL; // VM handler
|
||||
|
||||
static pProcInfo_t pInfo = NULL;
|
||||
|
||||
static int nCounter = 0; // We use it to build unique synchronization object names
|
||||
|
@ -134,7 +132,6 @@ JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_spawner_Spawner_exec0(JNIEnv *
|
|||
STARTUPINFOW si;
|
||||
DWORD flags = 0;
|
||||
wchar_t *cwd = NULL;
|
||||
LPVOID envBlk = NULL;
|
||||
int ret = 0;
|
||||
int nCmdLineLength = 0;
|
||||
wchar_t *szCmdLine = 0;
|
||||
|
@ -862,7 +859,6 @@ void _cdecl waitProcTermination(void* pv) {
|
|||
int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace) {
|
||||
BOOL bSlash = FALSE;
|
||||
int i = 0, j = 0;
|
||||
int totCpyLength = cpyLength;
|
||||
|
||||
#define QUOTATION_DO 0
|
||||
#define QUOTATION_DONE 1
|
||||
|
|
|
@ -3,8 +3,6 @@
|
|||
#include <delayimp.h>
|
||||
#include <assert.h>
|
||||
|
||||
#pragma comment(lib, "delayimp")
|
||||
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) {
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
|
|
|
@ -33,11 +33,10 @@ static HWND consoleHWND;
|
|||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
static BOOL CALLBACK
|
||||
find_child_console(HWND hwnd, LPARAM arg) {
|
||||
DWORD thread_id;
|
||||
DWORD process_id;
|
||||
DWORD pid = arg;
|
||||
|
||||
thread_id = GetWindowThreadProcessId(hwnd, &process_id);
|
||||
GetWindowThreadProcessId(hwnd, &process_id);
|
||||
if (process_id == pid) {
|
||||
wchar_t window_class[32];
|
||||
|
||||
|
@ -114,9 +113,7 @@ int interruptProcess(int pid) {
|
|||
// send Ctrl-C and then restore focus
|
||||
BYTE control_scan_code = (BYTE) MapVirtualKey(VK_CONTROL, 0);
|
||||
/* Fake Ctrl-C for SIGINT, and Ctrl-Break for SIGQUIT. */
|
||||
BYTE vk_c_code = 'C';
|
||||
BYTE vk_break_code = VK_CANCEL;
|
||||
BYTE c_scan_code = (BYTE) MapVirtualKey(vk_c_code, 0);
|
||||
BYTE break_scan_code = (BYTE) MapVirtualKey(vk_break_code, 0);
|
||||
HWND foreground_window;
|
||||
|
||||
|
|
|
@ -142,8 +142,8 @@ int main() {
|
|||
|
||||
// Make sure that we've been passed the right number of arguments
|
||||
if (argc < 8) {
|
||||
_tprintf(_T("Usage: %s (four inheritable event handles) (CommandLineToSpawn)\n"), argv[0]);
|
||||
return (0);
|
||||
wprintf(L"Usage: %s (four inheritable event handles) (CommandLineToSpawn)\n", argv[0]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Construct the full command line
|
||||
|
@ -454,7 +454,6 @@ int main() {
|
|||
int copyTo(wchar_t *target, const wchar_t *source, int cpyLength, int availSpace) {
|
||||
BOOL bSlash = FALSE;
|
||||
int i = 0, j = 0;
|
||||
int totCpyLength = cpyLength;
|
||||
|
||||
#define QUOTATION_DO 0
|
||||
#define QUOTATION_DONE 1
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -22,6 +22,7 @@ REPRODUCIBLE_BUILD_WRAPPER := $(shell git rev-parse --show-toplevel)/releng/scri
|
|||
OS_DIR = ../os
|
||||
|
||||
CFLAGS += -fPIC -D_REENTRANT
|
||||
COMMON_CFLAGS := -Wall -pedantic
|
||||
|
||||
UNAME = $(shell uname)
|
||||
ifeq ($(UNAME),Linux)
|
||||
|
@ -55,20 +56,20 @@ rebuild: clean all
|
|||
$(OS_DIR)/win32/x86_64/serial.dll: serial.c
|
||||
mkdir -p $(dir $@) && \
|
||||
$(REPRODUCIBLE_BUILD_WRAPPER) \
|
||||
x86_64-w64-mingw32-gcc -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ $^
|
||||
x86_64-w64-mingw32-gcc $(COMMON_CFLAGS) -Iinclude -I"$(JAVA_HOME)/include" -I"$(JAVA_HOME)/include/win32" -shared -o $@ $^
|
||||
|
||||
$(OS_DIR)/linux/x86_64/libserial.so: serial.c
|
||||
mkdir -p $(dir $@) && \
|
||||
gcc -m64 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ $^
|
||||
x86_64-linux-gnu-gcc -m64 $(COMMON_CFLAGS) $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ $^
|
||||
|
||||
$(OS_DIR)/linux/aarch64/libserial.so: serial.c
|
||||
mkdir -p $(dir $@) && \
|
||||
aarch64-linux-gnu-gcc $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ $^
|
||||
aarch64-linux-gnu-gcc $(COMMON_CFLAGS) $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ $^
|
||||
|
||||
$(OS_DIR)/linux/ppc64le/libserial.so: serial.c
|
||||
mkdir -p $(dir $@)
|
||||
powerpc64le-linux-gnu-gcc -m64 -mcpu=power8 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
|
||||
powerpc64le-linux-gnu-gcc $(COMMON_CFLAGS) -m64 -mcpu=power8 $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux $(LDFLAGS) -shared -o $@ serial.c
|
||||
|
||||
$(OS_DIR)/macosx/x86_64/libserial.jnilib: serial.c
|
||||
mkdir -p $(dir $@) && \
|
||||
x86_64-apple-darwin17-clang $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ $^
|
||||
x86_64-apple-darwin17-clang $(COMMON_CFLAGS) $(CFLAGS) -Iinclude -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/darwin $(LDFLAGS) -dynamiclib -o $@ $^
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
* stage. This method obtains the last error from OS to include in the
|
||||
* IOException
|
||||
*/
|
||||
#ifndef __APPLE__
|
||||
#ifndef __MINGW32__
|
||||
static void closeAndthrowIOException(int fd, JNIEnv *env, const char *msg) {
|
||||
#else
|
||||
|
@ -61,6 +62,7 @@ static void closeAndthrowIOException(HANDLE handle, JNIEnv *env, const char *msg
|
|||
jclass cls = (*env)->FindClass(env, "java/io/IOException");
|
||||
(*env)->ThrowNew(env, cls, buff);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void throwIOException(JNIEnv *env, const char *msg) {
|
||||
char buff[256];
|
||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue