Move entirety of llvm namespace to wpi namespace.

During shared library loading, a different libLLVM can be pulled in, causing
llvm symbols from dependent libraries to resolve to that library instead of
this one. This has been seen in the wild with the Mesa OpenGL implementation
in JavaFX applications (see wpilibsuite/shuffleboard#361).

This is clearly a very breaking change. For some level of backwards
compatibility, a namespace alias from llvm to wpi is performed in the "llvm"
headers.  Unfortunately, forward declarations of llvm classes will still break,
but compilers seem to generate clear error messages in those cases
("namespace alias 'llvm' not allowed here, assuming 'wpi'").

This change also moves all the wpiutil headers to a single "wpi" subdirectory
from the previously split "llvm", "support", "tcpsockets", and "udpsockets".
Shim headers will be added for backwards compatibility in a later commit.
This commit is contained in:
Peter Johnson
2018-04-29 23:33:19 -07:00
parent 93859eb84f
commit f84018af5f
377 changed files with 2747 additions and 2742 deletions

View File

@@ -18,9 +18,9 @@
#include <FRC_NetworkCommunication/FRCComm.h>
#include <FRC_NetworkCommunication/LoadOut.h>
#include <llvm/raw_ostream.h>
#include <support/mutex.h>
#include <support/timestamp.h>
#include <wpi/mutex.h>
#include <wpi/raw_ostream.h>
#include <wpi/timestamp.h>
#include "HAL/ChipObject.h"
#include "HAL/DriverStation.h"
@@ -329,20 +329,20 @@ static bool killExistingProgram(int timeout, int mode) {
// see if the pid is around, but we don't want to mess with init id=1, or
// ourselves
if (pid >= 2 && kill(pid, 0) == 0 && pid != getpid()) {
llvm::outs() << "Killing previously running FRC program...\n";
wpi::outs() << "Killing previously running FRC program...\n";
kill(pid, SIGTERM); // try to kill it
std::this_thread::sleep_for(std::chrono::milliseconds(timeout));
if (kill(pid, 0) == 0) {
// still not successfull
if (mode == 0) {
llvm::outs() << "FRC pid " << pid << " did not die within " << timeout
<< "ms. Aborting\n";
wpi::outs() << "FRC pid " << pid << " did not die within " << timeout
<< "ms. Aborting\n";
return 0; // just fail
} else if (mode == 1) { // kill -9 it
kill(pid, SIGKILL);
} else {
llvm::outs() << "WARNING: FRC pid " << pid << " did not die within "
<< timeout << "ms.\n";
wpi::outs() << "WARNING: FRC pid " << pid << " did not die within "
<< timeout << "ms.\n";
}
}
}
@@ -374,7 +374,7 @@ HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
setlinebuf(stdin);
setlinebuf(stdout);
llvm::outs().SetUnbuffered();
wpi::outs().SetUnbuffered();
prctl(PR_SET_PDEATHSIG, SIGTERM);
@@ -401,10 +401,10 @@ HAL_Bool HAL_Initialize(int32_t timeout, int32_t mode) {
int32_t status = 0;
uint64_t rv = HAL_GetFPGATime(&status);
if (status != 0) {
llvm::errs()
wpi::errs()
<< "Call to HAL_GetFPGATime failed."
<< "Initialization might have failed. Time will not be correct\n";
llvm::errs().flush();
wpi::errs().flush();
return 0u;
}
return rv;