From d786f1853084467bcf666973847ef2297255a0eb Mon Sep 17 00:00:00 2001 From: DorisBDR <121011701+DorisBDR@users.noreply.github.com> Date: Fri, 1 Dec 2023 08:05:50 +0100 Subject: [PATCH 01/12] Update accAPI.cpp retrieve the server host and port from environment to have a proper comaprison --- source/client/accAPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/accAPI.cpp b/source/client/accAPI.cpp index 982a06bc..67b4eaab 100755 --- a/source/client/accAPI.cpp +++ b/source/client/accAPI.cpp @@ -685,7 +685,7 @@ void putIdamServer(const char* host, int port) void putIdamServerHost(const char* host) { ENVIRONMENT* environment = getIdamClientEnvironment(); - std::string old_host = host; + std::string old_host = environment->server_host; strcpy(environment->server_host, host); // UDA server's host name or IP address if (old_host != host) { environment->server_reconnect = 1; // Create a new Server instance @@ -702,7 +702,7 @@ void putIdamServerPort(int port) { ENVIRONMENT* environment = getIdamClientEnvironment(); int old_port = port; - environment->server_port = port; // UDA server service port number + environment->server_port = environment->server_port; // UDA server service port number if (old_port != port) { environment->server_reconnect = 1; // Create a new Server instance } From 107fba9d4d517a912e78e0ca85586c1b6a74294b Mon Sep 17 00:00:00 2001 From: Jonathan Hollocombe Date: Mon, 4 Dec 2023 10:11:12 +0000 Subject: [PATCH 02/12] Updating accAPI.cpp to include fixes for multiple uda server connections. --- source/client/accAPI.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/client/accAPI.cpp b/source/client/accAPI.cpp index 982a06bc..a00b2f4d 100755 --- a/source/client/accAPI.cpp +++ b/source/client/accAPI.cpp @@ -685,7 +685,7 @@ void putIdamServer(const char* host, int port) void putIdamServerHost(const char* host) { ENVIRONMENT* environment = getIdamClientEnvironment(); - std::string old_host = host; + std::string old_host = environment->server_host; strcpy(environment->server_host, host); // UDA server's host name or IP address if (old_host != host) { environment->server_reconnect = 1; // Create a new Server instance @@ -701,7 +701,7 @@ void putIdamServerHost(const char* host) void putIdamServerPort(int port) { ENVIRONMENT* environment = getIdamClientEnvironment(); - int old_port = port; + int old_port = environment->server_port; environment->server_port = port; // UDA server service port number if (old_port != port) { environment->server_reconnect = 1; // Create a new Server instance From 7e6d5c065ac3f877d018cbe79dba62e7dbb9995e Mon Sep 17 00:00:00 2001 From: DorisBDR <121011701+DorisBDR@users.noreply.github.com> Date: Tue, 9 Jan 2024 11:23:30 +0100 Subject: [PATCH 03/12] add support for multiple server connections we have added now the support on the client to allow multiple servers connections --- source/client/accAPI.cpp | 4 +- source/client/connection.cpp | 14 ++- source/client/connection.h | 2 +- source/client/getEnvironment.cpp | 2 + source/client/udaClient.cpp | 84 +++++++------- source/clientserver/manageSockets.cpp | 2 + source/clientserver/protocol.cpp | 151 +++++++++++++++++--------- source/clientserver/protocol.h | 5 + source/clientserver/protocol2.cpp | 35 +++++- source/clientserver/socketStructs.h | 2 + source/clientserver/udaErrors.h | 1 + source/clientserver/udaStructs.h | 2 + source/clientserver/xdrlib.cpp | 17 +-- source/clientserver/xdrlib.h | 2 +- 14 files changed, 215 insertions(+), 108 deletions(-) diff --git a/source/client/accAPI.cpp b/source/client/accAPI.cpp index 67b4eaab..a00b2f4d 100755 --- a/source/client/accAPI.cpp +++ b/source/client/accAPI.cpp @@ -701,8 +701,8 @@ void putIdamServerHost(const char* host) void putIdamServerPort(int port) { ENVIRONMENT* environment = getIdamClientEnvironment(); - int old_port = port; - environment->server_port = environment->server_port; // UDA server service port number + int old_port = environment->server_port; + environment->server_port = port; // UDA server service port number if (old_port != port) { environment->server_reconnect = 1; // Create a new Server instance } diff --git a/source/client/connection.cpp b/source/client/connection.cpp index 3523a5e0..d4c129e7 100755 --- a/source/client/connection.cpp +++ b/source/client/connection.cpp @@ -81,6 +81,8 @@ int reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, int clientSocket0 = client_socket; XDR* clientInput0 = *client_input; XDR* clientOutput0 = *client_output; + int proto_version=environment->protocol_version; + int server_version=environment->server_version; // Identify the current Socket connection in the Socket List @@ -99,6 +101,8 @@ int reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, time(tv_server_start); // Start a New Server AGE timer client_socket = -1; // Flags no Socket is open environment->server_change_socket = 0; // Client doesn't know the Socket ID so disable + environment->protocol_version=-1; + environment->server_version = 0; } } @@ -124,6 +128,8 @@ int reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, environment->server_socket = client_socketlist.sockets[newsocketId].fh; environment->server_port = client_socketlist.sockets[newsocketId].port; strcpy(environment->server_host, client_socketlist.sockets[newsocketId].host); + environment->protocol_version = client_socketlist.sockets[newsocketId].protocol_version; + environment->server_version = client_socketlist.sockets[newsocketId].server_version; } // save Previous data if a previous socket existed @@ -134,6 +140,8 @@ int reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, client_socketlist.sockets[socketId].fh = clientSocket0; client_socketlist.sockets[socketId].Input = clientInput0; client_socketlist.sockets[socketId].Output = clientOutput0; + client_socketlist.sockets[socketId].protocol_version=proto_version; + client_socketlist.sockets[socketId].server_version=server_version; } return err; @@ -200,7 +208,7 @@ void setHints(struct addrinfo* hints, const char* hostname) } } -int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_start, int user_timeout) +int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_start, int user_timeout, int client_version) { int window_size = DB_READ_BLOCK_SIZE; // 128K int rc; @@ -534,9 +542,13 @@ int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_st client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].Output = client_output; client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].user_timeout = user_timeout; client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].tv_server_start = *tv_server_start; + client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].protocol_version = client_version; + client_socketlist.sockets[getSocketRecordId(&client_socketlist, client_socket)].server_version = 0; environment->server_reconnect = 0; environment->server_change_socket = 0; environment->server_socket = client_socket; + environment->protocol_version=client_version; + environment->server_version=0; // Write the socket number to the SSL functions diff --git a/source/client/connection.h b/source/client/connection.h index 8a3f17c3..f8733150 100755 --- a/source/client/connection.h +++ b/source/client/connection.h @@ -16,7 +16,7 @@ extern "C" { int connectionOpen(); int reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, time_t* tv_server_start, int* user_timeout); -int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_start, int user_timeout); +int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_start, int user_timeout, int client_version); void closeAllConnections(); void closeConnection(ClosedownType type); diff --git a/source/client/getEnvironment.cpp b/source/client/getEnvironment.cpp index 237668a8..4afdd401 100755 --- a/source/client/getEnvironment.cpp +++ b/source/client/getEnvironment.cpp @@ -244,6 +244,8 @@ ENVIRONMENT* getIdamClientEnvironment() //------------------------------------------------------------------------------------------- + udaEnviron.protocol_version=-1; + udaEnviron.server_version=0; udaEnviron.initialised = 1; // Initialisation Complete return &udaEnviron; diff --git a/source/client/udaClient.cpp b/source/client/udaClient.cpp index 370ce708..5033e375 100755 --- a/source/client/udaClient.cpp +++ b/source/client/udaClient.cpp @@ -39,7 +39,7 @@ //------------------------------------------------ Static Globals ------------------------------------------------------ #if !defined(FATCLIENT) || !defined(NOLIBMEMCACHED) -static int protocol_version = 9; +//static int protocol_version = 9; #endif int client_version = 9; // previous version @@ -116,12 +116,12 @@ void updateClientBlock(CLIENT_BLOCK* str, const CLIENT_FLAGS* client_flags, unsi */ int check_file_cache(const REQUEST_DATA* request_data, DATA_BLOCK** p_data_block, LOGMALLOCLIST* log_malloc_list, USERDEFINEDTYPELIST* user_defined_type_list, LOGSTRUCTLIST* log_struct_list, - CLIENT_FLAGS* client_flags, unsigned int private_flags, int malloc_source) + CLIENT_FLAGS* client_flags, unsigned int private_flags, int malloc_source, int proto_version) { if (client_flags->flags & CLIENTFLAG_FILECACHE && !request_data->put) { // Query the cache for the Data - DATA_BLOCK* data = udaFileCacheRead(request_data, log_malloc_list, user_defined_type_list, protocol_version, - log_struct_list, private_flags, malloc_source); + DATA_BLOCK* data = udaFileCacheRead(request_data, log_malloc_list, user_defined_type_list, proto_version, + log_struct_list, private_flags, malloc_source) if (data != nullptr) { // Success @@ -146,7 +146,7 @@ int check_file_cache(const REQUEST_DATA* request_data, DATA_BLOCK** p_data_block int check_mem_cache(uda::cache::UdaCache* cache, REQUEST_DATA* request_data, DATA_BLOCK** p_data_block, LOGMALLOCLIST* log_malloc_list, USERDEFINEDTYPELIST* user_defined_type_list, LOGSTRUCTLIST* log_struct_list, CLIENT_FLAGS* client_flags, unsigned int private_flags, - int malloc_source) + int malloc_source, int proto_version) { // Check Client Properties for permission to cache if ((client_flags->flags & CLIENTFLAG_CACHE) && !request_data->put) { @@ -158,7 +158,7 @@ int check_mem_cache(uda::cache::UdaCache* cache, REQUEST_DATA* request_data, DAT // Query the cache for the Data DATA_BLOCK* data = cache_read(cache, request_data, log_malloc_list, user_defined_type_list, - *getIdamClientEnvironment(), protocol_version, client_flags->flags, + *getIdamClientEnvironment(), proto_version, client_flags->flags, log_struct_list, private_flags, malloc_source); if (data != nullptr) { @@ -230,7 +230,7 @@ void copyClientBlock(CLIENT_BLOCK* str, const CLIENT_FLAGS* client_flags) */ static int fetchHierarchicalData(XDR* client_input, DATA_BLOCK* data_block, LOGSTRUCTLIST* log_struct_list, - unsigned int private_flags, int malloc_source) + unsigned int private_flags, int malloc_source, int proto_version) { if (data_block->data_type == UDA_TYPE_COMPOUND && data_block->opaque_type != UDA_OPAQUE_TYPE_UNKNOWN) { @@ -250,7 +250,7 @@ fetchHierarchicalData(XDR* client_input, DATA_BLOCK* data_block, LOGSTRUCTLIST* int err = 0; if ((err = protocol2(client_input, protocol_id, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, - data_block, protocol_version, log_struct_list, private_flags, malloc_source)) != 0) { + data_block, proto_version, log_struct_list, private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Client Side Protocol Error (Opaque Structure Type)"); return err; } @@ -285,41 +285,41 @@ static int allocMeta(DATA_SYSTEM** data_system, SYSTEM_CONFIG** system_config, D static int fetchMeta(XDR* client_input, DATA_SYSTEM* data_system, SYSTEM_CONFIG* system_config, DATA_SOURCE* data_source, SIGNAL* signal_rec, SIGNAL_DESC* signal_desc, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, - int malloc_source) + int malloc_source, int proto_version) { int err = 0; #ifndef FATCLIENT // <========================== Client Server Code Only if ((err = protocol2(client_input, UDA_PROTOCOL_DATA_SYSTEM, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, - data_system, protocol_version, log_struct_list, private_flags, malloc_source)) != 0) { + data_system, proto_version, log_struct_list, private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 4 Error (Data System)"); return err; } printDataSystem(*data_system); if ((err = protocol2(client_input, UDA_PROTOCOL_SYSTEM_CONFIG, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, - system_config, protocol_version, log_struct_list, private_flags, malloc_source)) != 0) { + system_config, proto_version, log_struct_list, private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 5 Error (System Config)"); return err; } printSystemConfig(*system_config); if ((err = protocol2(client_input, UDA_PROTOCOL_DATA_SOURCE, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, - data_source, protocol_version, log_struct_list, private_flags, malloc_source)) != 0) { + data_source, proto_version, log_struct_list, private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 6 Error (Data Source)"); return err; } printDataSource(*data_source); if ((err = protocol2(client_input, UDA_PROTOCOL_SIGNAL, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, - signal_rec, protocol_version, log_struct_list, private_flags, malloc_source)) != 0) { + signal_rec, proto_version, log_struct_list, private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 7 Error (Signal)"); return err; } printSignal(*signal_rec); if ((err = protocol2(client_input, UDA_PROTOCOL_SIGNAL_DESC, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, - signal_desc, protocol_version, log_struct_list, private_flags, malloc_source)) != 0) { + signal_desc, proto_version, log_struct_list, private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 8 Error (Signal Desc)"); return err; } @@ -434,6 +434,8 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) time(&tv_server_start); // First Call: Start the Clock } + ENVIRONMENT* environment = getIdamClientEnvironment(); + #ifndef FATCLIENT // <========================== Client Server Code Only # ifndef NOLIBMEMCACHED static uda::cache::UdaCache* cache; @@ -443,14 +445,14 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) auto request = &request_block->requests[i]; DATA_BLOCK* data_block = &cached_data_block_list.data[i]; int rc = check_file_cache(request, &data_block, g_log_malloc_list, g_user_defined_type_list, - &log_struct_list, client_flags, *private_flags, malloc_source); + &log_struct_list, client_flags, *private_flags, malloc_source, environment->protocol_version); if (rc >= 0) { request_block->requests[i].request = REQUEST_CACHED; ++num_cached; continue; } rc = check_mem_cache(cache, request, &data_block, g_log_malloc_list, g_user_defined_type_list, - &log_struct_list, client_flags, *private_flags, malloc_source); + &log_struct_list, client_flags, *private_flags, malloc_source, environment->protocol_version); if (rc >= 0) { request_block->requests[i].request = REQUEST_CACHED; ++num_cached; @@ -464,8 +466,6 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) // // Instance a new server on the same Host/Port or on a different Host/port - ENVIRONMENT* environment = getIdamClientEnvironment(); - if (environment->server_reconnect || environment->server_change_socket) { err = reconnect(environment, &client_input, &client_output, &tv_server_start, &client_flags->user_timeout); if (err) { @@ -531,7 +531,8 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) // Create the XDR Record Streams std::tie(client_input, client_output) = clientCreateXDRStream(); - if ((createConnection(client_input, client_output, &tv_server_start, client_flags->user_timeout)) != 0) { + UDA_LOG(UDA_LOG_DEBUG, "RC Creating connection\n"); + if ((createConnection(client_input, client_output, &tv_server_start, client_flags->user_timeout, client_version)) != 0) { err = NO_SOCKET_CONNECTION; addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "No Socket Connection to Server"); break; @@ -558,11 +559,18 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) // Initialise the Client/Server Structures if (initServer && system_startup) { + UDA_LOG(UDA_LOG_DEBUG, "RC InitServer and system startup\n"); userid(client_username); initClientBlock(&client_block, client_version, client_username); system_startup = false; // Don't call again! } + UDA_LOG(UDA_LOG_DEBUG, "Starting with protocol version = %d\n",environment->protocol_version); + if (environment->protocol_version == -1) { + UDA_LOG(UDA_LOG_DEBUG, "Undefined protocol version. Setting to %d\n",client_version); + environment->protocol_version = client_version; + } + // Update the Private Flags char* env = nullptr; @@ -672,12 +680,13 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) if (!startupStates) { + UDA_LOG(UDA_LOG_DEBUG, "Into startupStates\n"); // Flush (mark as at EOF) the input socket buffer (before the exchange begins) int protocol_id = UDA_PROTOCOL_CLIENT_BLOCK; // Send Client Block (proxy for authenticationStep = 6) if ((err = protocol2(client_output, protocol_id, XDR_SEND, nullptr, g_log_malloc_list, g_user_defined_type_list, - &client_block, protocol_version, &log_struct_list, *private_flags, + &client_block, environment->protocol_version, &log_struct_list, *private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 10 Error (Client Block)"); UDA_LOG(UDA_LOG_DEBUG, "Error Sending Client Block\n"); @@ -703,9 +712,9 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) protocol_id = UDA_PROTOCOL_SERVER_BLOCK; // Receive Server Block: Server Aknowledgement (proxy for authenticationStep = 8) - if ((err = protocol2(client_input, protocol_id, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, - &server_block, protocol_version, &log_struct_list, *private_flags, - malloc_source)) != 0) { + if ((err = protocol2_serv(client_input, protocol_id, XDR_RECEIVE, nullptr, g_log_malloc_list, g_user_defined_type_list, + &server_block, environment->protocol_version, &log_struct_list, *private_flags, + malloc_source,&(environment->server_version))) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 11 Error (Server Block #1)"); // Assuming the server_block is corrupted, replace with a clean copy to avoid concatonation problems server_block.idamerrorstack.nerrors = 0; @@ -724,7 +733,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) // Protocol Version: Lower of the client and server version numbers // This defines the set of elements within data structures passed between client and server // Must be the same on both sides of the socket - protocol_version = std::min(client_block.version, server_block.version); + environment->protocol_version = std::min(client_block.version, server_block.version); if (server_block.idamerrorstack.nerrors > 0) { err = server_block.idamerrorstack.idamerror[0].code; // Problem on the Server Side! @@ -740,7 +749,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) //------------------------------------------------------------------------- // Check the Server version is not older than this client's version - UDA_LOG(UDA_LOG_DEBUG, "protocolVersion %d\n", protocol_version); + UDA_LOG(UDA_LOG_DEBUG, "protocolVersion %d\n", environment->protocol_version); UDA_LOG(UDA_LOG_DEBUG, "Client Version %d\n", client_block.version); UDA_LOG(UDA_LOG_DEBUG, "Server Version %d\n", server_block.version); @@ -796,7 +805,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) int protocol_id = UDA_PROTOCOL_CLIENT_BLOCK; // Send Client Block if ((err = protocol2(client_output, protocol_id, XDR_SEND, nullptr, g_log_malloc_list, g_user_defined_type_list, - &client_block, protocol_version, &log_struct_list, *private_flags, + &client_block, environment->protocol_version, &log_struct_list, *private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 10 Error (Client Block)"); break; @@ -809,7 +818,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) protocol_id = UDA_PROTOCOL_REQUEST_BLOCK; // This is what the Client Wants if ((err = protocol2(client_output, protocol_id, XDR_SEND, nullptr, g_log_malloc_list, g_user_defined_type_list, - request_block, protocol_version, &log_struct_list, *private_flags, + request_block, environment->protocol_version, &log_struct_list, *private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 1 Error (Request Block)"); break; @@ -825,7 +834,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) protocol_id = UDA_PROTOCOL_PUTDATA_BLOCK_LIST; if ((err = protocol2(client_output, protocol_id, XDR_SEND, nullptr, g_log_malloc_list, g_user_defined_type_list, - &(request->putDataBlockList), protocol_version, &log_struct_list, + &(request->putDataBlockList), environment->protocol_version, &log_struct_list, *private_flags, malloc_source)) != 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, "Protocol 1 Error (sending putDataBlockList from Request Block)"); @@ -859,9 +868,9 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) UDA_LOG(UDA_LOG_DEBUG, "Waiting for Server Status Block\n"); - if ((err = protocol2(client_input, UDA_PROTOCOL_SERVER_BLOCK, XDR_RECEIVE, nullptr, g_log_malloc_list, - g_user_defined_type_list, &server_block, protocol_version, &log_struct_list, - *private_flags, malloc_source)) != 0) { + if ((err = protocol2_serv(client_input, UDA_PROTOCOL_SERVER_BLOCK, XDR_RECEIVE, nullptr, g_log_malloc_list, + g_user_defined_type_list, &server_block, environment->protocol_version, &log_struct_list, + *private_flags, malloc_source,&(environment->server_version))) != 0) { UDA_LOG(UDA_LOG_DEBUG, "Protocol 11 Error (Server Block #2) = %d\n", err); addIdamError(UDA_CODE_ERROR_TYPE, __func__, err, " Protocol 11 Error (Server Block #2)"); // Assuming the server_block is corrupted, replace with a clean copy to avoid future concatonation problems @@ -896,7 +905,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) break; } if ((err = fetchMeta(client_input, data_system, system_config, data_source, signal_rec, signal_desc, - &log_struct_list, *private_flags, malloc_source)) != 0) { + &log_struct_list, *private_flags, malloc_source, environment->protocol_version)) != 0) { break; } #ifndef FATCLIENT // <========================== Client Server Code Only @@ -912,7 +921,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) DATA_BLOCK_LIST recv_data_block_list; if ((err = protocol2(client_input, UDA_PROTOCOL_DATA_BLOCK_LIST, XDR_RECEIVE, nullptr, g_log_malloc_list, - g_user_defined_type_list, &recv_data_block_list, protocol_version, + g_user_defined_type_list, &recv_data_block_list, environment->protocol_version, &log_struct_list, *private_flags, malloc_source)) != 0) { UDA_LOG(UDA_LOG_DEBUG, "Protocol 2 Error (Failure Receiving Data Block)\n"); @@ -964,12 +973,12 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) *data_block->signal_desc = *signal_desc; } - fetchHierarchicalData(client_input, data_block, &log_struct_list, *private_flags, malloc_source); + fetchHierarchicalData(client_input, data_block, &log_struct_list, *private_flags, malloc_source, environment->protocol_version); //------------------------------------------------------------------------------ // Cache the data if the server has passed permission and the application (client) has enabled caching if (client_flags->flags & CLIENTFLAG_FILECACHE) { - udaFileCacheWrite(data_block, request_block, g_log_malloc_list, g_user_defined_type_list, protocol_version, + udaFileCacheWrite(data_block, request_block, g_log_malloc_list, g_user_defined_type_list, environment->protocol_version, &log_struct_list, *private_flags, malloc_source); } @@ -981,7 +990,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) if (cache != nullptr && client_flags->flags & CLIENTFLAG_CACHE) { # endif cache_write(cache, &request_block->requests[i], data_block, g_log_malloc_list, g_user_defined_type_list, - *environment, protocol_version, client_flags->flags, &log_struct_list, + *environment, environment->protocol_version, client_flags->flags, &log_struct_list, *private_flags, malloc_source); } # endif // !NOLIBMEMCACHED @@ -1454,8 +1463,9 @@ void udaFreeAll() client_block.timeout = 0; // Surrogate CLOSEDOWN instruction client_block.clientFlags = client_block.clientFlags | CLIENTFLAG_CLOSEDOWN; // Direct CLOSEDOWN instruction protocol_id = UDA_PROTOCOL_CLIENT_BLOCK; + ENVIRONMENT *environment = getIdamClientEnvironment(); protocol2(*g_client_output, protocol_id, XDR_SEND, nullptr, g_log_malloc_list, g_user_defined_type_list, &client_block, - protocol_version, g_log_struct_list, *udaPrivateFlags(), UDA_MALLOC_SOURCE_NONE); + environment->protocol_version, g_log_struct_list, *udaPrivateFlags(), UDA_MALLOC_SOURCE_NONE); xdrrec_endofrecord(*g_client_output, 1); } diff --git a/source/clientserver/manageSockets.cpp b/source/clientserver/manageSockets.cpp index eb16e6ae..c7224d01 100755 --- a/source/clientserver/manageSockets.cpp +++ b/source/clientserver/manageSockets.cpp @@ -45,6 +45,8 @@ int addSocket(SOCKETLIST* socks, int type, int status, char* host, int port, int strcpy(socks->sockets[socks->nsocks].host, host); socks->sockets[socks->nsocks].tv_server_start = 0; socks->sockets[socks->nsocks].user_timeout = 0; + socks->sockets[socks->nsocks].protocol_version=-1; + socks->sockets[socks->nsocks].server_version=0; (socks->nsocks)++; return 0; diff --git a/source/clientserver/protocol.cpp b/source/clientserver/protocol.cpp index da34ac0a..5521f9e3 100755 --- a/source/clientserver/protocol.cpp +++ b/source/clientserver/protocol.cpp @@ -39,6 +39,98 @@ # include #endif +int protocol_serv(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, + IoData* io_data, unsigned int private_flags, int malloc_source, int *serverVersion) +{ + int err = 0; + + UDA_LOG(UDA_LOG_DEBUG, "\nPROTOCOL: protocolVersion = %d\n\n", protocolVersion); + + //---------------------------------------------------------------------------- + // Error Management Loop + + do { + //---------------------------------------------------------------------------- + // Server State + + if (protocol_id == UDA_PROTOCOL_SERVER_BLOCK) { + + auto server_block = (SERVER_BLOCK*) str; + + switch (direction) { + + case XDR_RECEIVE: + + if (!xdrrec_skiprecord(xdrs)) { + err = UDA_PROTOCOL_ERROR_5; + break; + } + + closeUdaError(); // Free Heap associated with Previous Data Access + + if (!xdr_server1(xdrs, server_block, protocolVersion,serverVersion)) { + err = UDA_PROTOCOL_ERROR_22; + break; + } + + if (server_block->idamerrorstack.nerrors > 0) { // No Data to Receive? + + server_block->idamerrorstack.idamerror = (UDA_ERROR*) malloc( + server_block->idamerrorstack.nerrors * sizeof(UDA_ERROR)); + initErrorRecords(&server_block->idamerrorstack); + + if (!xdr_server2(xdrs, server_block)) { + err = UDA_PROTOCOL_ERROR_22; + break; + } + } + + break; + + case XDR_SEND: + if (!xdr_server1(xdrs, server_block, protocolVersion,serverVersion)) { + err = UDA_PROTOCOL_ERROR_22; + break; + } + + if (server_block->idamerrorstack.nerrors > 0) { // No Data to Send? + if (!xdr_server2(xdrs, server_block)) { + err = UDA_PROTOCOL_ERROR_22; + break; + } + } + + if (!xdrrec_endofrecord(xdrs, 1)) { + err = UDA_PROTOCOL_ERROR_7; + break; + } + break; + + case XDR_FREE_HEAP: + + if (!xdr_server(xdrs, server_block)) { + err = UDA_PROTOCOL_ERROR_23; + break; + } + break; + + default: + err = UDA_PROTOCOL_ERROR_4; + break; + } + + break; + } + UDA_LOG(UDA_LOG_DEBUG, "protocol_serv must be only used for protocol_id==UDA_PROTOCOL_SERVER_BLOCK. Current value = %d\n",protocol_id); + err=UDA_PROTOCOL_ERROR_1093; + + }while(0); + + return err; +} + + int protocol(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, IoData* io_data, unsigned int private_flags, int malloc_source) @@ -734,68 +826,19 @@ int protocol(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIS if (protocol_id == UDA_PROTOCOL_SERVER_BLOCK) { - auto server_block = (SERVER_BLOCK*) str; - switch (direction) { case XDR_RECEIVE: - if (!xdrrec_skiprecord(xdrs)) { - err = UDA_PROTOCOL_ERROR_5; - break; - } - - closeUdaError(); // Free Heap associated with Previous Data Access - - if (!xdr_server1(xdrs, server_block, protocolVersion)) { - err = UDA_PROTOCOL_ERROR_22; - break; - } - - if (server_block->idamerrorstack.nerrors > 0) { // No Data to Receive? - - server_block->idamerrorstack.idamerror = (UDA_ERROR*) malloc( - server_block->idamerrorstack.nerrors * sizeof(UDA_ERROR)); - initErrorRecords(&server_block->idamerrorstack); - - if (!xdr_server2(xdrs, server_block)) { - err = UDA_PROTOCOL_ERROR_22; - break; - } - } + UDA_LOG(UDA_LOG_DEBUG, "Call to protocol with protocol_id == UDA_PROTOCOL_SERVER_BLOCK and direction == XDR_RECEIVE is forbidden. Use protocol_serv instead\n"); + err=UDA_PROTOCOL_ERROR_1093; break; - case XDR_SEND: - if (!xdr_server1(xdrs, server_block, protocolVersion)) { - err = UDA_PROTOCOL_ERROR_22; - break; - } - - if (server_block->idamerrorstack.nerrors > 0) { // No Data to Send? - if (!xdr_server2(xdrs, server_block)) { - err = UDA_PROTOCOL_ERROR_22; - break; - } - } - - if (!xdrrec_endofrecord(xdrs, 1)) { - err = UDA_PROTOCOL_ERROR_7; - break; - } - break; - - case XDR_FREE_HEAP: - - if (!xdr_server(xdrs, server_block)) { - err = UDA_PROTOCOL_ERROR_23; - break; - } - break; - default: - err = UDA_PROTOCOL_ERROR_4; - break; + err = protocol_serv(xdrs, protocol_id, direction, token, logmalloclist, + userdefinedtypelist, str, protocolVersion, log_struct_list, + io_data, private_flags, malloc_source,NULL); } break; diff --git a/source/clientserver/protocol.h b/source/clientserver/protocol.h index 909e32aa..47950cb6 100755 --- a/source/clientserver/protocol.h +++ b/source/clientserver/protocol.h @@ -68,4 +68,9 @@ int protocol2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLI LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source); +int protocol2_serv(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, + LOGSTRUCTLIST* log_struct_list, + unsigned int private_flags, int malloc_source, int *serverVersion); + #endif // UDA_CLIENTSERVER_UDA_PROTOCOL_H diff --git a/source/clientserver/protocol2.cpp b/source/clientserver/protocol2.cpp index 1ddbe7a9..e1b9dbfc 100755 --- a/source/clientserver/protocol2.cpp +++ b/source/clientserver/protocol2.cpp @@ -56,7 +56,7 @@ static int handle_data_source(XDR* xdrs, int direction, const void* str); static int handle_signal(XDR* xdrs, int direction, const void* str); static int handle_signal_desc(XDR* xdrs, int direction, const void* str); static int handle_client_block(XDR* xdrs, int direction, const void* str, int protocolVersion); -static int handle_server_block(XDR* xdrs, int direction, const void* str, int protocolVersion); +static int handle_server_block(XDR* xdrs, int direction, const void* str, int protocolVersion, int *serverVersion); static int handle_dataobject(XDR* xdrs, int direction, const void* str); static int handle_dataobject_file(int direction, const void* str); @@ -64,6 +64,25 @@ static int handle_dataobject_file(int direction, const void* str); static int handle_security_block(XDR* xdrs, int direction, const void* str); #endif +int protocol2_serv(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, + USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, + unsigned int private_flags, int malloc_source, int *serverVersion) +{ + int err = 0; + + switch (protocol_id) { + case UDA_PROTOCOL_SERVER_BLOCK: + err = handle_server_block(xdrs, direction, str, protocolVersion,serverVersion); + break; + default: + UDA_LOG(UDA_LOG_DEBUG, "Call to protocol2_serv is only for protocol_id == UDA_PROTOCOL_SERVER_BLOCK\n"); + err=UDA_PROTOCOL_ERROR_1093; + } + + return err; + +} + int protocol2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, unsigned int private_flags, int malloc_source) @@ -108,7 +127,13 @@ int protocol2(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLI err = handle_client_block(xdrs, direction, str, protocolVersion); break; case UDA_PROTOCOL_SERVER_BLOCK: - err = handle_server_block(xdrs, direction, str, protocolVersion); + if (direction == XDR_RECEIVE) { + UDA_LOG(UDA_LOG_DEBUG, "Call to protocol2 with protocol_id == UDA_PROTOCOL_SERVER_BLOCK and direction == XDR_RECEIVE is forbidden. Use protocol2_serv instead\n"); + err=UDA_PROTOCOL_ERROR_1093; + } + else { + err = handle_server_block(xdrs, direction, str, protocolVersion,NULL); + } break; case UDA_PROTOCOL_DATAOBJECT: err = handle_dataobject(xdrs, direction, str); @@ -267,7 +292,7 @@ static int handle_dataobject(XDR* xdrs, int direction, const void* str) return err; } -static int handle_server_block(XDR* xdrs, int direction, const void* str, int protocolVersion) +static int handle_server_block(XDR* xdrs, int direction, const void* str, int protocolVersion, int *serverVersion) { int err = 0; auto server_block = (SERVER_BLOCK*)str; @@ -276,7 +301,7 @@ static int handle_server_block(XDR* xdrs, int direction, const void* str, int pr case XDR_RECEIVE: closeUdaError(); // Free Heap associated with Previous Data Access - if (!xdr_server1(xdrs, server_block, protocolVersion)) { + if (!xdr_server1(xdrs, server_block, protocolVersion, serverVersion)) { err = UDA_PROTOCOL_ERROR_22; break; } @@ -296,7 +321,7 @@ static int handle_server_block(XDR* xdrs, int direction, const void* str, int pr break; case XDR_SEND: - if (!xdr_server1(xdrs, server_block, protocolVersion)) { + if (!xdr_server1(xdrs, server_block, protocolVersion,serverVersion)) { err = UDA_PROTOCOL_ERROR_22; break; } diff --git a/source/clientserver/socketStructs.h b/source/clientserver/socketStructs.h index d6cd6817..f2cd68f7 100755 --- a/source/clientserver/socketStructs.h +++ b/source/clientserver/socketStructs.h @@ -41,6 +41,8 @@ typedef struct Sockets { time_t tv_server_start; // Server Startup Clock Time XDR* Input; // Client Only XDR input Stream; XDR* Output; // Client Only XDR Output Stream; + int protocol_version; + int server_version; } SOCKETS; typedef struct SocketList { diff --git a/source/clientserver/udaErrors.h b/source/clientserver/udaErrors.h index 6a03d9ef..fc114f39 100755 --- a/source/clientserver/udaErrors.h +++ b/source/clientserver/udaErrors.h @@ -66,6 +66,7 @@ #define UDA_PROTOCOL_ERROR_1082 1082 #define UDA_PROTOCOL_ERROR_1091 1091 #define UDA_PROTOCOL_ERROR_1092 1092 +#define UDA_PROTOCOL_ERROR_1093 1093 #define UDA_PROTOCOL_ERROR_9999 9999 //------------------------------------------------------- diff --git a/source/clientserver/udaStructs.h b/source/clientserver/udaStructs.h index 9e744190..9c2c08e8 100755 --- a/source/clientserver/udaStructs.h +++ b/source/clientserver/udaStructs.h @@ -422,6 +422,8 @@ typedef struct Environment { char private_path_substitute[STRING_LENGTH]; // and substitute with this path (so the server can locate them!) char initialised; // Environment already initialised. char _padding[1]; + int protocol_version; + int server_version; } ENVIRONMENT; void freeClientPutDataBlockList(PUTDATA_BLOCK_LIST* putDataBlockList); diff --git a/source/clientserver/xdrlib.cpp b/source/clientserver/xdrlib.cpp index 9bb433b3..4cbac0b1 100755 --- a/source/clientserver/xdrlib.cpp +++ b/source/clientserver/xdrlib.cpp @@ -219,20 +219,23 @@ bool_t xdr_client(XDR* xdrs, CLIENT_BLOCK* str, int protocolVersion) //----------------------------------------------------------------------- // Server State Block -bool_t xdr_server1(XDR* xdrs, SERVER_BLOCK* str, int protocolVersion) +bool_t xdr_server1(XDR* xdrs, SERVER_BLOCK* str, int protocolVersion, int *serverVersion) { int rc = 0; - static int serverVersion = 0; rc = xdr_int(xdrs, &str->version); if (xdrs->x_op == XDR_DECODE && rc) { // Test for a server crash! - if (serverVersion == 0) { - serverVersion = str->version; // Assume OK on first exchange - } else if (serverVersion != str->version) { // Usually different if the server has crashed + if (serverVersion == NULL) { + UDA_LOG(UDA_LOG_DEBUG, "Server #1 serverVersion == NULL\n"); + return 0; + } + if (*serverVersion == 0) { + *serverVersion = str->version; // Assume OK on first exchange + } else if (*serverVersion != str->version) { // Usually different if the server has crashed rc = 0; // Force an error - str->version = serverVersion; // Replace the erroneous version number + str->version = *serverVersion; // Replace the erroneous version number UDA_LOG(UDA_LOG_DEBUG, "Server #1 rc = %d\n", rc); return rc; } @@ -1522,4 +1525,4 @@ bool_t xdr_hdc_buffer(XDR* xdrs, char* buffer, uint64_t n) { int rc = xdr_vector(xdrs, buffer, n, sizeof(char), (xdrproc_t)xdr_char); return rc; -} \ No newline at end of file +} diff --git a/source/clientserver/xdrlib.h b/source/clientserver/xdrlib.h index b8162790..d1104c43 100755 --- a/source/clientserver/xdrlib.h +++ b/source/clientserver/xdrlib.h @@ -34,7 +34,7 @@ bool_t xdr_securityBlock1(XDR* xdrs, SECURITY_BLOCK* str); bool_t xdr_securityBlock2(XDR* xdrs, SECURITY_BLOCK* str); bool_t xdr_client(XDR* xdrs, CLIENT_BLOCK* str, int protocolVersion); bool_t xdr_server(XDR* xdrs, SERVER_BLOCK* str); -bool_t xdr_server1(XDR* xdrs, SERVER_BLOCK* str, int protocolVersion); +bool_t xdr_server1(XDR* xdrs, SERVER_BLOCK* str, int protocolVersion, int *serverVersion); bool_t xdr_server2(XDR* xdrs, SERVER_BLOCK* str); bool_t xdr_request(XDR* xdrs, REQUEST_BLOCK* str, int protocolVersion); bool_t xdr_request_data(XDR* xdrs, REQUEST_DATA* str, int protocolVersion); From 5255a1bf8ed49963ce8b77f4edc85574d5337a00 Mon Sep 17 00:00:00 2001 From: DorisBDR <121011701+DorisBDR@users.noreply.github.com> Date: Fri, 19 Jan 2024 10:44:58 +0100 Subject: [PATCH 04/12] Update serverGetData.cpp we use signal_status to send some information to the client about on-going requests --- source/server/serverGetData.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/source/server/serverGetData.cpp b/source/server/serverGetData.cpp index ddd36feb..4f1b9c19 100755 --- a/source/server/serverGetData.cpp +++ b/source/server/serverGetData.cpp @@ -1173,7 +1173,8 @@ int read_data(REQUEST_DATA* request, CLIENT_BLOCK client_block, // job done! data_block->source_status = data_source->status; - data_block->signal_status = signal_rec->status; + /*in case of CODAC, we are setting information on the signal_status of data_block, so with thic echk, our status is removed which causes some failures in our client. Need to be kept as it or provide another way to stor this information and send it to client, indicates if there are more chunks available to fetch, if file is open and growing, new data can come, everything is ok */ + if(data_block->signal_status == 1) { data_block->signal_status = signal_rec->status; } return 0; } From 9a7c6a26ef48fc7f8588f5d6fdcd704c0d7b6a7c Mon Sep 17 00:00:00 2001 From: Jonathan Hollocombe Date: Wed, 20 Mar 2024 17:53:05 +0000 Subject: [PATCH 05/12] Fixing CLIENT_ONLY build. --- source/logging/CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/logging/CMakeLists.txt b/source/logging/CMakeLists.txt index c39e3edf..ee949009 100755 --- a/source/logging/CMakeLists.txt +++ b/source/logging/CMakeLists.txt @@ -46,7 +46,9 @@ if( NOT CLIENT_ONLY ) endif() target_link_libraries( logging-client-objects PUBLIC Boost::boost ) -target_link_libraries( logging-server-objects PUBLIC Boost::boost ) +if( NOT CLIENT_ONLY ) + target_link_libraries( logging-server-objects PUBLIC Boost::boost ) +endif() file( GLOB HEADER_FILES "*.h" ) From 3fb39f5cf978e83b1054f03727120f19f64e8a5e Mon Sep 17 00:00:00 2001 From: Jonathan Hollocombe Date: Mon, 24 Jun 2024 09:58:25 +0100 Subject: [PATCH 06/12] Fixing keyvalue plugin. --- source/plugins/keyvalue/keyvaluePlugin.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/plugins/keyvalue/keyvaluePlugin.cpp b/source/plugins/keyvalue/keyvaluePlugin.cpp index e690ec95..fc80555e 100755 --- a/source/plugins/keyvalue/keyvaluePlugin.cpp +++ b/source/plugins/keyvalue/keyvaluePlugin.cpp @@ -51,7 +51,7 @@ int keyValue(IDAM_PLUGIN_INTERFACE* plugin_interface) plugin_interface->pluginVersion = THISPLUGIN_VERSION; - REQUEST_BLOCK* request_block = plugin_interface->request_block; + REQUEST_DATA* request_block = plugin_interface->request_data; int rc = 0; @@ -84,7 +84,7 @@ int uda::keyvalue::Plugin::init(IDAM_PLUGIN_INTERFACE* plugin_interface) initPlugin(plugin_interface); #endif - REQUEST_BLOCK* request_block = plugin_interface->request_block; + REQUEST_DATA* request_block = plugin_interface->request_data; if (!initialised_ || !strcasecmp(request_block->function, "init") || !strcasecmp(request_block->function, "initialise")) { @@ -109,7 +109,7 @@ int uda::keyvalue::Plugin::init(IDAM_PLUGIN_INTERFACE* plugin_interface) void uda::keyvalue::Plugin::reset(IDAM_PLUGIN_INTERFACE* plugin_interface) { - REQUEST_BLOCK* request_block = plugin_interface->request_block; + REQUEST_DATA* request_block = plugin_interface->request_data; if (plugin_interface->housekeeping || !strcasecmp(request_block->function, "reset")) { if (!initialised_) return; @@ -248,8 +248,8 @@ int uda::keyvalue::Plugin::write(IDAM_PLUGIN_INTERFACE* plugin_interface) const char* key = nullptr; const char* value = nullptr; - FIND_REQUIRED_STRING_VALUE(plugin_interface->request_block->nameValueList, key); - FIND_REQUIRED_STRING_VALUE(plugin_interface->request_block->nameValueList, value); + FIND_REQUIRED_STRING_VALUE(plugin_interface->request_data->nameValueList, key); + FIND_REQUIRED_STRING_VALUE(plugin_interface->request_data->nameValueList, value); char* env = getenv("UDA_PLUGIN_KEYVALUE_STORE"); if (env == nullptr) { @@ -276,7 +276,7 @@ int uda::keyvalue::Plugin::read(IDAM_PLUGIN_INTERFACE* plugin_interface) { const char* key = nullptr; - FIND_REQUIRED_STRING_VALUE(plugin_interface->request_block->nameValueList, key); + FIND_REQUIRED_STRING_VALUE(plugin_interface->request_data->nameValueList, key); char* env = getenv("UDA_PLUGIN_KEYVALUE_STORE"); if (env == nullptr) { @@ -308,7 +308,7 @@ int uda::keyvalue::Plugin::del(IDAM_PLUGIN_INTERFACE* plugin_interface) { const char* key = nullptr; - FIND_REQUIRED_STRING_VALUE(plugin_interface->request_block->nameValueList, key); + FIND_REQUIRED_STRING_VALUE(plugin_interface->request_data->nameValueList, key); char* env = getenv("UDA_PLUGIN_KEYVALUE_STORE"); if (env == nullptr) { From 29fe35d808a10602d7ec0f587564447245994989 Mon Sep 17 00:00:00 2001 From: Jonathan Hollocombe Date: Mon, 24 Jun 2024 10:02:56 +0100 Subject: [PATCH 07/12] Updating Java cmake. --- source/wrappers/java/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/wrappers/java/CMakeLists.txt b/source/wrappers/java/CMakeLists.txt index 4dc6ded8..d2903303 100755 --- a/source/wrappers/java/CMakeLists.txt +++ b/source/wrappers/java/CMakeLists.txt @@ -18,7 +18,7 @@ endif() include( UseJava ) -set( CMAKE_JAVA_COMPILE_FLAGS "-source" "1.6" "-target" "1.6" ) +set( CMAKE_JAVA_COMPILE_FLAGS "-source" "1.8" "-target" "1.8" ) include_directories( ${CMAKE_SOURCE_DIR}/source From e78d835dc5fa2b70645f333d617a8bcedcf38e3e Mon Sep 17 00:00:00 2001 From: stephen-dixon <68229525+stephen-dixon@users.noreply.github.com> Date: Tue, 3 Sep 2024 11:36:01 +0100 Subject: [PATCH 08/12] Feature/python wheels windows (#47) building pyuda wheels for windows and merging in upstream changes from main at release 2.7.6 --- .clang-format | 8 + .gitattributes | 1 + .github/workflows/build_wheels.yml | 284 + .github/workflows/cmake.yml | 106 +- CMakeLists.txt | 39 +- cmake/DetermineVersion.cmake | 53 + cmake/plugins.cmake | 13 +- ...nt.centos.8 => client.centos.8.dockerfile} | 0 ...u.22.10 => client.ubuntu.22.04.dockerfile} | 2 +- extlib/GSL-4.0.0/include/gsl/span | 8 +- extlib/portablexdr-4.9.1/CMakeLists.txt | 16 +- extlib/portablexdr-4.9.1/Makefile.in | 25 +- extlib/portablexdr-4.9.1/aclocal.m4 | 270 +- extlib/portablexdr-4.9.1/byteswap.h | 2 +- extlib/portablexdr-4.9.1/config.h.in | 3 - extlib/portablexdr-4.9.1/configure | 5427 +++-- extlib/portablexdr-4.9.1/rpc/types.h | 17 +- extlib/portablexdr-4.9.1/rpc/xdr.h | 134 +- extlib/portablexdr-4.9.1/rpcgen_main.c | 4 +- extlib/portablexdr-4.9.1/rpcgen_scan.c | 36 +- extlib/portablexdr-4.9.1/xdr.c | 55 +- extlib/portablexdr-4.9.1/xdr_array.c | 32 +- extlib/portablexdr-4.9.1/xdr_float.c | 16 +- extlib/portablexdr-4.9.1/xdr_mem.c | 26 +- extlib/portablexdr-4.9.1/xdr_rec.c | 122 +- extlib/portablexdr-4.9.1/xdr_reference.c | 12 +- extlib/portablexdr-4.9.1/xdr_stdio.c | 6 +- scripts/create_certs.sh | 18 + source/CMakeLists.txt | 38 +- source/authentication/CMakeLists.txt | 9 +- source/authentication/udaClientSSL.cpp | 60 +- source/authentication/udaClientSSL.h | 21 +- source/authentication/udaServerSSL.cpp | 153 +- source/authentication/udaServerSSL.h | 6 +- source/authentication/utils.cpp | 19 + source/authentication/utils.h | 8 + source/bin/CMakeLists.txt | 5 + source/client/CMakeLists.txt | 4 +- source/client/accAPI.cpp | 52 +- source/client/accAPI.h | 33 +- source/client/clientXDRStream.cpp | 6 +- source/client/connection.cpp | 3 + source/client/connection.h | 2 +- source/client/legacy_accAPI.h | 185 + source/client/legacy_client.h | 26 + source/client/udaClient.cpp | 38 +- source/client/udaGetAPI.cpp | 20 +- source/client2/CMakeLists.txt | 18 +- source/client2/client.cpp | 6 +- source/client2/client_xdr_stream.cpp | 6 +- source/client2/closedown.cpp | 2 +- source/client2/connection.cpp | 13 +- source/client2/connection.hpp | 2 +- source/client2/windows_defines.hpp | 6 + source/clientserver/compressDim.cpp | 9 +- source/clientserver/memstream_win.cpp | 2 +- source/clientserver/protocol.h | 4 + source/clientserver/protocol2.cpp | 6 +- source/clientserver/protocolXML.cpp | 9 + source/clientserver/udaDefines.h | 2 +- source/clientserver/xdrlib.cpp | 12 - source/clientserver/xdrlib.h | 4 - source/etc/machine.d/github-ci-ssl.cfg | 4 + source/etc/machine.d/mast.l.cfg | 2 + source/etc/uda-cpp.pc.in | 2 +- source/etc/uda-fat-cpp.pc.in | 2 +- source/etc/uda.socket.in | 13 + source/etc/uda@.service.in | 16 + source/etc/udaserver.cfg.in | 4 +- source/plugins/bytes/CMakeLists.txt | 10 + source/plugins/bytes/bytesPlugin.cpp | 50 +- source/plugins/keyvalue/keyvaluePlugin.cpp | 28 +- source/plugins/template/templatePlugin.cpp | 2 +- source/plugins/uda/uda_plugin.cpp | 33 +- source/server/CMakeLists.txt | 8 +- source/server/createXDRStream.cpp | 6 +- source/server/getServerEnvironment.cpp | 8 +- source/server/serverSubsetData.cpp | 43 +- source/server2/CMakeLists.txt | 19 +- source/server2/server.hpp | 7 +- source/server2/server_main.cpp | 2 +- source/server2/xdr_protocol.cpp | 7 +- source/structures/CMakeLists.txt | 6 +- source/uda.h | 2 + source/wrappers/CMakeLists.txt | 6 +- source/wrappers/c++/client.cpp | 145 +- source/wrappers/c++/client.hpp | 60 +- source/wrappers/fortran/accAPI_F.c | 10 +- source/wrappers/idl/idam_dlm.c | 294 +- source/wrappers/java/idam_jni.c | 14 +- source/wrappers/java/idam_jni.h | 14 +- source/wrappers/java/jIdam/Idam.java | 14 +- source/wrappers/python/CMakeLists.txt | 38 +- source/wrappers/python/README.md | 19 + source/wrappers/python/pyproject.toml | 37 + .../wrappers/python/pyuda/cpyuda/client.pyx | 10 +- .../wrappers/python/pyuda/cpyuda/cpyuda.pyx | 2 +- source/wrappers/python/pyuda/cpyuda/uda.pxd | 6 +- source/wrappers/python/setup.py.in | 22 +- source/wrappers/python/uda/__init__.py | 24 + source/wrappers/python/win.setup.py.in | 94 + test/CMakeLists.txt | 1 + test/catch.hpp | 17405 ++++++++-------- test/plugins/test_testplugin.cpp | 3 +- 104 files changed, 13968 insertions(+), 12048 deletions(-) create mode 100644 .clang-format create mode 100644 .gitattributes create mode 100644 .github/workflows/build_wheels.yml create mode 100644 cmake/DetermineVersion.cmake rename docker/{client.centos.8 => client.centos.8.dockerfile} (100%) rename docker/{client.ubuntu.22.10 => client.ubuntu.22.04.dockerfile} (98%) create mode 100755 scripts/create_certs.sh mode change 100755 => 100644 source/authentication/udaClientSSL.h mode change 100755 => 100644 source/authentication/udaServerSSL.cpp create mode 100644 source/authentication/utils.cpp create mode 100644 source/authentication/utils.h create mode 100644 source/client/legacy_accAPI.h create mode 100644 source/client/legacy_client.h create mode 100644 source/client2/windows_defines.hpp create mode 100644 source/etc/machine.d/github-ci-ssl.cfg create mode 100644 source/etc/uda.socket.in create mode 100644 source/etc/uda@.service.in create mode 100644 source/wrappers/python/README.md create mode 100644 source/wrappers/python/pyproject.toml create mode 100644 source/wrappers/python/uda/__init__.py create mode 100644 source/wrappers/python/win.setup.py.in mode change 100755 => 100644 test/catch.hpp diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..153b9d47 --- /dev/null +++ b/.clang-format @@ -0,0 +1,8 @@ +BasedOnStyle: LLVM +BreakBeforeBraces: Linux +AllowShortIfStatementsOnASingleLine: false +IndentWidth: 4 +DerivePointerAlignment: false +PointerAlignment: Left +ColumnLimit: 120 +IndentCaseLabels: true \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000..2b663cc8 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +CMakeLists.txt export-subst diff --git a/.github/workflows/build_wheels.yml b/.github/workflows/build_wheels.yml new file mode 100644 index 00000000..2d3d518f --- /dev/null +++ b/.github/workflows/build_wheels.yml @@ -0,0 +1,284 @@ +name: build and upload wheels + +# Currently we aim to test building python wheels for all pushes to feature and release branches +# HOWEVER we only want to upload these wheels to testpypi for release candidates, which are considered +# to be pushes to a release branch or to develop. +# finally, we only push tagged releases to pypi proper. Note that only a subset of platforms are considered +# for test builds and the full suite (including longer-running builds) is only run on pushes to tags. +# This is controlled using conditional statements for individual jobs and steps in this script. +on: + push: + tags: + - '*' + branches: + - release/* + - feature/* + - main + - develop + +jobs: + build_wheels: + name: build ${{matrix.build-platform[2]}} wheels on ${{matrix.build-platform[0]}} ${{matrix.build-platform[1]}} + runs-on: ${{matrix.build-platform[0]}} + strategy: + fail-fast: false + matrix: + build-platform: + # ubuntu/aarch64 emulation and manylinux2014 are both slow running builds + # which are only executed on push to tag. + # Test wheels are also generated for the other platforms (and uploaded to testpypi) + # on pushes to release branches and to main + - [ubuntu-latest, x86_64, manylinux2014_x86_64] + - [ubuntu-latest, x86_64, manylinux_2_28_x86_64] + - [ubuntu-latest, aarch64, manylinux_2_28_aarch64] + - [macos-13, x86_64, macosx_x86_64] + - [macos-14, arm64, macosx_arm64] + - [windows-latest, AMD64, win_amd64] + + steps: + - uses: actions/checkout@v3 + # need git tags available for setuptools_scm to grab tags + with: + fetch-depth: 0 + + - uses: actions/github-script@v6 + with: + script: | + core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); + core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); + + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: install windows deps + if: runner.os == 'Windows' + run: > + vcpkg install --triplet x64-windows-static-md --binarysource="clear;x-gha,readwrite" + libxml2 + capnproto + boost-program-options + boost-format + boost-algorithm + boost-multi-array + openssl + dlfcn-win32 + spdlog + + - name: build uda on windows + if: runner.os == 'Windows' + env: + XDR_ROOT: extlib/install + CMAKE_PREFIX_PATH: C:/vcpkg/installed/x64-windows-static-md + Boost_DIR: C:/vcpkg/installed/x64-windows-static-md/share/boost + LibXml2_DIR: C:/vcpkg/installed/x64-windows-static-md/share/libxml2 + CapnProto_DIR: C:/vcpkg/installed/x64-windows-static-md/share/capnproto + fmt_DIR: C:/vcpkg/installed/x64-windows-static-md/share/fmt + run: > + cmake -Bextlib/build ./extlib + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake + -DVCPKG_TARGET_TRIPLET="x64-windows-static-md" + -DVCPKG_HOST_TRIPLET="x64-windows-static-md" + -DCMAKE_GENERATOR_PLATFORM=x64 + -DBUILD_SHARED_LIBS=OFF + && cmake --build extlib/build --config Release + && cmake --install extlib/build --prefix extlib/install + && cmake -Bbuild . + -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake + -DVCPKG_TARGET_TRIPLET="x64-windows-static-md" + -DVCPKG_HOST_TRIPLET="x64-windows-static-md" + -DCMAKE_GENERATOR_PLATFORM=x64 + -DBUILD_SHARED_LIBS=ON + -DSSLAUTHENTICATION=ON + -DCLIENT_ONLY=ON + -DENABLE_CAPNP=ON + -DNO_JAVA_WRAPPER=ON + -DNO_CXX_WRAPPER=ON + -DNO_IDL_WRAPPER=ON + -DNO_CLI=ON + -DNO_MEMCACHE=ON + -DCMAKE_INSTALL_PREFIX=install + && cmake --build build -j --config Release + && cmake --install build --config Release + && ls install/lib + && cat install/python_installer/setup.py + + - name: build windows wheels + if: runner.OS == 'Windows' + uses: pypa/cibuildwheel@v2.17.0 + with: + package-dir: ${{github.workspace}}/install/python_installer + config-file: ${{github.workspace}}/install/python_installer/pyproject.toml + env: + CIBW_ARCHS: ${{matrix.build-platform[1]}} + CIBW_PLATFORM: windows + CIBW_BUILD: cp3*-${{matrix.build-platform[2]}} + CIBW_SKIP: cp36* cp37* + CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel} --add-path ${{github.workspace}}/install/lib" + CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel" + + - name: Build manylinux2014 wheels + # this is a slow-running build. Only execute on tag + if: > + startswith(matrix.build-platform[2], 'manylinux2014') && + github.event_name == 'push' && + startsWith(github.ref, 'refs/tags/') + uses: pypa/cibuildwheel@v2.17.0 + with: + package-dir: ./source/wrappers/python + config-file: ./source/wrappers/python/pyproject.toml + env: + CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 + CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014 + CIBW_ARCHS: ${{matrix.build-platform[1]}} + CIBW_BUILD: cp*-manylinux* + CIBW_SKIP: cp*-musllinux* *-musllinux* + CIBW_BEFORE_ALL: > + sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-* && + sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-* && + yum update -y && + yum install -y wget openssl-devel libxml2-devel libtirpc-devel && + cd /tmp && + wget https://github.com/fmtlib/fmt/archive/refs/tags/10.0.0.tar.gz && + tar xzf 10.0.0.tar.gz && + cd fmt-10.0.0 && + cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON && + cmake --build build -j --config Release --target install && + cd /tmp && + wget https://github.com/gabime/spdlog/archive/refs/tags/v1.11.0.tar.gz && + tar xzf v1.11.0.tar.gz && + cd spdlog-1.11.0 && + cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON && + cmake --build build -j --config Release --target install && + cd /tmp && + wget https://github.com/capnproto/capnproto/archive/refs/tags/v0.10.4.tar.gz && + tar xzf v0.10.4.tar.gz && + cd capnproto-0.10.4 && + cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON && + cmake --build build && + cmake --install build && + cd /tmp && + wget https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz && + tar xzf boost_1_80_0.tar.gz && + cd boost_1_80_0 && + ./bootstrap.sh --prefix=/usr/local && + ./b2 --without-python --prefix=/usr/local install && + cd /project && + cmake -B build -DNO_JAVA_WRAPPER=ON -DBUILD_SHARED_LIBS=ON -DSSLAUTHENTICATION=ON -DENABLE_CAPNP=ON -DCLIENT_ONLY=ON && + cmake --build build -j --config Release --target install && + cp -r /usr/local/python_installer/* /project/source/wrappers/python/ + + - name: Build manylinux_2_28 wheels + # hardware emulation for ubuntu on arm64 archiecture is much slower. Do not run that case except for push to tag. + if: > + startswith(matrix.build-platform[2], 'manylinux_2_28') && + ! ( startswith(matrix.build-platform[1], 'aarch64') && + !startsWith(github.ref, 'refs/tags/') ) + uses: pypa/cibuildwheel@v2.17.0 + with: + package-dir: ./source/wrappers/python + config-file: ./source/wrappers/python/pyproject.toml + env: + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 + CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28 + CIBW_ARCHS: ${{matrix.build-platform[1]}} + CIBW_BUILD: cp*-manylinux* + CIBW_SKIP: cp*-musllinux* *-musllinux* + CIBW_BEFORE_ALL: > + dnf update -y && + dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && + dnf install -y boost-devel openssl-devel libxml2-devel libtirpc-devel + fmt fmt-devel spdlog spdlog-devel capnproto capnproto-devel && + cd /project && + cmake -B build + -DBUILD_SHARED_LIBS=ON + -DCMAKE_BUILD_TYPE=Release + -DSSLAUTHENTICATION=ON + -DNO_JAVA_WRAPPER=ON + -DENABLE_CAPNP=ON -DCLIENT_ONLY=ON && + cmake --build build -j --config Release --target install && + cp -r /usr/local/python_installer/* /project/source/wrappers/python/ + + - name: build uda on macos + if: runner.os == 'macOS' + run: > + brew update-reset && brew install + git + boost + openssl + cmake + libxml2 + spdlog + capnp && + cd ${{github.workspace}} && + cmake -B build + -DBUILD_SHARED_LIBS=ON + -DCMAKE_BUILD_TYPE=Release + -DSSLAUTHENTICATION=ON + -DENABLE_CAPNP=ON + -DNO_JAVA_WRAPPER=ON + -DCMAKE_INSTALL_PREFIX=$PWD/install + -DCLIENT_ONLY=ON && + cmake --build build -j --config Release --target install && + cp -r $PWD/install/python_installer/* ${{github.workspace}}/source/wrappers/python/ + + - name: Build macos wheels + if: runner.os == 'macOS' + uses: pypa/cibuildwheel@v2.17.0 + with: + package-dir: ./source/wrappers/python + config-file: ./source/wrappers/python/pyproject.toml + env: + CIBW_ARCHS: ${{matrix.build-platform[1]}} + CIBW_PLATFORM: macos + CIBW_BUILD: cp*-${{matrix.build-platform[2]}} + + - uses: actions/upload-artifact@v4 + with: + name: cibw-wheels-${{ matrix.os }}-${{ strategy.job-index }} + path: ./wheelhouse/*.whl + + upload_pypi: + # only upload to pypi for tagged releases + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + needs: build_wheels + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/uda + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + # unpacks all CIBW artifacts into dist/ + pattern: cibw-* + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 + + upload_test_pypi: + # push test wheels to testpypi for all intermediate release candidates (release/*, develop, etc.) + # but never for feature branches + if: > + github.event_name == 'push' && !startsWith(github.ref, 'refs/heads/feature/') + needs: build_wheels + runs-on: ubuntu-latest + environment: + name: testpypi + permissions: + id-token: write + steps: + - uses: actions/download-artifact@v4 + with: + # unpacks all CIBW artifacts into dist/ + pattern: cibw-* + path: dist + merge-multiple: true + + - uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 4565cfe6..c8c7b381 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -21,13 +21,15 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] release: [Release] ssl: [ON, OFF] - client-only: [OFF] + client-only: [ON, OFF] capnp: [ON, OFF] -# include: -# - client-only: ON -# ssl: OFF -# - client-only: OFF -# ssl: OFF + exclude: + - os: windows-latest + client-only: OFF + - os: ubuntu-latest + client-only: ON + - os: macos-latest + client-only: ON runs-on: ${{ matrix.os }} @@ -38,7 +40,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: script: | core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); @@ -47,7 +49,7 @@ jobs: - name: Install linux dependencies if: matrix.os == 'ubuntu-latest' run: > - sudo apt-get update && sudo apt-get install -y + sudo apt update && sudo apt install -y git libboost-dev libboost-program-options-dev @@ -64,6 +66,17 @@ jobs: python3-pip python3-venv + - name: Install Intel compiler + if: matrix.os == 'ubuntu-latest' + run: > + sudo apt install -y wget && + wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && + sudo apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB && + echo "deb https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list && + sudo apt update && + sudo apt install -y intel-basekit && + sudo apt install -y intel-hpckit + - name: Install macos dependencies if: matrix.os == 'macos-latest' run: > @@ -111,6 +124,17 @@ jobs: -DCLIENT_ONLY=${{ matrix.client-only }} -DENABLE_CAPNP=${{ matrix.capnp }} + - name: Configure CMake (linux Intel) + if: matrix.os == 'ubuntu-latest' + run: > + source /opt/intel/oneapi/setvars.sh && + CXX=icpx CC=icx cmake -G Ninja -B build-intel + -DBUILD_SHARED_LIBS=ON + -DCMAKE_BUILD_TYPE=${{ matrix.release }} + -DSSLAUTHENTICATION=${{ matrix.ssl }} + -DCLIENT_ONLY=${{ matrix.client-only }} + -DENABLE_CAPNP=${{ matrix.capnp }} + - name: Configure CMake (macos) if: matrix.os == 'macos-latest' run: > @@ -146,10 +170,15 @@ jobs: -DSSLAUTHENTICATION=${{ matrix.ssl }} -DCLIENT_ONLY=${{ matrix.client-only }} -DENABLE_CAPNP=${{ matrix.capnp }} + -DCMAKE_INSTALL_PREFIX=${{github.workspace}}/uda_install - name: Build run: cmake --build build --config ${{ matrix.release }} + - name: Build Intel + if: matrix.os == 'ubuntu-latest' + run: cmake --build build-intel --config ${{ matrix.release }} + - name: Install if: matrix.os != 'windows-latest' run: sudo cmake --install build --config ${{ matrix.release }} @@ -158,20 +187,53 @@ jobs: if: matrix.os == 'windows-latest' run: cmake --install build --config ${{ matrix.release }} -# - name: Install pyuda -# if: matrix.os == 'ubuntu-latest' -# run: > -# cp -r /usr/local/python_installer ${{github.workspace}}/python_installer && -# python3 -m venv ${{github.workspace}}/venv && -# source ${{github.workspace}}/venv/bin/activate && -# pip3 install Cython numpy six && -# pip3 install ${{github.workspace}}/python_installer - -# - name: Test pyuda import -# if: matrix.os == 'ubuntu-latest' -# run: > -# source ${{github.workspace}}/venv/bin/activate && -# python3 -c 'import pyuda; client=pyuda.Client()' + - name: Install pyuda + if: matrix.os == 'ubuntu-latest' + run: > + cp -r /usr/local/python_installer ${{github.workspace}}/python_installer && + python3 -m venv ${{github.workspace}}/venv && + source ${{github.workspace}}/venv/bin/activate && + pip3 install --upgrade pip && + pip3 install wheel Cython "numpy<2" six && + pip3 install ${{github.workspace}}/python_installer + + - name: Test pyuda import + if: matrix.os == 'ubuntu-latest' + run: > + source ${{github.workspace}}/venv/bin/activate && + python3 -c 'import pyuda; client=pyuda.Client()' + + - name: Run non-SSL system tests + if: matrix.os == 'ubuntu-latest' && matrix.ssl == 'OFF' + run: > + sudo cp /usr/local/etc/uda.socket /usr/local/etc/uda@.service /etc/systemd/system && + sudo systemctl start uda.socket && + sudo systemctl enable uda.socket && + sudo chown -R $USER:$USER /usr/local/etc && + nc -4zv localhost 56565 && + export UDA_HOST=localhost && + export UDA_PORT=56565 && + ./build/test/plugins/plugin_test_testplugin + + - name: Run SSL system tests + if: matrix.os == 'ubuntu-latest' && matrix.ssl == 'ON' + run: > + sudo cp /usr/local/etc/uda.socket /usr/local/etc/uda@.service /etc/systemd/system && + sudo chown -R $USER:$USER /usr/local/etc && + echo "export UDAHOSTNAME=github-ci-ssl" >> /usr/local/etc/udaserver.cfg && + ./scripts/create_certs.sh && + mkdir /usr/local/etc/certs && + cp rootCA.crt server.crt server.key /usr/local/etc/certs && + sudo systemctl start uda.socket && + sudo systemctl enable uda.socket && + nc -4zv localhost 56565 && + export UDA_HOST=localhost && + export UDA_PORT=56565 && + export UDA_CLIENT_SSL_AUTHENTICATE=1 && + export UDA_CLIENT_CA_SSL_CERT=$PWD/rootCA.crt && + export UDA_CLIENT_SSL_CERT=$PWD/client.crt && + export UDA_CLIENT_SSL_KEY=$PWD/client.key && + ./build/test/plugins/plugin_test_testplugin # - name: Test # working-directory: build diff --git a/CMakeLists.txt b/CMakeLists.txt index 42748e6f..7b5b28aa 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,6 +28,11 @@ if( CMAKE_VERSION VERSION_GREATER 3.12 ) cmake_policy( SET CMP0075 OLD ) endif() +if( CMAKE_VERSION VERSION_GREATER 3.30 ) + cmake_policy( SET CMP0167 NEW ) + cmake_policy( SET CMP0057 NEW ) +endif() + # Extra cmake modules to find libraries set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} @@ -45,23 +50,12 @@ set( Boost_USE_MULTITHREADED OFF ) ######################################################################################################################## # Version and Machine information -include( GetGitRevisionDescription ) +# Set VERSION and FULL_VERSION from `git describe` +# but use git export attribute for release tarballs +set( GIT_ARCHIVE_DESCRIBE [[$Format:%(describe)$]] ) +include( DetermineVersion ) -git_describe( GIT_TAG --tags ) - -if( "${GIT_TAG}" MATCHES "^.*NOTFOUND$" ) - message( WARNING "Failed to get git revision: ${GIT_TAG}" ) - set( GIT_VERSION "0.0.0" ) -elseif( "${GIT_TAG}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)$" ) - set( GIT_VERSION "${GIT_TAG}" ) -elseif( "${GIT_TAG}" MATCHES "^([0-9]+\\.[0-9]+\\.[0-9]+)-([0-9]+)-.*$" ) - set( GIT_VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}" ) -else() - message( WARNING "invalid git tag for version parsing: ${GIT_TAG}" ) - set( GIT_VERSION "0.0.0" ) -endif() - -project( uda VERSION ${GIT_VERSION} ) +project( uda VERSION ${VERSION} ) set( USER $ENV{USER} ) @@ -86,11 +80,15 @@ if( "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" ) endif() if( CMAKE_VERSION VERSION_GREATER 3.0.9 ) - if( CMAKE_C_COMPILER_ID STREQUAL "Intel" ) + if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM" ) set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17" ) else() - set( CMAKE_CXX_STANDARD 17 ) + if( WIN32 AND MSVC ) + set( CMAKE_CXX_STANDARD 20 ) + else() + set( CMAKE_CXX_STANDARD 17 ) + endif() set( CMAKE_CXX_STANDARD_REQUIRED ON ) # C++ extension = OFF to use STD instead GNU set( CMAKE_CXX_EXTENSIONS OFF ) @@ -102,7 +100,7 @@ else() set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99" ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" ) - if( NOT APPLE ) + if( NOT APPLE AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM") ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-use-after-free" ) endif() endif() @@ -134,7 +132,7 @@ add_definitions( ) if( WIN32 OR MINGW ) - add_definitions( -D_CRT_SECURE_NO_WARNINGS ) + add_definitions( -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX ) set( CMAKE_FIND_LIBRARY_PREFIXES "lib" "" ) set( CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".dll.lib" ".a" ".lib" ) if( MINGW ) @@ -171,6 +169,7 @@ option( NO_PYTHON_WRAPPER "Don't build Python wrapper" OFF ) option( NO_JAVA_WRAPPER "Don't build Java wrapper" OFF ) option( NO_IDL_WRAPPER "Don't build IDL wrapper" OFF ) option( FAT_IDL "Build IDL wrapper using fat-client" OFF ) +option( NO_CLI "Don't build UDA CLI" OFF ) if( SERVER_ONLY ) if( CLIENT_ONLY OR NO_WRAPPERS OR FAT_IDL ) diff --git a/cmake/DetermineVersion.cmake b/cmake/DetermineVersion.cmake new file mode 100644 index 00000000..5c4399ee --- /dev/null +++ b/cmake/DetermineVersion.cmake @@ -0,0 +1,53 @@ +# Determine the version of the current AL component, based on git describe + +if( NOT GIT_ARCHIVE_DESCRIBE ) + message( FATAL_ERROR "GIT_ARCHIVE_DESCRIBE should be set before including ALDetermineVersion" ) +endif() + +if( NOT GIT_ARCHIVE_DESCRIBE MATCHES "^.Format:%.describe" ) + # We are part of an exported tarball and git-archive set the describe content: + set( _GIT_DESCRIBE_ERROR_CODE 0 ) + set( _GIT_DESCRIBE_OUTPUT "${GIT_ARCHIVE_DESCRIBE}" ) +else() + # Ask git for a describe: + find_package( Git ) + if( GIT_EXECUTABLE ) + # Generate a git-describe version string from Git repository tags + execute_process( + COMMAND ${GIT_EXECUTABLE} describe --tags --dirty + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + OUTPUT_VARIABLE _GIT_DESCRIBE_OUTPUT + RESULT_VARIABLE _GIT_DESCRIBE_ERROR_CODE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + endif() +endif() + +# Process git describe output: +if( _GIT_DESCRIBE_OUTPUT AND NOT _GIT_DESCRIBE_ERROR_CODE ) + # Git describe should return the version (MAJOR.MINOR.PATCH) and potentially + # a suffix "--g[-dirty]" + # Use a regex to extract all parts: + if( _GIT_DESCRIBE_OUTPUT MATCHES "([0-9]+)[.]([0-9]+)[.]*([0-9]+)(.*)" ) + set( VERSION "${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}" ) + if( CMAKE_MATCH_4 MATCHES "-([0-9]+)-(.*)" ) + # Use ncommits as fourth version component for the CMAKE project version + set( VERSION "${VERSION}.${CMAKE_MATCH_1}" ) + endif() + else() + message( FATAL_ERROR "Unexpected output of git describe: '${_GIT_DESCRIBE_OUTPUT}'") + endif() + + # Generate a version string that conforms to the Python standards + # e.g. 5.1.0-3-g7c620eb5-dirty becomes 5.1.0+3-g7c620eb5-dirty + string( REGEX REPLACE "-(.*)$" "+\\1" FULL_VERSION ${_GIT_DESCRIBE_OUTPUT} ) + message( VERBOSE "Determined project version: ${VERSION}" ) +endif() + +# Fallback: git not found, or git describe fails +# Set version to 0.0.0 and report a warning +if( NOT DEFINED VERSION ) + set( VERSION "0.0.0" ) + set( FULL_VERSION "0.0.0+unknown" ) + message( WARNING "Failed to determine VERSION from git tags. Falling back to default version '${VERSION}'" ) +endif() diff --git a/cmake/plugins.cmake b/cmake/plugins.cmake index ffd993a5..d8ff8086 100755 --- a/cmake/plugins.cmake +++ b/cmake/plugins.cmake @@ -2,12 +2,15 @@ macro( filter_lib_list INPUT OUTPUT GOOD BAD ) set( LIB_LST ${INPUT} ) set( USE_LIB YES ) foreach( ELEMENT IN LISTS LIB_LST ) + # Expected sequence [] [[] ] [...] if( "${ELEMENT}" STREQUAL "general" OR "${ELEMENT}" STREQUAL "${GOOD}" ) set( USE_LIB YES ) elseif( "${ELEMENT}" STREQUAL "${BAD}" ) set( USE_LIB NO ) elseif( USE_LIB ) list( APPEND ${OUTPUT} ${ELEMENT} ) + else() + set( USE_LIB YES ) endif() endforeach() endmacro( filter_lib_list ) @@ -81,7 +84,7 @@ macro( uda_plugin ) foreach( DEF ${PLUGIN_EXTRA_DEFINITIONS} ) add_definitions( ${DEF} ) endforeach() - + set( LIBRARIES client-shared plugins-shared ${OPENSSL_LIBRARIES} ) if( ENABLE_CAPNP ) set( LIBRARIES ${LIBRARIES} serialisation-static ) @@ -97,12 +100,12 @@ macro( uda_plugin ) else() set( LIBRARIES ${LIBRARIES} dl stdc++ ) endif() - - filter_lib_list( "${PLUGIN_EXTRA_LINK_LIBS}" FILTERED_LINK_LIBS debug optimized ) + + filter_lib_list( "${PLUGIN_EXTRA_LINK_LIBS}" FILTERED_LINK_LIBS debug optimized ) set( LIBRARIES ${LIBRARIES} ${FILTERED_LINK_LIBS} ) - + target_link_libraries( ${PLUGIN_LIBNAME} PRIVATE ${LIBRARIES} ) - + install( TARGETS ${PLUGIN_LIBNAME} DESTINATION lib/plugins diff --git a/docker/client.centos.8 b/docker/client.centos.8.dockerfile similarity index 100% rename from docker/client.centos.8 rename to docker/client.centos.8.dockerfile diff --git a/docker/client.ubuntu.22.10 b/docker/client.ubuntu.22.04.dockerfile similarity index 98% rename from docker/client.ubuntu.22.10 rename to docker/client.ubuntu.22.04.dockerfile index 9081be9c..ead1e70b 100644 --- a/docker/client.ubuntu.22.10 +++ b/docker/client.ubuntu.22.04.dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.10 +FROM ubuntu:22.04 SHELL ["/bin/bash", "-c"] diff --git a/extlib/GSL-4.0.0/include/gsl/span b/extlib/GSL-4.0.0/include/gsl/span index cc8a7b9b..f969c973 100644 --- a/extlib/GSL-4.0.0/include/gsl/span +++ b/extlib/GSL-4.0.0/include/gsl/span @@ -125,10 +125,10 @@ namespace details : begin_(begin), end_(end), current_(current) {} - constexpr operator span_iterator() const noexcept - { - return {begin_, end_, current_}; - } +// explicit constexpr operator span_iterator() const noexcept +// { +// return {begin_, end_, current_}; +// } constexpr reference operator*() const noexcept { diff --git a/extlib/portablexdr-4.9.1/CMakeLists.txt b/extlib/portablexdr-4.9.1/CMakeLists.txt index 479836af..2e760367 100644 --- a/extlib/portablexdr-4.9.1/CMakeLists.txt +++ b/extlib/portablexdr-4.9.1/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required( VERSION 3.14 ) +cmake_minimum_required( VERSION 2.8.11 ) cmake_policy( SET CMP0048 NEW ) @@ -24,13 +24,18 @@ endif() set( SOURCES xdr_array.c xdr_float.c xdr_mem.c xdr_reference.c xdr.c xdr_intXX_t.c xdr_rec.c xdr_stdio.c ) configure_file( - config.h.in - ${CMAKE_BINARY_DIR}/config.h + config.h.in + ${CMAKE_BINARY_DIR}/config.h ) include_directories( ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR} ) -add_library( ${PROJECT_NAME} SHARED ${SOURCES} ) +option( BUILD_SHARED_LIBS "build xdrlib as a shared library" ON ) +if( BUILD_SHARED_LIBS ) + add_library( ${PROJECT_NAME} SHARED ${SOURCES} ) +else() + add_library( ${PROJECT_NAME} STATIC ${SOURCES} ) +endif() install( FILES rpc/rpc.h rpc/types.h rpc/xdr.h ${CMAKE_BINARY_DIR}/config.h @@ -40,4 +45,5 @@ install( install( TARGETS ${PROJECT_NAME} DESTINATION lib -) \ No newline at end of file +) + diff --git a/extlib/portablexdr-4.9.1/Makefile.in b/extlib/portablexdr-4.9.1/Makefile.in index dd32eb83..018821e9 100644 --- a/extlib/portablexdr-4.9.1/Makefile.in +++ b/extlib/portablexdr-4.9.1/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.10.3 from Makefile.am. +# Makefile.in generated by automake 1.10.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, -# Inc. +# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -179,7 +178,6 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ RANLIB = @RANLIB@ @@ -562,7 +560,7 @@ clean-libtool: -rm -rf .libs _libs distclean-libtool: - -rm -f libtool config.lt + -rm -f libtool install-nobase_includeHEADERS: $(nobase_include_HEADERS) @$(NORMAL_INSTALL) test -z "$(includedir)" || $(MKDIR_P) "$(DESTDIR)$(includedir)" @@ -588,7 +586,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ - $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS @@ -658,8 +656,7 @@ distdir: $(DISTFILES) || exit 1; \ fi; \ done - -find "$(distdir)" -type d ! -perm -755 \ - -exec chmod u+rwx,go+rx {} \; -o \ + -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ @@ -819,8 +816,6 @@ dvi-am: html: html-am -html-am: - info: info-am info-am: @@ -829,28 +824,18 @@ install-data-am: install-nobase_includeHEADERS install-dvi: install-dvi-am -install-dvi-am: - install-exec-am: install-binPROGRAMS install-libLTLIBRARIES install-html: install-html-am -install-html-am: - install-info: install-info-am -install-info-am: - install-man: install-pdf: install-pdf-am -install-pdf-am: - install-ps: install-ps-am -install-ps-am: - installcheck-am: maintainer-clean: maintainer-clean-am diff --git a/extlib/portablexdr-4.9.1/aclocal.m4 b/extlib/portablexdr-4.9.1/aclocal.m4 index a2a9d95a..255ecd4f 100644 --- a/extlib/portablexdr-4.9.1/aclocal.m4 +++ b/extlib/portablexdr-4.9.1/aclocal.m4 @@ -1,7 +1,7 @@ -# generated automatically by aclocal 1.10.3 -*- Autoconf -*- +# generated automatically by aclocal 1.10.1 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -13,113 +13,13 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(AC_AUTOCONF_VERSION, [2.63],, +[m4_warning([this file was generated for autoconf 2.63. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software -# Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) - -# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -134,7 +34,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. -m4_if([$1], [1.10.3], [], +m4_if([$1], [1.10.1], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) @@ -148,12 +48,12 @@ m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. -# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +# This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], -[AM_AUTOMAKE_VERSION([1.10.3])dnl +[AM_AUTOMAKE_VERSION([1.10.1])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) +_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- @@ -243,14 +143,14 @@ AC_CONFIG_COMMANDS_PRE( Usually this means the macro was only invoked conditionally.]]) fi])]) -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 10 +# serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, @@ -307,16 +207,6 @@ AC_CACHE_CHECK([dependency style of $depcc], if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi - am__universal=false - m4_case([$1], [CC], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac], - [CXX], - [case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac]) - for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and @@ -334,17 +224,7 @@ AC_CACHE_CHECK([dependency style of $depcc], done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested @@ -354,23 +234,19 @@ AC_CACHE_CHECK([dependency style of $depcc], break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; none) break ;; esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message @@ -427,68 +303,57 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl # Generate code to set up dependency tracking. -*- Autoconf -*- -# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -#serial 5 +#serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], -[{ - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`AS_DIRNAME("$mf")` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`AS_DIRNAME(["$file"])` - AS_MKDIR_P([$dirpart/$fdir]) - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" - done +[for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" done -} +done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS @@ -508,7 +373,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# 2005, 2006, 2008 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, @@ -582,8 +447,8 @@ AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) -AC_REQUIRE([AM_PROG_INSTALL_SH])dnl -AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AM_PROG_INSTALL_SH +AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. @@ -718,14 +583,14 @@ AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) -# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 6 +# serial 5 # AM_PROG_CC_C_O # -------------- @@ -737,9 +602,8 @@ AC_REQUIRE_AUX_FILE([compile])dnl # FIXME: we rely on the cache variable name because # there is no other way. set dummy $CC -am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then +ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. @@ -817,13 +681,13 @@ esac # Helper functions for option handling. -*- Autoconf -*- -# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. -# serial 4 +# serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- @@ -840,7 +704,7 @@ AC_DEFUN([_AM_SET_OPTION], # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], -[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) +[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- diff --git a/extlib/portablexdr-4.9.1/byteswap.h b/extlib/portablexdr-4.9.1/byteswap.h index 9316cac8..c7d0cf80 100644 --- a/extlib/portablexdr-4.9.1/byteswap.h +++ b/extlib/portablexdr-4.9.1/byteswap.h @@ -50,7 +50,7 @@ __bswap_16 (unsigned short int __bsx) #ifdef __GNUC__ # define __bswap_32(x) \ (__extension__ \ - ({ unsigned int __bsx = (x); __bswap_constant_32 (__bsx); })) + ({ register unsigned int __bsx = (x); __bswap_constant_32 (__bsx); })) #else static __inline unsigned int __bswap_32 (unsigned int __bsx) diff --git a/extlib/portablexdr-4.9.1/config.h.in b/extlib/portablexdr-4.9.1/config.h.in index 82f4b137..d0a61af1 100644 --- a/extlib/portablexdr-4.9.1/config.h.in +++ b/extlib/portablexdr-4.9.1/config.h.in @@ -73,9 +73,6 @@ /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME -/* Define to the home page for this package. */ -#undef PACKAGE_URL - /* Define to the version of this package. */ #undef PACKAGE_VERSION diff --git a/extlib/portablexdr-4.9.1/configure b/extlib/portablexdr-4.9.1/configure index 87964666..ed4291eb 100644 --- a/extlib/portablexdr-4.9.1/configure +++ b/extlib/portablexdr-4.9.1/configure @@ -1,20 +1,18 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for portablexdr 4.9.1. -# -# -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. -# +# Generated by GNU Autoconf 2.63 for portablexdr 4.9.1. # +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -22,15 +20,23 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; esac + fi + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + as_nl=' ' export as_nl @@ -38,13 +44,7 @@ export as_nl as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -55,7 +55,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in #( + case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -78,6 +78,13 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -87,16 +94,15 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( +case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done IFS=$as_save_IFS ;; @@ -108,16 +114,12 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 + { (exit 1); exit 1; } fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' @@ -129,344 +131,330 @@ export LC_ALL LANGUAGE=C export LANGUAGE +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + + +# Name of the executable. +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + # CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH +$as_unset CDPATH + -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST + if (eval ":") 2>/dev/null; then + as_have_required=yes else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac + as_have_required=no fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes +if as_func_success; then + : else - as_have_required=no + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( + case $as_dir in /*) for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac - as_found=false done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } IFS=$as_save_IFS - if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, -$0: including any error possibly output before this -$0: message. Then install a modern shell, or manually run -$0: the script under such a shell if you do have one." - fi - exit 1 -fi -fi + fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ +fi - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} -} # as_fn_mkdir_p +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith + exitcode=1 + echo positional parameters were not saved. +fi +test $exitcode = 0) || { (exit 1); exit 1; } -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error +( + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : else - as_expr=false + exitcode=1 + echo as_func_success failed. fi -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : else - as_basename=false + exitcode=1 + echo as_func_ret_success failed. fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : else - as_dirname=false + exitcode=1 + echo positional parameters were not saved. fi -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell bug-autoconf@gnu.org about your system, + echo including any error possibly output before this message. + echo This can help us improve future autoconf versions. + echo Configuration will now proceed without shell functions. +} -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= @@ -483,12 +471,9 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -497,18 +482,29 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits exit } + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( +case `echo -n x` in -n*) - case `echo 'xy\c'` in + case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; + *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -523,29 +519,49 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -555,6 +571,7 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + # Check that we are running under the correct shell. SHELL=${CONFIG_SHELL-/bin/sh} @@ -703,11 +720,10 @@ fi -test -n "$DJDIR" || exec 7<&0 &1 +exec 7<&0 &1 # Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` @@ -722,6 +738,7 @@ cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='portablexdr' @@ -729,7 +746,6 @@ PACKAGE_TARNAME='portablexdr' PACKAGE_VERSION='4.9.1' PACKAGE_STRING='portablexdr 4.9.1' PACKAGE_BUGREPORT='' -PACKAGE_URL='' # Factoring default headers for most tests. ac_includes_default="\ @@ -873,7 +889,6 @@ bindir program_transform_name prefix exec_prefix -PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION @@ -965,9 +980,8 @@ do fi case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. @@ -1012,7 +1026,8 @@ do ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1038,7 +1053,8 @@ do ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" + { $as_echo "$as_me: error: invalid feature name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1242,7 +1258,8 @@ do ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1258,7 +1275,8 @@ do ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" + { $as_echo "$as_me: error: invalid package name: $ac_useropt" >&2 + { (exit 1); exit 1; }; } ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in @@ -1288,17 +1306,17 @@ do | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" + -*) { $as_echo "$as_me: error: unrecognized option: $ac_option +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac + expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && + { $as_echo "$as_me: error: invalid variable name: $ac_envvar" >&2 + { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; @@ -1307,7 +1325,7 @@ Try \`$0 --help' for more information" $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac @@ -1315,13 +1333,15 @@ done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" + { $as_echo "$as_me: error: missing argument to $ac_option" >&2 + { (exit 1); exit 1; }; } fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + fatal) { $as_echo "$as_me: error: unrecognized options: $ac_unrecognized_opts" >&2 + { (exit 1); exit 1; }; } ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi @@ -1344,7 +1364,8 @@ do [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" + { $as_echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' @@ -1358,6 +1379,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe + $as_echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1372,9 +1395,11 @@ test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" + { $as_echo "$as_me: error: working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" + { $as_echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } # Find the source files, if location was not specified. @@ -1413,11 +1438,13 @@ else fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" + { $as_echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 + { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + cd "$srcdir" && test -r "./$ac_unique_file" || { $as_echo "$as_me: error: $ac_msg" >&2 + { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then @@ -1457,7 +1484,7 @@ Configuration: --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages + -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files @@ -1542,12 +1569,11 @@ Some influential environment variables: LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor - YACC The `Yet Another Compiler Compiler' implementation to use. - Defaults to the first program found out of: `bison -y', `byacc', - `yacc'. + YACC The `Yet Another C Compiler' implementation to use. Defaults to + the first program found out of: `bison -y', `byacc', `yacc'. YFLAGS The list of arguments that will be passed by default to $YACC. This script will default YFLAGS to the empty string to avoid a default value of `-d' given by some make applications. @@ -1555,7 +1581,6 @@ Some influential environment variables: Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. -Report bugs to the package provider. _ACEOF ac_status=$? fi @@ -1606,385 +1631,34 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -portablexdr configure 4.9.1 -generated by GNU Autoconf 2.69 - -Copyright (C) 2012 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - test -x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno -} # ac_fn_c_check_header_mongrel +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +portablexdr configure 4.9.1 +generated by GNU Autoconf 2.63 + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by portablexdr $as_me 4.9.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -2020,8 +1694,8 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done + $as_echo "PATH: $as_dir" +done IFS=$as_save_IFS } >&5 @@ -2058,9 +1732,9 @@ do ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) - as_fn_append ac_configure_args1 " '$ac_arg'" + ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else @@ -2076,13 +1750,13 @@ do -* ) ac_must_keep_next=true ;; esac fi - as_fn_append ac_configure_args " '$ac_arg'" + ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there @@ -2094,9 +1768,11 @@ trap 'exit_status=$? { echo - $as_echo "## ---------------- ## + cat <<\_ASBOX +## ---------------- ## ## Cache variables. ## -## ---------------- ##" +## ---------------- ## +_ASBOX echo # The following way of writing the cache mishandles newlines in values, ( @@ -2105,13 +1781,13 @@ trap 'exit_status=$? case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; + *) $as_unset $ac_var ;; esac ;; esac done @@ -2130,9 +1806,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; ) echo - $as_echo "## ----------------- ## + cat <<\_ASBOX +## ----------------- ## ## Output variables. ## -## ----------------- ##" +## ----------------- ## +_ASBOX echo for ac_var in $ac_subst_vars do @@ -2145,9 +1823,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; echo if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## + cat <<\_ASBOX +## ------------------- ## ## File substitutions. ## -## ------------------- ##" +## ------------------- ## +_ASBOX echo for ac_var in $ac_subst_files do @@ -2161,9 +1841,11 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; fi if test -s confdefs.h; then - $as_echo "## ----------- ## + cat <<\_ASBOX +## ----------- ## ## confdefs.h. ## -## ----------- ##" +## ----------- ## +_ASBOX echo cat confdefs.h echo @@ -2177,39 +1859,37 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; exit $exit_status ' 0 for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal + trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h -$as_echo "/* confdefs.h */" > confdefs.h - # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF + cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF @@ -2218,12 +1898,7 @@ _ACEOF ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac + ac_site_file1=$CONFIG_SITE elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site @@ -2234,23 +1909,19 @@ fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 + if test -r "$ac_site_file"; then + { $as_echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } + . "$ac_site_file" fi done if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 + # Some versions of bash will fail to source /dev/null (special + # files actually), so we avoid doing that. + if test -f "$cache_file"; then + { $as_echo "$as_me:$LINENO: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; @@ -2258,7 +1929,7 @@ $as_echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -2273,11 +1944,11 @@ for ac_var in $ac_precious_vars; do eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 + { $as_echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; @@ -2287,17 +1958,17 @@ $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 + { $as_echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 + { $as_echo "$as_me:$LINENO: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 + { $as_echo "$as_me:$LINENO: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 + { $as_echo "$as_me:$LINENO: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac @@ -2309,20 +1980,43 @@ $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 + { $as_echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 +$as_echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} + { (exit 1); exit 1; }; } fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## + + + + + + + + + + + + + + + + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -2350,7 +2044,9 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do fi done if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 +$as_echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} + { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, @@ -2376,10 +2072,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : +if test "${ac_cv_path_install+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2387,11 +2083,11 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2399,7 +2095,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2428,7 +2124,7 @@ case $as_dir/ in #(( ;; esac - done +done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir @@ -2444,7 +2140,7 @@ fi INSTALL=$ac_install_sh fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -2455,7 +2151,7 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +{ $as_echo "$as_me:$LINENO: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Just in case sleep 1 @@ -2479,8 +2175,11 @@ if ( # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". - as_fn_error $? "ls -t appears to fail. Make sure there is not a broken -alias in your environment" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&5 +$as_echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken +alias in your environment" >&2;} + { (exit 1); exit 1; }; } fi test "$2" = conftest.file @@ -2489,10 +2188,13 @@ then # Ok. : else - as_fn_error $? "newly created file is older than distributed files! -Check your system clock" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: newly created file is older than distributed files! +Check your system clock" >&5 +$as_echo "$as_me: error: newly created file is older than distributed files! +Check your system clock" >&2;} + { (exit 1); exit 1; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +{ $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" @@ -2513,116 +2215,14 @@ if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 + { $as_echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi -install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} - -# Installed binaries are usually stripped using `strip' when the user -# run `make install-strip'. However `strip' might not be the right -# tool to use in cross-compilation environments, therefore Automake -# will honor the `STRIP' environment variable to overrule this program. -if test "$cross_compiling" != no; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -fi -INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +{ $as_echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then - if ${ac_cv_path_mkdir+:} false; then : + if test "${ac_cv_path_mkdir+set}" = set; then $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR @@ -2630,9 +2230,9 @@ for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in mkdir gmkdir; do + for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -2642,12 +2242,11 @@ do esac done done - done +done IFS=$as_save_IFS fi - test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else @@ -2655,10 +2254,11 @@ fi # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. + test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +{ $as_echo "$as_me:$LINENO: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" @@ -2671,9 +2271,9 @@ for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : +if test "${ac_cv_prog_AWK+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then @@ -2684,24 +2284,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 + { $as_echo "$as_me:$LINENO: result: $AWK" >&5 $as_echo "$AWK" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2709,11 +2309,11 @@ fi test -n "$AWK" && break done -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +{ $as_echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` -if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : +if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF @@ -2721,7 +2321,7 @@ SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF -# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; @@ -2731,11 +2331,11 @@ esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi @@ -2755,7 +2355,9 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then - as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 +$as_echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} + { (exit 1); exit 1; }; } fi fi @@ -2799,6 +2401,108 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} +install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. @@ -2819,27 +2523,35 @@ ac_config_headers="$ac_config_headers config.h" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5 +$as_echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;} + { (exit 1); exit 1; }; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +{ $as_echo "$as_me:$LINENO: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : +if test "${ac_cv_build+set}" = set; then $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 +$as_echo "$as_me: error: cannot guess build type; you must specify one" >&2;} + { (exit 1); exit 1; }; } ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;} + { (exit 1); exit 1; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical build" >&5 +$as_echo "$as_me: error: invalid value of canonical build" >&2;} + { (exit 1); exit 1; }; };; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' @@ -2855,24 +2567,28 @@ IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +{ $as_echo "$as_me:$LINENO: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : +if test "${ac_cv_host+set}" = set; then $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5 +$as_echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;} + { (exit 1); exit 1; }; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +*) { { $as_echo "$as_me:$LINENO: error: invalid value of canonical host" >&5 +$as_echo "$as_me: error: invalid value of canonical host" >&2;} + { (exit 1); exit 1; }; };; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' @@ -2896,9 +2612,9 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -2909,24 +2625,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2936,9 +2652,9 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -2949,24 +2665,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -2975,7 +2691,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -2989,9 +2705,9 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3002,24 +2718,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3029,9 +2745,9 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3043,18 +2759,18 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then @@ -3073,10 +2789,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3088,9 +2804,9 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : +if test "${ac_cv_prog_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$CC"; then @@ -3101,24 +2817,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 + { $as_echo "$as_me:$LINENO: result: $CC" >&5 $as_echo "$CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3132,9 +2848,9 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then @@ -3145,24 +2861,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -3175,7 +2891,7 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -3186,37 +2902,57 @@ fi fi -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +test -z "$CC" && { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } # Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +$as_echo "$as_me:$LINENO: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" +{ (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -v >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compiler -V >&5") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3232,8 +2968,8 @@ ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } +{ $as_echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: @@ -3249,17 +2985,17 @@ do done rm -f $ac_rmfiles -if { { ac_try="$ac_link_default" +if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, @@ -3276,7 +3012,7 @@ do # certainly right. break;; *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi @@ -3295,41 +3031,84 @@ test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 + +{ $as_echo "$as_me:$LINENO: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +if test -z "$ac_file"; then + $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } +{ { $as_echo "$as_me:$LINENO: error: C compiler cannot create executables +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C compiler cannot create executables +See \`config.log' for more details." >&2;} + { (exit 77); exit 77; }; }; } fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } + ac_exeext=$ac_cv_exeext +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 +# If not cross compiling, check that we can run a simple program. +if test "$cross_compiling" != yes; then + if { ac_try='./$ac_file' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } + fi + fi +fi +{ $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +{ $as_echo "$as_me:$LINENO: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +{ $as_echo "$as_me:$LINENO: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" +if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_link") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with @@ -3344,83 +3123,32 @@ for ac_file in conftest.exe conftest conftest.*; do esac done else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 + +rm -f conftest$ac_cv_exeext +{ $as_echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +{ $as_echo "$as_me:$LINENO: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : +if test "${ac_cv_objext+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3432,17 +3160,17 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" +if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_compile") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in @@ -3455,23 +3183,31 @@ else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +{ { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi + rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +{ $as_echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : +if test "${ac_cv_c_compiler_gnu+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3485,16 +3221,37 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else - ac_compiler_gnu=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes @@ -3503,16 +3260,20 @@ else fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +{ $as_echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : +if test "${ac_cv_prog_cc_g+set}" = set; then $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3523,11 +3284,35 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3538,12 +3323,36 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : else - ac_c_werror_flag=$ac_save_c_werror_flag + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3554,17 +3363,42 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -3581,18 +3415,23 @@ else CFLAGS= fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +{ $as_echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : +if test "${ac_cv_prog_cc_c89+set}" = set; then $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include -struct stat; +#include +#include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); @@ -3644,9 +3483,32 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi + rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done @@ -3657,19 +3519,17 @@ fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 + { $as_echo "$as_me:$LINENO: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 + { $as_echo "$as_me:$LINENO: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac -if test "x$ac_cv_prog_cc_c89" != xno; then : -fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' @@ -3688,7 +3548,7 @@ am__doit: .PHONY: am__doit END # If we don't find an include directive, just comment out the code. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +{ $as_echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= @@ -3716,12 +3576,12 @@ if test "$am__include" = "#"; then fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +{ $as_echo "$as_me:$LINENO: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. -if test "${enable_dependency_tracking+set}" = set; then : +if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi @@ -3741,9 +3601,9 @@ fi depcc="$CC" am_compiler_list= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +{ $as_echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } -if ${am_cv_CC_dependencies_compiler_type+:} false; then : +if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then @@ -3769,11 +3629,6 @@ else if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi - am__universal=false - case " $depcc " in #( - *\ -arch\ *\ -arch\ *) am__universal=true ;; - esac - for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and @@ -3791,17 +3646,7 @@ else done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf - # We check with `-c' and `-o' for the sake of the "dashmstdout" - # mode. It turns out that the SunPro C++ compiler does not properly - # handle `-M -o', and we need to detect this. Also, some Intel - # versions had trouble with output in subdirs - am__obj=sub/conftest.${OBJEXT-o} - am__minus_obj="-o $am__obj" case $depmode in - gcc) - # This depmode causes a compiler race in universal mode. - test "$am__universal" = false || continue - ;; nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested @@ -3811,23 +3656,19 @@ else break fi ;; - msvisualcpp | msvcmsys) - # This compiler won't grok `-c -o', but also, the minuso test has - # not run yet. These depmodes are late enough in the game, and - # so weak that their functioning should not be impacted. - am__obj=conftest.${OBJEXT-o} - am__minus_obj= - ;; none) break ;; esac + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. if depmode=$depmode \ - source=sub/conftest.c object=$am__obj \ + source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ - $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && - grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message @@ -3851,7 +3692,7 @@ else fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +{ $as_echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type @@ -3867,18 +3708,22 @@ fi if test "x$CC" != xcc; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 + { $as_echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5 $as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 + { $as_echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5 $as_echo_n "checking whether cc understands -c and -o together... " >&6; } fi set dummy $CC; ac_cc=`$as_echo "$2" | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : +if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -3894,109 +3739,202 @@ _ACEOF # existing .o file with -o, though they will create one. ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* -if { { case "(($ac_try" in +if { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest2.$ac_objext && { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then eval ac_cv_prog_cc_${ac_cc}_c_o=yes if test "x$CC" != xcc; then # Test first that cc exists at all. if { ac_try='cc -c conftest.$ac_ext >&5' - { { case "(($ac_try" in + { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' rm -f conftest2.* - if { { case "(($ac_try" in + if { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$ac_try") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && - test -f conftest2.$ac_objext && { { case "(($ac_try" in + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest2.$ac_objext && { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; - then - # cc works too. - : - else - # cc exists but doesn't like -o. - eval ac_cv_prog_cc_${ac_cc}_c_o=no - fi - fi - fi -else - eval ac_cv_prog_cc_${ac_cc}_c_o=no -fi -rm -f core conftest* +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + +cat >>confdefs.h <<\_ACEOF +#define NO_MINUS_C_MINUS_O 1 +_ACEOF + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in + ./ | .// | /cC/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac -fi -if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } +done +IFS=$as_save_IFS -$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h +rm -rf conftest.one conftest.two conftest.dir fi - -# FIXME: we rely on the cache variable name because -# there is no other way. -set dummy $CC -am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` -eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o -if test "$am_t" != yes; then - # Losing compiler, so override with the script. - # FIXME: It is wrong to rewrite CC. - # But if we don't then we get into trouble of one sort or another. - # A longer-term fix would be to have automake use am__CC in this case, - # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" - CC="$am_aux_dir/compile $CC" + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi fi +{ $as_echo "$as_me:$LINENO: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' case `pwd` in *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 + { $as_echo "$as_me:$LINENO: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac @@ -4019,9 +3957,9 @@ macro_revision='1.3012' ltmain="$ac_aux_dir/ltmain.sh" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +{ $as_echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : +if test "${ac_cv_path_SED+set}" = set; then $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ @@ -4029,7 +3967,7 @@ else ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} + $as_unset ac_script || ac_script= if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST @@ -4038,10 +3976,10 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do + for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_SED" || continue + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in @@ -4058,7 +3996,7 @@ case `"$ac_path_SED" --version 2>&1` in $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" @@ -4073,17 +4011,19 @@ esac $ac_path_SED_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable sed could be found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable sed could be found in \$PATH" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_SED=$SED fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed @@ -4101,9 +4041,9 @@ Xsed="$SED -e 1s/^X//" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +{ $as_echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : +if test "${ac_cv_path_GREP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then @@ -4114,10 +4054,10 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do + for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_GREP" || continue + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in @@ -4134,7 +4074,7 @@ case `"$ac_path_GREP" --version 2>&1` in $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" @@ -4149,24 +4089,26 @@ esac $ac_path_GREP_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +{ $as_echo "$as_me:$LINENO: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : +if test "${ac_cv_path_EGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 @@ -4180,10 +4122,10 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do + for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_EGREP" || continue + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in @@ -4200,7 +4142,7 @@ case `"$ac_path_EGREP" --version 2>&1` in $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" @@ -4215,10 +4157,12 @@ esac $ac_path_EGREP_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP @@ -4226,14 +4170,14 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +{ $as_echo "$as_me:$LINENO: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : +if test "${ac_cv_path_FGREP+set}" = set; then $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 @@ -4247,10 +4191,10 @@ for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do + for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - as_fn_executable_p "$ac_path_FGREP" || continue + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in @@ -4267,7 +4211,7 @@ case `"$ac_path_FGREP" --version 2>&1` in $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val + ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" @@ -4282,10 +4226,12 @@ esac $ac_path_FGREP_found && break 3 done done - done +done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +$as_echo "$as_me: error: no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } fi else ac_cv_path_FGREP=$FGREP @@ -4293,7 +4239,7 @@ fi fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" @@ -4319,7 +4265,7 @@ test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : +if test "${with_gnu_ld+set}" = set; then withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no @@ -4328,7 +4274,7 @@ fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 + { $as_echo "$as_me:$LINENO: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) @@ -4358,13 +4304,13 @@ $as_echo_n "checking for ld used by $CC... " >&6; } ;; esac elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 + { $as_echo "$as_me:$LINENO: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 + { $as_echo "$as_me:$LINENO: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi -if ${lt_cv_path_LD+:} false; then : +if test "${lt_cv_path_LD+set}" = set; then $as_echo_n "(cached) " >&6 else if test -z "$LD"; then @@ -4395,16 +4341,18 @@ fi LD="$lt_cv_path_LD" if test -n "$LD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 + { $as_echo "$as_me:$LINENO: result: $LD" >&5 $as_echo "$LD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +test -z "$LD" && { { $as_echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5 +$as_echo "$as_me: error: no acceptable ld found in \$PATH" >&2;} + { (exit 1); exit 1; }; } +{ $as_echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : +if test "${lt_cv_prog_gnu_ld+set}" = set; then $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. @@ -4417,7 +4365,7 @@ case `$LD -v 2>&1 &5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld @@ -4429,9 +4377,9 @@ with_gnu_ld=$lt_cv_prog_gnu_ld -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +{ $as_echo "$as_me:$LINENO: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : +if test "${lt_cv_path_NM+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$NM"; then @@ -4478,7 +4426,7 @@ else : ${lt_cv_path_NM=no} fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" @@ -4489,9 +4437,9 @@ else do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : +if test "${ac_cv_prog_DUMPBIN+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then @@ -4502,24 +4450,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 + { $as_echo "$as_me:$LINENO: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4533,9 +4481,9 @@ if test -z "$DUMPBIN"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : +if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then @@ -4546,24 +4494,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4576,7 +4524,7 @@ done else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -4596,44 +4544,44 @@ test -z "$NM" && NM=nm -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +{ $as_echo "$as_me:$LINENO: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : +if test "${lt_cv_nm_interface+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:4606: $ac_compile\"" >&5) + (eval echo "\"\$as_me:4554: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 - (eval echo "\"\$as_me:4609: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval echo "\"\$as_me:4557: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 - (eval echo "\"\$as_me:4612: output\"" >&5) + (eval echo "\"\$as_me:4560: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +{ $as_echo "$as_me:$LINENO: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 + { $as_echo "$as_me:$LINENO: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +{ $as_echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : +if test "${lt_cv_sys_max_cmd_len+set}" = set; then $as_echo_n "(cached) " >&6 else i=0 @@ -4751,10 +4699,10 @@ else fi if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 + { $as_echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 + { $as_echo "$as_me:$LINENO: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len @@ -4768,7 +4716,7 @@ max_cmd_len=$lt_cv_sys_max_cmd_len : ${MV="mv -f"} : ${RM="rm -f"} -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +{ $as_echo "$as_me:$LINENO: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no @@ -4778,17 +4726,17 @@ xsi_shell=no && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +{ $as_echo "$as_me:$LINENO: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +{ $as_echo "$as_me:$LINENO: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } @@ -4823,14 +4771,14 @@ esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +{ $as_echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : +if test "${lt_cv_ld_reload_flag+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in @@ -4859,9 +4807,9 @@ esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : +if test "${ac_cv_prog_OBJDUMP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then @@ -4872,24 +4820,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 + { $as_echo "$as_me:$LINENO: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4899,9 +4847,9 @@ if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : +if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then @@ -4912,24 +4860,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -4938,7 +4886,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -4958,9 +4906,9 @@ test -z "$OBJDUMP" && OBJDUMP=objdump -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +{ $as_echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : +if test "${lt_cv_deplibs_check_method+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' @@ -5154,7 +5102,7 @@ tpf*) esac fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method @@ -5174,9 +5122,9 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -5187,24 +5135,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 + { $as_echo "$as_me:$LINENO: result: $AR" >&5 $as_echo "$AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5214,9 +5162,9 @@ if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : +if test "${ac_cv_prog_ac_ct_AR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then @@ -5227,24 +5175,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5253,7 +5201,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -5279,9 +5227,9 @@ test -z "$AR_FLAGS" && AR_FLAGS=cru if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : +if test "${ac_cv_prog_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then @@ -5292,24 +5240,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 + { $as_echo "$as_me:$LINENO: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5319,9 +5267,9 @@ if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : +if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then @@ -5332,24 +5280,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5358,7 +5306,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -5378,9 +5326,9 @@ test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : +if test "${ac_cv_prog_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then @@ -5391,24 +5339,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 + { $as_echo "$as_me:$LINENO: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5418,9 +5366,9 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : +if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then @@ -5431,24 +5379,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -5457,7 +5405,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -5535,9 +5483,9 @@ compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +{ $as_echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : +if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then $as_echo_n "(cached) " >&6 else @@ -5653,18 +5601,18 @@ void nm_test_func(void){} int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then # Now try to grab the symbols. nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5 (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" @@ -5717,11 +5665,11 @@ _LT_EOF lt_save_CFLAGS="$CFLAGS" LIBS="conftstm.$ac_objext" CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext}; then pipe_works=yes fi LIBS="$lt_save_LIBS" @@ -5755,10 +5703,10 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 + { $as_echo "$as_me:$LINENO: result: failed" >&5 $as_echo "failed" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 + { $as_echo "$as_me:$LINENO: result: ok" >&5 $as_echo "ok" >&6; } fi @@ -5785,7 +5733,7 @@ fi # Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : +if test "${enable_libtool_lock+set}" = set; then enableval=$enable_libtool_lock; fi @@ -5797,11 +5745,11 @@ case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" @@ -5815,12 +5763,12 @@ ia64-*-hpux*) ;; *-*-irix6*) # Find out which ABI we are using. - echo '#line 5818 "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + echo '#line 5766 "configure"' > conftest.$ac_ext + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) @@ -5854,11 +5802,11 @@ x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in @@ -5907,9 +5855,9 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 + { $as_echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : +if test "${lt_cv_cc_needs_belf+set}" = set; then $as_echo_n "(cached) " >&6 else ac_ext=c @@ -5918,7 +5866,11 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -5929,13 +5881,38 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then lt_cv_cc_needs_belf=yes else - lt_cv_cc_needs_belf=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_cc_needs_belf=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -5943,7 +5920,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf @@ -5953,11 +5930,11 @@ $as_echo "$lt_cv_cc_needs_belf" >&6; } sparc*-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in @@ -5983,9 +5960,9 @@ need_locks="$enable_libtool_lock" if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : +if test "${ac_cv_prog_DSYMUTIL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then @@ -5996,24 +5973,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 + { $as_echo "$as_me:$LINENO: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6023,9 +6000,9 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : +if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then @@ -6036,24 +6013,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6062,7 +6039,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -6075,9 +6052,9 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : +if test "${ac_cv_prog_NMEDIT+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then @@ -6088,24 +6065,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 + { $as_echo "$as_me:$LINENO: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6115,9 +6092,9 @@ if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : +if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then @@ -6128,24 +6105,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6154,7 +6131,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -6167,9 +6144,9 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : +if test "${ac_cv_prog_LIPO+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then @@ -6180,24 +6157,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 + { $as_echo "$as_me:$LINENO: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6207,9 +6184,9 @@ if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : +if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then @@ -6220,24 +6197,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6246,7 +6223,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -6259,9 +6236,9 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : +if test "${ac_cv_prog_OTOOL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then @@ -6272,24 +6249,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 + { $as_echo "$as_me:$LINENO: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6299,9 +6276,9 @@ if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : +if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then @@ -6312,24 +6289,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6338,7 +6315,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -6351,9 +6328,9 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : +if test "${ac_cv_prog_OTOOL64+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then @@ -6364,24 +6341,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 + { $as_echo "$as_me:$LINENO: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6391,9 +6368,9 @@ if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : +if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then @@ -6404,24 +6381,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 + { $as_echo "$as_me:$LINENO: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -6430,7 +6407,7 @@ fi else case $cross_compiling:$ac_tool_warned in yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac @@ -6466,9 +6443,9 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 + { $as_echo "$as_me:$LINENO: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : +if test "${lt_cv_apple_cc_single_mod+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no @@ -6493,18 +6470,22 @@ else rm -f conftest.* fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 + { $as_echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : +if test "${lt_cv_ld_exported_symbols_list+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -6515,17 +6496,42 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then lt_cv_ld_exported_symbols_list=yes else - lt_cv_ld_exported_symbols_list=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + lt_cv_ld_exported_symbols_list=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } case $host_os in rhapsody* | darwin1.[012]) @@ -6567,14 +6573,14 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +{ $as_echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : + if test "${ac_cv_prog_CPP+set}" = set; then $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded @@ -6589,7 +6595,11 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include @@ -6598,34 +6608,78 @@ do #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext + +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext + +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then break fi @@ -6637,7 +6691,7 @@ fi else ac_cv_prog_CPP=$CPP fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +{ $as_echo "$as_me:$LINENO: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -6648,7 +6702,11 @@ do # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include @@ -6657,40 +6715,87 @@ do #endif Syntax error _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + : else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi -rm -f conftest.err conftest.i conftest.$ac_ext + +rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi -rm -f conftest.err conftest.i conftest.$ac_ext + +rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi ac_ext=c @@ -6700,12 +6805,16 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +{ $as_echo "$as_me:$LINENO: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : +if test "${ac_cv_header_stdc+set}" = set; then $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -6720,23 +6829,48 @@ main () return 0; } _ACEOF -if ac_fn_c_try_compile "$LINENO"; then : +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else - ac_cv_header_stdc=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no fi + rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - + $EGREP "memchr" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -6746,14 +6880,18 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - + $EGREP "free" >/dev/null 2>&1; then + : else ac_cv_header_stdc=no fi @@ -6763,10 +6901,14 @@ fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : + if test "$cross_compiling" = yes; then : else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include @@ -6793,33 +6935,118 @@ main () return 0; } _ACEOF -if ac_fn_c_try_run "$LINENO"; then : - +rm -f conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : else - ac_cv_header_stdc=no + $as_echo "$as_me: program exited with status $ac_status" >&5 +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext +rm -rf conftest.dSYM +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then -$as_echo "#define STDC_HEADERS 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF @@ -6829,13 +7056,62 @@ fi done + for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + eval "$as_ac_Header=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi @@ -6855,7 +7131,7 @@ done # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : +if test "${enable_shared+set}" = set; then enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; @@ -6886,7 +7162,7 @@ fi # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : +if test "${enable_static+set}" = set; then enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; @@ -6918,7 +7194,7 @@ fi # Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : +if test "${with_pic+set}" = set; then withval=$with_pic; pic_mode="$withval" else pic_mode=default @@ -6934,7 +7210,7 @@ test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : +if test "${enable_fast_install+set}" = set; then enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; @@ -7015,9 +7291,9 @@ if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +{ $as_echo "$as_me:$LINENO: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : +if test "${lt_cv_objdir+set}" = set; then $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null @@ -7030,7 +7306,7 @@ else fi rmdir .libs 2>/dev/null fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir @@ -7123,9 +7399,9 @@ test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 + { $as_echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -7176,10 +7452,10 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 + { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -7189,9 +7465,9 @@ fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 + { $as_echo "$as_me:$LINENO: checking for file" >&5 $as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : +if test "${lt_cv_path_MAGIC_CMD+set}" = set; then $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in @@ -7242,10 +7518,10 @@ fi MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 + { $as_echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -7326,9 +7602,9 @@ lt_prog_compiler_no_builtin_flag= if test "$GCC" = yes; then lt_prog_compiler_no_builtin_flag=' -fno-builtin' - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 + { $as_echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : +if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no @@ -7344,11 +7620,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7347: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7623: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7351: \$? = $ac_status" >&5 + echo "$as_me:7627: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7361,7 +7637,7 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then @@ -7381,7 +7657,7 @@ fi lt_prog_compiler_pic= lt_prog_compiler_static= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +{ $as_echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if test "$GCC" = yes; then @@ -7653,7 +7929,7 @@ case $host_os in lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5 $as_echo "$lt_prog_compiler_pic" >&6; } @@ -7665,9 +7941,9 @@ $as_echo "$lt_prog_compiler_pic" >&6; } # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 + { $as_echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : +if test "${lt_cv_prog_compiler_pic_works+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no @@ -7683,11 +7959,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7686: $lt_compile\"" >&5) + (eval echo "\"\$as_me:7962: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 - echo "$as_me:7690: \$? = $ac_status" >&5 + echo "$as_me:7966: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. @@ -7700,7 +7976,7 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test x"$lt_cv_prog_compiler_pic_works" = xyes; then @@ -7724,9 +8000,9 @@ fi # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +{ $as_echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : +if test "${lt_cv_prog_compiler_static_works+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no @@ -7752,7 +8028,7 @@ else LDFLAGS="$save_LDFLAGS" fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test x"$lt_cv_prog_compiler_static_works" = xyes; then @@ -7767,9 +8043,9 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 + { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : +if test "${lt_cv_prog_compiler_c_o+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -7788,11 +8064,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7791: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8067: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7795: \$? = $ac_status" >&5 + echo "$as_me:8071: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7814,7 +8090,7 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } @@ -7822,9 +8098,9 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 + { $as_echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : +if test "${lt_cv_prog_compiler_c_o+set}" = set; then $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no @@ -7843,11 +8119,11 @@ else -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:7846: $lt_compile\"" >&5) + (eval echo "\"\$as_me:8122: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 - echo "$as_me:7850: \$? = $ac_status" >&5 + echo "$as_me:8126: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized @@ -7869,7 +8145,7 @@ else $RM conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } @@ -7878,7 +8154,7 @@ $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links="nottested" if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 + { $as_echo "$as_me:$LINENO: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* @@ -7886,10 +8162,10 @@ $as_echo_n "checking if we can lock with hard links... " >&6; } touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 + { $as_echo "$as_me:$LINENO: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 + { $as_echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} need_locks=warn fi @@ -7902,7 +8178,7 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 + { $as_echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= @@ -8344,7 +8620,11 @@ _LT_EOF allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -8355,7 +8635,27 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -8369,9 +8669,16 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpat if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -8384,7 +8691,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi else # Determine the default libpath from the value encoded in an # empty executable. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -8395,7 +8706,27 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then lt_aix_libpath_sed=' /Import File Strings/,/^$/ { @@ -8409,9 +8740,16 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpat if test -z "$aix_libpath"; then aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" @@ -8623,16 +8961,42 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi # implicitly export all symbols. save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + cat >conftest.$ac_ext <<_ACEOF int foo(void) {} _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS="$save_LDFLAGS" else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib' @@ -8888,7 +9252,7 @@ rm -f core conftest.err conftest.$ac_objext \ fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +{ $as_echo "$as_me:$LINENO: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test "$ld_shlibs" = no && can_build_shared=no @@ -8925,16 +9289,16 @@ x|xyes) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 + { $as_echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext @@ -8948,11 +9312,11 @@ $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\"") >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } then archive_cmds_need_lc=no else @@ -8963,7 +9327,7 @@ $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } cat conftest.err 1>&5 fi $RM conftest* - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5 + { $as_echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5 $as_echo "$archive_cmds_need_lc" >&6; } ;; esac @@ -9127,7 +9491,7 @@ esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 + { $as_echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test "$GCC" = yes; then @@ -9549,7 +9913,11 @@ linux* | k*bsd*-gnu) save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int @@ -9560,13 +9928,41 @@ main () return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then shlibpath_overrides_runpath=yes fi + +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir @@ -9778,7 +10174,7 @@ uts4*) dynamic_linker=no ;; esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +{ $as_echo "$as_me:$LINENO: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test "$dynamic_linker" = no && can_build_shared=no @@ -9880,7 +10276,7 @@ fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 + { $as_echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || @@ -9905,7 +10301,7 @@ else # directories. hardcode_action=unsupported fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +{ $as_echo "$as_me:$LINENO: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || @@ -9950,14 +10346,18 @@ else darwin*) # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 + { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -9975,18 +10375,43 @@ return dlopen (); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_dl_dlopen=yes else - ac_cv_lib_dl_dlopen=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else @@ -9999,19 +10424,189 @@ fi ;; *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : + { $as_echo "$as_me:$LINENO: checking for shl_load" >&5 +$as_echo_n "checking for shl_load... " >&6; } +if test "${ac_cv_func_shl_load+set}" = set; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define shl_load to an innocuous variant, in case declares shl_load. + For example, HP-UX 11i declares gettimeofday. */ +#define shl_load innocuous_shl_load + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char shl_load (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef shl_load + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_shl_load || defined __stub___shl_load +choke me +#endif + +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_shl_load=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_shl_load=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5 +$as_echo "$ac_cv_func_shl_load" >&6; } +if test "x$ac_cv_func_shl_load" = x""yes; then lt_cv_dlopen="shl_load" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : + { $as_echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if test "${ac_cv_lib_dld_shl_load+set}" = set; then + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_lib_dld_shl_load=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_shl_load=no +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = x""yes; then + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + { $as_echo "$as_me:$LINENO: checking for dlopen" >&5 +$as_echo_n "checking for dlopen... " >&6; } +if test "${ac_cv_func_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +/* Define dlopen to an innocuous variant, in case declares dlopen. + For example, HP-UX 11i declares gettimeofday. */ +#define dlopen innocuous_dlopen + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlopen (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef dlopen /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC @@ -10019,41 +10614,72 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char shl_load (); +char dlopen (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_dlopen || defined __stub___dlopen +choke me +#endif + int main () { -return shl_load (); +return dlopen (); ; return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + ac_cv_func_dlopen=yes else - ac_cv_lib_dld_shl_load=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : +{ $as_echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5 +$as_echo "$ac_cv_func_dlopen" >&6; } +if test "x$ac_cv_func_dlopen" = x""yes; then lt_cv_dlopen="dlopen" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 + { $as_echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : +if test "${ac_cv_lib_dl_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -10071,28 +10697,57 @@ return dlopen (); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_dl_dlopen=yes else - ac_cv_lib_dl_dlopen=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dl_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : +if test "x$ac_cv_lib_dl_dlopen" = x""yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 + { $as_echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : +if test "${ac_cv_lib_svld_dlopen+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -10110,28 +10765,57 @@ return dlopen (); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_svld_dlopen=yes else - ac_cv_lib_svld_dlopen=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_svld_dlopen=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : +if test "x$ac_cv_lib_svld_dlopen" = x""yes; then lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 + { $as_echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : +if test "${ac_cv_lib_dld_dld_link+set}" = set; then $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. @@ -10149,18 +10833,43 @@ return dld_link (); return 0; } _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_dld_dld_link=yes else - ac_cv_lib_dld_dld_link=no + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_dld_dld_link=no fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : +if test "x$ac_cv_lib_dld_dld_link" = x""yes; then lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" fi @@ -10199,9 +10908,9 @@ fi save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 + { $as_echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : +if test "${lt_cv_dlopen_self+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10210,7 +10919,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10213 "configure" +#line 10922 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10269,11 +10978,11 @@ int main () return status; } _LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in @@ -10290,14 +10999,14 @@ rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 + { $as_echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : +if test "${lt_cv_dlopen_self_static+set}" = set; then $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : @@ -10306,7 +11015,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 10309 "configure" +#line 11018 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -10365,11 +11074,11 @@ int main () return status; } _LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in @@ -10386,7 +11095,7 @@ rm -fr conftest* fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +{ $as_echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi @@ -10425,12 +11134,12 @@ fi striplib= old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +{ $as_echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough @@ -10439,15 +11148,15 @@ else if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 + { $as_echo "$as_me:$LINENO: result: yes" >&5 $as_echo "yes" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi ;; *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } ;; esac @@ -10465,12 +11174,12 @@ fi # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 + { $as_echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 + { $as_echo "$as_me:$LINENO: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 + { $as_echo "$as_me:$LINENO: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no @@ -10491,14 +11200,14 @@ $as_echo_n "checking whether to build shared libraries... " >&6; } fi ;; esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 + { $as_echo "$as_me:$LINENO: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 + { $as_echo "$as_me:$LINENO: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 + { $as_echo "$as_me:$LINENO: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } @@ -10538,9 +11247,9 @@ for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LEX+:} false; then : +if test "${ac_cv_prog_LEX+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$LEX"; then @@ -10551,24 +11260,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_LEX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5 + { $as_echo "$as_me:$LINENO: result: $LEX" >&5 $as_echo "$LEX" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -10584,8 +11293,7 @@ a { ECHO; } b { REJECT; } c { yymore (); } d { yyless (1); } -e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */ - yyless ((input () != 0)); } +e { yyless (input () != 0); } f { unput (yytext[0]); } . { BEGIN INITIAL; } %% @@ -10598,20 +11306,20 @@ main (void) return ! yylex () + ! yywrap (); } _ACEOF -{ { ac_try="$LEX conftest.l" +{ (ac_try="$LEX conftest.l" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 (eval "$LEX conftest.l") 2>&5 ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } +{ $as_echo "$as_me:$LINENO: checking lex output file root" >&5 $as_echo_n "checking lex output file root... " >&6; } -if ${ac_cv_prog_lex_root+:} false; then : +if test "${ac_cv_prog_lex_root+set}" = set; then $as_echo_n "(cached) " >&6 else @@ -10620,17 +11328,19 @@ if test -f lex.yy.c; then elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else - as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 +$as_echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} + { (exit 1); exit 1; }; } fi fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 $as_echo "$ac_cv_prog_lex_root" >&6; } LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root if test -z "${LEXLIB+set}"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5 + { $as_echo "$as_me:$LINENO: checking lex library" >&5 $as_echo_n "checking lex library... " >&6; } -if ${ac_cv_lib_lex+:} false; then : +if test "${ac_cv_lib_lex+set}" = set; then $as_echo_n "(cached) " >&6 else @@ -10638,29 +11348,55 @@ else ac_cv_lib_lex='none needed' for ac_lib in '' -lfl -ll; do LIBS="$ac_lib $ac_save_LIBS" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ + cat >conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_lib_lex=$ac_lib +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext test "$ac_cv_lib_lex" != 'none needed' && break done LIBS=$ac_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5 $as_echo "$ac_cv_lib_lex" >&6; } test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5 +{ $as_echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 $as_echo_n "checking whether yytext is a pointer... " >&6; } -if ${ac_cv_prog_lex_yytext_pointer+:} false; then : +if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then $as_echo_n "(cached) " >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the @@ -10669,25 +11405,52 @@ else ac_cv_prog_lex_yytext_pointer=no ac_save_LIBS=$LIBS LIBS="$LEXLIB $ac_save_LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - - #define YYTEXT_POINTER 1 +cat >conftest.$ac_ext <<_ACEOF +#define YYTEXT_POINTER 1 `cat $LEX_OUTPUT_ROOT.c` _ACEOF -if ac_fn_c_try_link "$LINENO"; then : +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then ac_cv_prog_lex_yytext_pointer=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5 +{ $as_echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 $as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; } if test $ac_cv_prog_lex_yytext_pointer = yes; then -$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h +cat >>confdefs.h <<\_ACEOF +#define YYTEXT_POINTER 1 +_ACEOF fi rm -f conftest.l $LEX_OUTPUT_ROOT.c @@ -10697,9 +11460,9 @@ for ac_prog in 'bison -y' byacc do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_YACC+:} false; then : +if test "${ac_cv_prog_YACC+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$YACC"; then @@ -10710,24 +11473,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_YACC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi YACC=$ac_cv_prog_YACC if test -n "$YACC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5 + { $as_echo "$as_me:$LINENO: result: $YACC" >&5 $as_echo "$YACC" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -10741,9 +11504,9 @@ for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : +if test "${ac_cv_prog_AR+set}" = set; then $as_echo_n "(cached) " >&6 else if test -n "$AR"; then @@ -10754,24 +11517,24 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 + { $as_echo "$as_me:$LINENO: result: $AR" >&5 $as_echo "$AR" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi @@ -10782,9 +11545,9 @@ done # Extract the first word of "cpp", so it can be a program name with args. set dummy cpp; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_path_EXTCPP+:} false; then : +if test "${ac_cv_path_EXTCPP+set}" = set; then $as_echo_n "(cached) " >&6 else case $EXTCPP in @@ -10797,14 +11560,14 @@ for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_EXTCPP="$as_dir/$ac_word$ac_exec_ext" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done - done +done IFS=$as_save_IFS test -z "$ac_cv_path_EXTCPP" && ac_cv_path_EXTCPP="no" @@ -10813,19 +11576,22 @@ esac fi EXTCPP=$ac_cv_path_EXTCPP if test -n "$EXTCPP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EXTCPP" >&5 + { $as_echo "$as_me:$LINENO: result: $EXTCPP" >&5 $as_echo "$EXTCPP" >&6; } else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { $as_echo "$as_me:$LINENO: result: no" >&5 $as_echo "no" >&6; } fi if test "x$EXTCPP" = "xno"; then - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "Cannot find a working 'cpp' (C preprocessor) program -See \`config.log' for more details" "$LINENO" 5; } +{ { $as_echo "$as_me:$LINENO: error: Cannot find a working 'cpp' (C preprocessor) program +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: Cannot find a working 'cpp' (C preprocessor) program +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } fi cat >>confdefs.h <<_ACEOF @@ -10841,24 +11607,250 @@ case "$host" in esac + + for ac_header in arpa/inet.h sys/param.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : +do +as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:$LINENO: checking $ac_header usability" >&5 +$as_echo_n "checking $ac_header usability... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:$LINENO: checking $ac_header presence" >&5 +$as_echo_n "checking $ac_header presence... " >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ $as_echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +$as_echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { $as_echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +$as_echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; +esac +{ $as_echo "$as_me:$LINENO: checking for $ac_header" >&5 +$as_echo_n "checking for $ac_header... " >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + +fi +as_val=`eval 'as_val=${'$as_ac_Header'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi -done - -for ac_func in ntohl htonl ntohs htons -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : +done + + + + + +for ac_func in ntohl htonl ntohs htons +do +as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +{ $as_echo "$as_me:$LINENO: checking for $ac_func" >&5 +$as_echo_n "checking for $ac_func... " >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then + $as_echo_n "(cached) " >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $ac_func (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif + +int +main () +{ +return $ac_func (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\"" +$as_echo "$ac_try_echo") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then + eval "$as_ac_var=yes" +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" +fi + +rm -rf conftest.dSYM +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi +ac_res=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + { $as_echo "$as_me:$LINENO: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +as_val=`eval 'as_val=${'$as_ac_var'} + $as_echo "$as_val"'` + if test "x$as_val" = x""yes; then cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF @@ -10896,13 +11888,13 @@ _ACEOF case $ac_val in #( *${as_nl}*) case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 + *_cv_*) { $as_echo "$as_me:$LINENO: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; + *) $as_unset $ac_var ;; esac ;; esac done @@ -10910,8 +11902,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. + # `set' does not quote correctly, so add quotes (double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" @@ -10933,23 +11925,12 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:$LINENO: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi + cat confcache >$cache_file else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 + { $as_echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi @@ -10963,15 +11944,14 @@ DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= -U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -10979,22 +11959,27 @@ LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then - as_fn_error $? "conditional \"AMDEP\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then - as_fn_error $? "conditional \"am__fastdepCC\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&5 +$as_echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." >&2;} + { (exit 1); exit 1; }; } fi -: "${CONFIG_STATUS=./config.status}" +: ${CONFIG_STATUS=./config.status} ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +{ $as_echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +cat >$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. @@ -11004,18 +11989,17 @@ cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 debug=false ac_cs_recheck=false ac_cs_silent=false - SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +## --------------------- ## +## M4sh Initialization. ## +## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which @@ -11023,15 +12007,23 @@ if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; esac + fi + + +# PATH needs CR +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + as_nl=' ' export as_nl @@ -11039,13 +12031,7 @@ export as_nl as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then +if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else @@ -11056,7 +12042,7 @@ else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; - case $arg in #( + case $arg in *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; @@ -11079,6 +12065,13 @@ if test "${PATH_SEPARATOR+set}" != set; then } fi +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + # IFS # We need space, tab and new line, in precisely that order. Quoting is @@ -11088,16 +12081,15 @@ fi IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( +case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break +done IFS=$as_save_IFS ;; @@ -11109,16 +12101,12 @@ if test "x$as_myself" = x; then fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 + { (exit 1); exit 1; } fi -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' @@ -11130,89 +12118,7 @@ export LC_ALL LANGUAGE=C export LANGUAGE -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - +# Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr @@ -11226,12 +12132,8 @@ else as_basename=false fi -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi +# Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ @@ -11251,25 +12153,76 @@ $as_echo X/"$0" | } s/.*/./; q'` -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits +# CDPATH. +$as_unset CDPATH + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { + + # Create $as_me.lineno as a copy of $as_myself, but with $LINENO + # uniformly replaced by the line number. The first 'sed' inserts a + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, and appends + # trailing '-' during substitution so that $LINENO is not a special + # case at line end. + # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 + { (exit 1); exit 1; }; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( +case `echo -n x` in -n*) - case `echo 'xy\c'` in + case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; + *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then @@ -11284,85 +12237,49 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' + as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -11372,19 +12289,13 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to +# Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by portablexdr $as_me 4.9.1, which was -generated by GNU Autoconf 2.69. Invocation command line was +generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -11416,15 +12327,13 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. +\`$as_me' instantiates files from templates according to the +current configuration. -Usage: $0 [OPTION]... [TAG]... +Usage: $0 [OPTION]... [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit - --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files @@ -11443,17 +12352,16 @@ $config_headers Configuration commands: $config_commands -Report bugs to the package provider." +Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ portablexdr config.status 4.9.1 -configured by $0, generated by GNU Autoconf 2.69, - with options \\"\$ac_cs_config\\" +configured by $0, generated by GNU Autoconf 2.63, + with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2008 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -11471,16 +12379,11 @@ ac_need_defaults=: while test $# != 0 do case $1 in - --*=?*) + --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; *) ac_option=$1 ac_optarg=$2 @@ -11494,29 +12397,27 @@ do ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; esac - as_fn_append CONFIG_FILES " '$ac_optarg'" + CONFIG_FILES="$CONFIG_FILES '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" + CONFIG_HEADERS="$CONFIG_HEADERS '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; + { $as_echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ @@ -11524,10 +12425,11 @@ Try \`$0 --help' for more information.";; ac_cs_silent=: ;; # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; + -*) { $as_echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; } ;; - *) as_fn_append ac_config_targets " $1" + *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac @@ -11544,7 +12446,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' @@ -11838,7 +12740,9 @@ do "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + *) { { $as_echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 +$as_echo "$as_me: error: invalid argument: $ac_config_target" >&2;} + { (exit 1); exit 1; }; };; esac done @@ -11861,24 +12765,26 @@ fi # after its creation but before its name has been assigned to `$tmp'. $debug || { - tmp= ac_tmp= + tmp= trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 - trap 'as_fn_exit 1' 1 2 13 15 + trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" + test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp +} || +{ + $as_echo "$as_me: cannot create a temporary directory in ." >&2 + { (exit 1); exit 1; } +} # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. @@ -11886,13 +12792,7 @@ ac_tmp=$tmp if test -n "$CONFIG_FILES"; then -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi +ac_cr=' ' ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' @@ -11900,7 +12800,7 @@ else ac_cs_awk_cr=$ac_cr fi -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +echo 'BEGIN {' >"$tmp/subs1.awk" && _ACEOF @@ -11909,18 +12809,24 @@ _ACEOF echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } +ac_delim_num=`echo "$ac_subst_vars" | grep -c '$'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -11928,7 +12834,7 @@ done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h @@ -11942,7 +12848,7 @@ s/'"$ac_delim"'$// t delim :nl h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p @@ -11956,7 +12862,7 @@ s/.\{148\}// t nl :delim h -s/\(.\{148\}\)..*/\1/ +s/\(.\{148\}\).*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p @@ -11976,7 +12882,7 @@ t delim rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && +cat >>"\$tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" @@ -12008,29 +12914,23 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || { { $as_echo "$as_me:$LINENO: error: could not setup config files machinery" >&5 +$as_echo "$as_me: error: could not setup config files machinery" >&2;} + { (exit 1); exit 1; }; } _ACEOF -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// s/^[^=]*=[ ]*$// }' fi @@ -12042,7 +12942,7 @@ fi # test -n "$CONFIG_FILES" # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || +cat >"$tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF @@ -12054,11 +12954,13 @@ _ACEOF # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then break elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not make $CONFIG_HEADERS" >&5 +$as_echo "$as_me: error: could not make $CONFIG_HEADERS" >&2;} + { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi @@ -12143,7 +13045,9 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: could not setup config headers machinery" >&5 +$as_echo "$as_me: error: could not setup config headers machinery" >&2;} + { (exit 1); exit 1; }; } fi # test -n "$CONFIG_HEADERS" @@ -12156,7 +13060,9 @@ do esac case $ac_mode$ac_tag in :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :L* | :C*:*) { { $as_echo "$as_me:$LINENO: error: invalid tag $ac_tag" >&5 +$as_echo "$as_me: error: invalid tag $ac_tag" >&2;} + { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac @@ -12175,7 +13081,7 @@ do for ac_f do case $ac_f in - -) ac_f="$ac_tmp/stdin";; + -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. @@ -12184,10 +13090,12 @@ do [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + { { $as_echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +$as_echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" + ac_file_inputs="$ac_file_inputs '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't @@ -12198,7 +13106,7 @@ do `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 + { $as_echo "$as_me:$LINENO: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. @@ -12210,8 +13118,10 @@ $as_echo "$as_me: creating $ac_file" >&6;} esac case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + *:-:* | *:-) cat >"$tmp/stdin" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; esac ;; esac @@ -12239,7 +13149,47 @@ $as_echo X"$ac_file" | q } s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in @@ -12296,6 +13246,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= + ac_sed_dataroot=' /datarootdir/ { p @@ -12305,11 +13256,12 @@ ac_sed_dataroot=' /@docdir@/p /@infodir@/p /@localedir@/p -/@mandir@/p' +/@mandir@/p +' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 + { $as_echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 @@ -12319,7 +13271,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; + s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF @@ -12347,24 +13299,27 @@ s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} +which seems to be undefined. Please make sure it is defined." >&2;} - rm -f "$ac_tmp/stdin" + rm -f "$tmp/stdin" case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } ;; :H) # @@ -12373,21 +13328,27 @@ which seems to be undefined. Please make sure it is defined" >&2;} if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:$LINENO: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + mv "$tmp/config.h" "$ac_file" \ + || { { $as_echo "$as_me:$LINENO: error: could not create $ac_file" >&5 +$as_echo "$as_me: error: could not create $ac_file" >&2;} + { (exit 1); exit 1; }; } fi else $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || { { $as_echo "$as_me:$LINENO: error: could not create -" >&5 +$as_echo "$as_me: error: could not create -" >&2;} + { (exit 1); exit 1; }; } fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" @@ -12425,35 +13386,25 @@ $as_echo X"$_am_arg" | s/.*/./; q'`/stamp-h$_am_stamp_count ;; - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 + :C) { $as_echo "$as_me:$LINENO: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in - "depfiles":C) test x"$AMDEP_TRUE" != x"" || { - # Autoconf 2.62 quotes --file arguments for eval, but not when files - # are listed without --file. Let's play safe and only enable the eval - # if we detect the quoting. - case $CONFIG_FILES in - *\'*) eval set x "$CONFIG_FILES" ;; - *) set x $CONFIG_FILES ;; - esac - shift - for mf - do - # Strip MF so we end up with the name of the file. - mf=`echo "$mf" | sed -e 's/:.*$//'` - # Check whether this is an Automake generated Makefile or not. - # We used to match only the files named `Makefile.in', but - # some people rename them; so instead we look at the file content. - # Grep'ing the first line is not enough: some people post-process - # each Makefile.in and add a new line on top of each file to say so. - # Grep'ing the whole file is not good either: AIX grep has a line - # limit of 2048, but all sed's we know have understand at least 4000. - if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then - dirpart=`$as_dirname -- "$mf" || + "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ @@ -12476,28 +13427,28 @@ $as_echo X"$mf" | q } s/.*/./; q'` - else - continue - fi - # Extract the definition of DEPDIR, am__include, and am__quote - # from the Makefile without running `make'. - DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` - test -z "$DEPDIR" && continue - am__include=`sed -n 's/^am__include = //p' < "$mf"` - test -z "am__include" && continue - am__quote=`sed -n 's/^am__quote = //p' < "$mf"` - # When using ansi2knr, U may be empty or an underscore; expand it - U=`sed -n 's/^U = //p' < "$mf"` - # Find all dependency output files, they are included files with - # $(DEPDIR) in their names. We invoke sed twice because it is the - # simplest approach to changing $(DEPDIR) to its actual value in the - # expansion. - for file in `sed -n " - s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ - sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do - # Make sure the directory exists. - test -f "$dirpart/$file" && continue - fdir=`$as_dirname -- "$file" || + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ @@ -12520,12 +13471,51 @@ $as_echo X"$file" | q } s/.*/./; q'` - as_dir=$dirpart/$fdir; as_fn_mkdir_p - # echo "creating $dirpart/$file" - echo '# dummy' > "$dirpart/$file" + { as_dir=$dirpart/$fdir + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { $as_echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +$as_echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" done -} +done ;; "libtool":C) @@ -13167,12 +14157,15 @@ _LT_EOF done # for ac_tag -as_fn_exit 0 +{ (exit 0); exit 0; } _ACEOF +chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + { { $as_echo "$as_me:$LINENO: error: write failure creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: error: write failure creating $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } # configure is writing to config.log, and then calls config.status. @@ -13193,10 +14186,10 @@ if test "$no_create" != yes; then exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 + $ac_cs_success || { (exit 1); exit 1; } fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 + { $as_echo "$as_me:$LINENO: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi diff --git a/extlib/portablexdr-4.9.1/rpc/types.h b/extlib/portablexdr-4.9.1/rpc/types.h index 1409ecfa..98ee31f6 100644 --- a/extlib/portablexdr-4.9.1/rpc/types.h +++ b/extlib/portablexdr-4.9.1/rpc/types.h @@ -36,7 +36,6 @@ #define __TYPES_RPC_HEADER__ #include -#include typedef unsigned char u_char; typedef uint16_t u_short; @@ -47,34 +46,34 @@ typedef int64_t quad_t; typedef char * caddr_t; #ifndef TRUE -# define TRUE 1 +#define TRUE 1 #endif #ifndef FALSE -# define FALSE 0 +#define FALSE 0 #endif #define bool_t int #define enum_t int #define __dontcare__ -1 #ifndef NULL -# define NULL 0 +# define NULL 0 #endif -#define mem_alloc(bsize) malloc(bsize) +#define mem_alloc(bsize) malloc(bsize) #define mem_free(ptr, bsize) free(ptr) #ifndef makedev /* ie, we haven't already included it */ -# include +#include #endif #ifdef __CYGWIN32__ -# include +#include #endif //#include #ifndef INADDR_LOOPBACK -# define INADDR_LOOPBACK (u_long)0x7F000001 +#define INADDR_LOOPBACK (u_long)0x7F000001 #endif #ifndef MAXHOSTNAMELEN -# define MAXHOSTNAMELEN 64 +#define MAXHOSTNAMELEN 64 #endif #endif /* ndef __TYPES_RPC_HEADER__ */ diff --git a/extlib/portablexdr-4.9.1/rpc/xdr.h b/extlib/portablexdr-4.9.1/rpc/xdr.h index 3291340e..d28d6763 100644 --- a/extlib/portablexdr-4.9.1/rpc/xdr.h +++ b/extlib/portablexdr-4.9.1/rpc/xdr.h @@ -38,9 +38,7 @@ #ifndef __XDR_HEADER__ #define __XDR_HEADER__ -#ifdef __cplusplus -extern "C" { -#endif +#include /* * XDR provides a conventional way for converting between C data @@ -96,22 +94,30 @@ enum xdr_op { * an operations vector for the paticular implementation (e.g. see xdr_mem.c), * and two private fields for the use of the particular impelementation. */ -typedef struct XDR { +typedef struct __rpc_xdr { enum xdr_op x_op; /* operation; fast additional param */ struct xdr_ops { - bool_t (*x_getlong)(struct XDR *xdrs, long *longp); /* get a long from underlying stream */ - bool_t (*x_putlong)(struct XDR *xdrs, long *longp); /* put a long to " */ - bool_t (*x_getbytes)(struct XDR *xdrs, caddr_t addr, u_int len); /* get some bytes from " */ - bool_t (*x_putbytes)(struct XDR *xdrs, caddr_t addr, u_int len); /* put some bytes to " */ - u_int (*x_getpostn)(struct XDR *xdrs); /* returns bytes off from beginning */ - bool_t (*x_setpostn)(struct XDR *xdrs, u_int pos); /* lets you reposition the stream */ - long * (*x_inline)(struct XDR *xdrs, u_int len); /* buf quick ptr to buffered data */ - void (*x_destroy)(struct XDR *xdrs); /* free privates of this xdr_stream */ + /* get a long from underlying stream */ + bool_t (*x_getlong)(struct __rpc_xdr *, long *); + /* put a long to " */ + bool_t (*x_putlong)(struct __rpc_xdr *, const long *); + /* get some bytes from " */ + bool_t (*x_getbytes)(struct __rpc_xdr *, char *, u_int); + /* put some bytes to " */ + bool_t (*x_putbytes)(struct __rpc_xdr *, const char *, u_int); + /* returns bytes off from beginning */ + u_int (*x_getpostn)(struct __rpc_xdr *); + /* lets you reposition the stream */ + bool_t (*x_setpostn)(struct __rpc_xdr *, u_int); + /* buf quick ptr to buffered data */ + int32_t *(*x_inline)(struct __rpc_xdr *, u_int); + /* free privates of this xdr_stream */ + void (*x_destroy)(struct __rpc_xdr *); } *x_ops; caddr_t x_public; /* users' data */ caddr_t x_private; /* pointer to private data */ caddr_t x_base; /* private used for position info */ - int x_handy; /* extra private word */ + int x_handy; /* extra private word */ } XDR; /* @@ -122,8 +128,10 @@ typedef struct XDR { * to be decoded. If this pointer is 0, then the type routines should * allocate dynamic storage of the appropriate size and return it. * bool_t (*xdrproc_t)(XDR *, caddr_t *); + * + * XXX can't actually prototype it, because some take three args!!! */ -typedef bool_t (*xdrproc_t)(XDR *, caddr_t *); +typedef bool_t (*xdrproc_t)(XDR *, ...); /* * Operations defined on a XDR handle @@ -225,28 +233,34 @@ struct xdr_discrim { /* * These are the "generic" xdr routines. */ -extern bool_t xdr_void(); -extern bool_t xdr_int(XDR *xdrs, int *ip); -extern bool_t xdr_u_int(XDR *xdrs, u_int *up); -extern bool_t xdr_long(XDR *xdrs, long *lp); -extern bool_t xdr_u_long(XDR *xdrs, u_long *ulp); -extern bool_t xdr_short(XDR *xdrs, short *sp); -extern bool_t xdr_u_short(XDR *xdrs, u_short *usp); -extern bool_t xdr_bool(XDR *xdrs, bool_t *bp); -extern bool_t xdr_enum(XDR *xdrs, enum_t *ep); -extern bool_t xdr_array(XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsize, xdrproc_t elproc); -extern bool_t xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize); -extern bool_t xdr_opaque(XDR *xdrs, caddr_t cp, u_int cnt); -extern bool_t xdr_string(XDR *xdrs, char **cpp, u_int maxsize); -extern bool_t xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, struct xdr_discrim *choices, xdrproc_t dfault); -extern bool_t xdr_char(XDR *xdrs, char *cp); -extern bool_t xdr_u_char(XDR *xdrs, u_char *ucp); -extern bool_t xdr_vector(XDR *xdrs, char *basep, u_int nelem, u_int elemsize, xdrproc_t xdr_elem); -extern bool_t xdr_float(XDR *xdrs, float *fp); -extern bool_t xdr_double(XDR *xdrs, double *dp); -extern bool_t xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc); -extern bool_t xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj); -extern bool_t xdr_wrapstring(XDR *xdrs, char **cpp); +#ifdef __cplusplus +extern "C" { +#endif +extern bool_t xdr_void(void); +extern bool_t xdr_int(XDR *, int *); +extern bool_t xdr_u_int(XDR *, u_int *); +extern bool_t xdr_long(XDR *, long *); +extern bool_t xdr_u_long(XDR *, u_long *); +extern bool_t xdr_short(XDR *, short *); +extern bool_t xdr_u_short(XDR *, u_short *); +extern bool_t xdr_bool(XDR *, bool_t *); +extern bool_t xdr_enum(XDR *, enum_t *); +extern bool_t xdr_array(XDR *, char **, u_int *, u_int, u_int, xdrproc_t); +extern bool_t xdr_bytes(XDR *, char **, u_int *, u_int); +extern bool_t xdr_opaque(XDR *, char *, u_int); +extern bool_t xdr_string(XDR *, char **, u_int); +extern bool_t xdr_union(XDR *, enum_t *, char *, const struct xdr_discrim *, xdrproc_t); +extern bool_t xdr_char(XDR *, char *); +extern bool_t xdr_u_char(XDR *, u_char *); +extern bool_t xdr_vector(XDR *, char *, u_int, u_int, xdrproc_t); +extern bool_t xdr_float(XDR *, float *); +extern bool_t xdr_double(XDR *, double *); +extern bool_t xdr_reference(XDR *, char **, u_int, xdrproc_t); +extern bool_t xdr_pointer(XDR *, char **, u_int, xdrproc_t); +extern bool_t xdr_wrapstring(XDR *, char **); +#ifdef __cplusplus +} +#endif /* * Common opaque bytes objects used by many rpc protocols; @@ -258,23 +272,49 @@ struct netobj { char *n_bytes; }; typedef struct netobj netobj; -extern bool_t xdr_netobj(XDR *xdrs, struct netobj *np); +extern bool_t xdr_netobj(XDR *, struct netobj *); /* * These are the public routines for the various implementations of * xdr streams. */ -extern void xdrmem_create(XDR *xdrs, caddr_t addr, u_int size, enum xdr_op op); /* XDR using memory buffers */ -extern void xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op); /* XDR using stdio library */ -extern void xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, caddr_t tcp_handle, int (*readit)(caddr_t, caddr_t, int), int (*writeit)(caddr_t, caddr_t, int)); /* XDR pseudo records for tcp */ -extern bool_t xdrrec_endofrecord(XDR *xdrs, bool_t sendnow); /* make end of xdr record */ -extern bool_t xdrrec_skiprecord(XDR *xdrs); /* move to beginning of next record */ -extern bool_t xdrrec_eof(XDR *xdrs); /* true if no more input */ +#ifdef __cplusplus +extern "C" { +#endif +/* XDR using memory buffers */ +extern void xdrmem_create(XDR *, char *, u_int, enum xdr_op); + +/* XDR using stdio library */ +extern void xdrstdio_create(XDR *, FILE *, enum xdr_op); + +/* XDR pseudo records for tcp */ +extern void xdrrec_create(XDR *, u_int, u_int, void *, + int (*)(void *, void *, int), + int (*)(void *, void *, int)); + +/* make end of xdr record */ +extern bool_t xdrrec_endofrecord(XDR *, int); +/* move to beginning of next record */ +extern bool_t xdrrec_skiprecord(XDR *); + +/* true if no more input */ +extern bool_t xdrrec_eof(XDR *); +#ifdef __cplusplus +} +#endif + +#ifdef __cplusplus +extern "C" { +#endif /* RWMJ */ extern void xdr_free (xdrproc_t, char *); extern bool_t xdr_uint64_t (XDR *xdrs, uint64_t *uip); extern bool_t xdr_int64_t (XDR *xdrs, int64_t *uip); +#ifdef __cplusplus +} +#endif + #define xdr_u_quad_t xdr_uint64_t #define xdr_quad_t xdr_int64_t @@ -283,12 +323,8 @@ extern bool_t xdr_int64_t (XDR *xdrs, int64_t *uip); #define IXDR_GET_INT32 IXDR_GET_LONG #define XDR_PUTINT32(xdrs, int32p) \ - (*(xdrs)->x_ops->x_putlong)(xdrs, (long*)int32p) + (*(xdrs)->x_ops->x_putlong)(xdrs, int32p) #define XDR_GETINT32(xdrs, int32p) \ - (*(xdrs)->x_ops->x_getlong)(xdrs, (long*)int32p) - -#ifdef __cplusplus -} -#endif + (*(xdrs)->x_ops->x_getlong)(xdrs, int32p) #endif /* __XDR_HEADER__ */ diff --git a/extlib/portablexdr-4.9.1/rpcgen_main.c b/extlib/portablexdr-4.9.1/rpcgen_main.c index c32b3b03..b7970fbb 100644 --- a/extlib/portablexdr-4.9.1/rpcgen_main.c +++ b/extlib/portablexdr-4.9.1/rpcgen_main.c @@ -24,9 +24,7 @@ #include #include #include -#if defined(__GNUC__) -# include -#endif +#include #include #include "rpcgen_int.h" diff --git a/extlib/portablexdr-4.9.1/rpcgen_scan.c b/extlib/portablexdr-4.9.1/rpcgen_scan.c index 784d5a22..c427f18e 100644 --- a/extlib/portablexdr-4.9.1/rpcgen_scan.c +++ b/extlib/portablexdr-4.9.1/rpcgen_scan.c @@ -165,7 +165,7 @@ extern FILE *yyin, *yyout; * existing scanners that call yyless() from OUTSIDE yylex. * One obvious solution it to make yy_act a global. I tried that, and saw * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a variable-- so it is not worth it. + * normally declared as a register variable-- so it is not worth it. */ #define YY_LESS_LINENO(n) \ do { \ @@ -601,9 +601,7 @@ char *yytext; * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ -#if defined(__GNUC__) -# include -#endif +#include #endif #ifndef YY_EXTRA_TYPE @@ -773,9 +771,9 @@ extern int yylex (void); */ YY_DECL { - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; + register yy_state_type yy_current_state; + register char *yy_cp, *yy_bp; + register int yy_act; #line 39 "rpcgen_scan.l" @@ -830,7 +828,7 @@ YY_DECL yy_match: do { - YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; + register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1290,9 +1288,9 @@ case YY_STATE_EOF(INITIAL): */ static int yy_get_next_buffer (void) { - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; + register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + register char *source = (yytext_ptr); + register int number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -1424,15 +1422,15 @@ static int yy_get_next_buffer (void) static yy_state_type yy_get_previous_state (void) { - yy_state_type yy_current_state; - char *yy_cp; + register yy_state_type yy_current_state; + register char *yy_cp; yy_current_state = (yy_start); yy_current_state += YY_AT_BOL(); for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) { - YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); + register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -1457,10 +1455,10 @@ static int yy_get_next_buffer (void) */ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { - int yy_is_jam; - char *yy_cp = (yy_c_buf_p); + register int yy_is_jam; + register char *yy_cp = (yy_c_buf_p); - YY_CHAR yy_c = 1; + register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { (yy_last_accepting_state) = yy_current_state; @@ -2078,7 +2076,7 @@ int yylex_destroy (void) #ifndef yytext_ptr static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { - int i; + register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -2087,7 +2085,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) #ifdef YY_NEED_STRLEN static int yy_flex_strlen (yyconst char * s ) { - int n; + register int n; for ( n = 0; s[n]; ++n ) ; diff --git a/extlib/portablexdr-4.9.1/xdr.c b/extlib/portablexdr-4.9.1/xdr.c index ea94b944..319a70a7 100644 --- a/extlib/portablexdr-4.9.1/xdr.c +++ b/extlib/portablexdr-4.9.1/xdr.c @@ -53,6 +53,7 @@ static char sccsid[] = "@(#)xdr.c 1.35 87/08/12"; */ #define XDR_FALSE ((long) 0) #define XDR_TRUE ((long) 1) +#define LASTUNSIGNED ((u_int) 0-1) /* * for unit alignment @@ -71,7 +72,7 @@ xdr_free(proc, objp) XDR x; x.x_op = XDR_FREE; - (*proc)(&x, &objp); + (*proc)(&x, objp); } /* @@ -133,7 +134,7 @@ xdr_u_int(xdrs, up) */ bool_t xdr_long(xdrs, lp) - XDR *xdrs; + register XDR *xdrs; long *lp; { @@ -155,7 +156,7 @@ xdr_long(xdrs, lp) */ bool_t xdr_u_long(xdrs, ulp) - XDR *xdrs; + register XDR *xdrs; u_long *ulp; { @@ -173,7 +174,7 @@ xdr_u_long(xdrs, ulp) */ bool_t xdr_short(xdrs, sp) - XDR *xdrs; + register XDR *xdrs; short *sp; { long l; @@ -202,15 +203,15 @@ xdr_short(xdrs, sp) */ bool_t xdr_u_short(xdrs, usp) - XDR *xdrs; + register XDR *xdrs; u_short *usp; { - long l; + u_long l; switch (xdrs->x_op) { case XDR_ENCODE: - l = (long) *usp; + l = (u_long) *usp; return (XDR_PUTLONG(xdrs, &l)); case XDR_DECODE: @@ -249,17 +250,17 @@ xdr_char(xdrs, cp) * XDR an unsigned char */ bool_t -xdr_u_char(xdrs, ucp) +xdr_u_char(xdrs, cp) XDR *xdrs; - u_char *ucp; + u_char *cp; { u_int u; - u = (*ucp); + u = (*cp); if (!xdr_u_int(xdrs, &u)) { return (FALSE); } - *ucp = u; + *cp = u; return (TRUE); } @@ -268,7 +269,7 @@ xdr_u_char(xdrs, ucp) */ bool_t xdr_bool(xdrs, bp) - XDR *xdrs; + register XDR *xdrs; bool_t *bp; { long lb; @@ -326,11 +327,11 @@ xdr_enum(xdrs, ep) */ bool_t xdr_opaque(xdrs, cp, cnt) - XDR *xdrs; + register XDR *xdrs; caddr_t cp; - u_int cnt; + register u_int cnt; { - u_int rndup; + register u_int rndup; static char crud[BYTES_PER_XDR_UNIT]; /* @@ -378,13 +379,13 @@ xdr_opaque(xdrs, cp, cnt) */ bool_t xdr_bytes(xdrs, cpp, sizep, maxsize) - XDR *xdrs; + register XDR *xdrs; char **cpp; - u_int *sizep; + register u_int *sizep; u_int maxsize; { - char *sp = *cpp; /* sp is the actual string pointer */ - u_int nodesize; + register char *sp = *cpp; /* sp is the actual string pointer */ + register u_int nodesize; /* * first deal with the length since xdr bytes are counted @@ -453,13 +454,13 @@ xdr_netobj(xdrs, np) */ bool_t xdr_union(xdrs, dscmp, unp, choices, dfault) - XDR *xdrs; + register XDR *xdrs; enum_t *dscmp; /* enum to decide which arm to work on */ char *unp; /* the union itself */ - struct xdr_discrim *choices; /* [value, xdr proc] for each arm */ + const struct xdr_discrim *choices; /* [value, xdr proc] for each arm */ xdrproc_t dfault; /* default xdr routine */ { - enum_t dscm; + register enum_t dscm; /* * we deal with the discriminator; it's an enum @@ -475,14 +476,14 @@ xdr_union(xdrs, dscmp, unp, choices, dfault) */ for (; choices->proc != NULL_xdrproc_t; choices++) { if (choices->value == dscm) - return ((*(choices->proc))(xdrs, &unp)); + return ((*(choices->proc))(xdrs, unp, LASTUNSIGNED)); } /* * no match - execute the default xdr routine if there is one */ return ((dfault == NULL_xdrproc_t) ? FALSE : - (*dfault)(xdrs, &unp)); + (*dfault)(xdrs, unp, LASTUNSIGNED)); } @@ -502,11 +503,11 @@ xdr_union(xdrs, dscmp, unp, choices, dfault) */ bool_t xdr_string(xdrs, cpp, maxsize) - XDR *xdrs; + register XDR *xdrs; char **cpp; u_int maxsize; { - char *sp = *cpp; /* sp is the actual string pointer */ + register char *sp = *cpp; /* sp is the actual string pointer */ u_int size; u_int nodesize; @@ -570,7 +571,7 @@ xdr_wrapstring(xdrs, cpp) XDR *xdrs; char **cpp; { - if (xdr_string(xdrs, cpp, INT_MAX)) { + if (xdr_string(xdrs, cpp, LASTUNSIGNED)) { return (TRUE); } return (FALSE); diff --git a/extlib/portablexdr-4.9.1/xdr_array.c b/extlib/portablexdr-4.9.1/xdr_array.c index f1bd3397..ffafe7f2 100644 --- a/extlib/portablexdr-4.9.1/xdr_array.c +++ b/extlib/portablexdr-4.9.1/xdr_array.c @@ -47,6 +47,8 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; #include "rpc/types.h" #include "rpc/xdr.h" +#define LASTUNSIGNED ((u_int)0-1) + /* * XDR an array of arbitrary elements @@ -57,18 +59,18 @@ static char sccsid[] = "@(#)xdr_array.c 1.10 87/08/11 Copyr 1984 Sun Micro"; */ bool_t xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) - XDR *xdrs; + register XDR *xdrs; caddr_t *addrp; /* array pointer */ u_int *sizep; /* number of elements */ u_int maxsize; /* max numberof elements */ u_int elsize; /* size in bytes of each element */ xdrproc_t elproc; /* xdr routine to handle each element */ { - u_int i; - caddr_t target = *addrp; - u_int c; /* the actual element count */ - bool_t stat = TRUE; - u_int nodesize; + register u_int i; + register caddr_t target = *addrp; + register u_int c; /* the actual element count */ + register bool_t stat = TRUE; + register u_int nodesize; /* like strings, arrays are really counted arrays */ if (! xdr_u_int(xdrs, sizep)) { @@ -107,7 +109,7 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) * now we xdr each element of array */ for (i = 0; (i < c) && stat; i++) { - stat = (*elproc)(xdrs, &target); + stat = (*elproc)(xdrs, target, LASTUNSIGNED); target += elsize; } @@ -133,18 +135,18 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc) */ bool_t xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem) - XDR *xdrs; - char *basep; - u_int nelem; - u_int elemsize; - xdrproc_t xdr_elem; + register XDR *xdrs; + register char *basep; + register u_int nelem; + register u_int elemsize; + register xdrproc_t xdr_elem; { - u_int i; - char *elptr; + register u_int i; + register char *elptr; elptr = basep; for (i = 0; i < nelem; i++) { - if (! (*xdr_elem)(xdrs, &elptr)) { + if (! (*xdr_elem)(xdrs, elptr, LASTUNSIGNED)) { return(FALSE); } elptr += elemsize; diff --git a/extlib/portablexdr-4.9.1/xdr_float.c b/extlib/portablexdr-4.9.1/xdr_float.c index 0256e484..9dec57ed 100644 --- a/extlib/portablexdr-4.9.1/xdr_float.c +++ b/extlib/portablexdr-4.9.1/xdr_float.c @@ -46,9 +46,9 @@ static char sccsid[] = "@(#)xdr_float.c 1.12 87/08/11 Copyr 1984 Sun Micro"; #include "rpc/types.h" #include "rpc/xdr.h" -#if defined(__CYGWIN32__) || defined(__MINGW32__) -#define vax -#endif +//#if defined(__CYGWIN32__) || defined(__MINGW32__) +//#define vax +//#endif /* * NB: Not portable. @@ -88,8 +88,8 @@ static struct sgl_limits { bool_t xdr_float(xdrs, fp) - XDR *xdrs; - float *fp; + register XDR *xdrs; + register float *fp; { #if defined(vax) struct ieee_single is; @@ -193,14 +193,14 @@ static struct dbl_limits { bool_t xdr_double(xdrs, dp) - XDR *xdrs; + register XDR *xdrs; double *dp; { - long *lp; + register long *lp; #if defined(vax) struct ieee_double id; struct vax_double vd; - struct dbl_limits *lim; + register struct dbl_limits *lim; int i; #endif diff --git a/extlib/portablexdr-4.9.1/xdr_mem.c b/extlib/portablexdr-4.9.1/xdr_mem.c index c8553a5a..b23d9615 100644 --- a/extlib/portablexdr-4.9.1/xdr_mem.c +++ b/extlib/portablexdr-4.9.1/xdr_mem.c @@ -81,7 +81,7 @@ static struct xdr_ops xdrmem_ops = { */ void xdrmem_create(xdrs, addr, size, op) - XDR *xdrs; + register XDR *xdrs; caddr_t addr; u_int size; enum xdr_op op; @@ -101,7 +101,7 @@ xdrmem_destroy(/*xdrs*/) static bool_t xdrmem_getlong(xdrs, lp) - XDR *xdrs; + register XDR *xdrs; long *lp; { @@ -114,7 +114,7 @@ xdrmem_getlong(xdrs, lp) static bool_t xdrmem_putlong(xdrs, lp) - XDR *xdrs; + register XDR *xdrs; long *lp; { @@ -127,9 +127,9 @@ xdrmem_putlong(xdrs, lp) static bool_t xdrmem_getbytes(xdrs, addr, len) - XDR *xdrs; + register XDR *xdrs; caddr_t addr; - u_int len; + register u_int len; { if ((xdrs->x_handy -= len) < 0) @@ -141,9 +141,9 @@ xdrmem_getbytes(xdrs, addr, len) static bool_t xdrmem_putbytes(xdrs, addr, len) - XDR *xdrs; + register XDR *xdrs; caddr_t addr; - u_int len; + register u_int len; { if ((xdrs->x_handy -= len) < 0) @@ -155,7 +155,7 @@ xdrmem_putbytes(xdrs, addr, len) static u_int xdrmem_getpos(xdrs) - XDR *xdrs; + register XDR *xdrs; { return xdrs->x_private - xdrs->x_base; @@ -163,13 +163,13 @@ xdrmem_getpos(xdrs) static bool_t xdrmem_setpos(xdrs, pos) - XDR *xdrs; + register XDR *xdrs; u_int pos; { - caddr_t newaddr = xdrs->x_base + pos; - caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; + register caddr_t newaddr = xdrs->x_base + pos; + register caddr_t lastaddr = xdrs->x_private + xdrs->x_handy; - if ((void*)newaddr > (void*)lastaddr) + if ((long)newaddr > (long)lastaddr) return (FALSE); xdrs->x_private = newaddr; xdrs->x_handy = lastaddr - newaddr; @@ -178,7 +178,7 @@ xdrmem_setpos(xdrs, pos) static long * xdrmem_inline(xdrs, len) - XDR *xdrs; + register XDR *xdrs; int len; { long *buf = 0; diff --git a/extlib/portablexdr-4.9.1/xdr_rec.c b/extlib/portablexdr-4.9.1/xdr_rec.c index e3bebef2..ea52d179 100644 --- a/extlib/portablexdr-4.9.1/xdr_rec.c +++ b/extlib/portablexdr-4.9.1/xdr_rec.c @@ -108,7 +108,7 @@ typedef struct rec_strm { /* * out-goung bits */ - int (*writeit)(caddr_t, caddr_t, int); + int (*writeit)(); caddr_t out_base; /* output buffer (points to frag header) */ caddr_t out_finger; /* next output position */ caddr_t out_boundry; /* data cannot up to this address */ @@ -117,7 +117,7 @@ typedef struct rec_strm { /* * in-coming bits */ - int (*readit)(caddr_t, caddr_t, int); + int (*readit)(); u_long in_size; /* fixed size of the input buffer */ caddr_t in_base; caddr_t in_finger; /* location of next byte to be had */ @@ -128,10 +128,10 @@ typedef struct rec_strm { u_int recvsize; } RECSTREAM; -static bool_t flush_out(RECSTREAM *, bool_t ); -static bool_t get_input_bytes(RECSTREAM *, caddr_t, int ); -static bool_t set_input_fragment(RECSTREAM *); -static bool_t skip_input_bytes(RECSTREAM *, long); +static bool_t flush_out(register RECSTREAM *, bool_t ); +static bool_t get_input_bytes(register RECSTREAM *, register caddr_t, register int ); +static bool_t set_input_fragment(register RECSTREAM *); +static bool_t skip_input_bytes(register RECSTREAM *, long); /* * Create an xdr handle for xdrrec @@ -144,14 +144,14 @@ static bool_t skip_input_bytes(RECSTREAM *, long); */ void xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) - XDR *xdrs; - u_int sendsize; - u_int recvsize; - caddr_t tcp_handle; - int (*readit)(caddr_t, caddr_t, int); /* like read, but pass it a tcp_handle, not sock */ - int (*writeit)(caddr_t, caddr_t, int); /* like write, but pass it a tcp_handle, not sock */ + register XDR *xdrs; + register u_int sendsize; + register u_int recvsize; + void *tcp_handle; + int (*readit)(); /* like read, but pass it a tcp_handle, not sock */ + int (*writeit)(); /* like write, but pass it a tcp_handle, not sock */ { - RECSTREAM *rstrm = + register RECSTREAM *rstrm = (RECSTREAM *)mem_alloc(sizeof(RECSTREAM)); if (rstrm == NULL) { @@ -173,7 +173,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit) return; } for (rstrm->out_base = rstrm->the_buffer; - (size_t)(void*) rstrm->out_base % BYTES_PER_XDR_UNIT != 0; + (long) rstrm->out_base % BYTES_PER_XDR_UNIT != 0; rstrm->out_base++); rstrm->in_base = rstrm->out_base + sendsize; /* @@ -207,8 +207,8 @@ xdrrec_getlong(xdrs, lp) XDR *xdrs; long *lp; { - RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - long *buflp = (long *)(rstrm->in_finger); + register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); + register long *buflp = (long *)(rstrm->in_finger); long mylong; /* first try the inline, fast case */ @@ -230,8 +230,8 @@ xdrrec_putlong(xdrs, lp) XDR *xdrs; long *lp; { - RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - long *dest_lp = ((long *)(rstrm->out_finger)); + register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); + register long *dest_lp = ((long *)(rstrm->out_finger)); if ((rstrm->out_finger += sizeof(long)) > rstrm->out_boundry) { /* @@ -252,11 +252,11 @@ xdrrec_putlong(xdrs, lp) static bool_t /* must manage buffers, fragments, and records */ xdrrec_getbytes(xdrs, addr, len) XDR *xdrs; - caddr_t addr; - u_int len; + register caddr_t addr; + register u_int len; { - RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - int current; + register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); + register int current; while (len > 0) { current = rstrm->fbtbc; @@ -280,11 +280,11 @@ xdrrec_getbytes(xdrs, addr, len) static bool_t xdrrec_putbytes(xdrs, addr, len) XDR *xdrs; - caddr_t addr; - u_int len; + register caddr_t addr; + register u_int len; { - RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - int current; + register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); + register int current; while (len > 0) { current = rstrm->out_boundry - rstrm->out_finger; @@ -304,10 +304,10 @@ xdrrec_putbytes(xdrs, addr, len) static u_int xdrrec_getpos(xdrs) - XDR *xdrs; + register XDR *xdrs; { - RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; - long pos; + register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; + register long pos; pos = lseek(rstrm->tcp_handle, (long) 0, 1); if (pos != -1) @@ -330,10 +330,10 @@ xdrrec_getpos(xdrs) static bool_t xdrrec_setpos(xdrs, pos) - XDR *xdrs; + register XDR *xdrs; u_int pos; { - RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; + register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; u_int currpos = xdrrec_getpos(xdrs); int delta = currpos - pos; caddr_t newpos; @@ -368,10 +368,10 @@ xdrrec_setpos(xdrs, pos) static long * xdrrec_inline(xdrs, len) - XDR *xdrs; + register XDR *xdrs; int len; { - RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; + register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; long * buf = NULL; switch (xdrs->x_op) { @@ -399,9 +399,9 @@ xdrrec_inline(xdrs, len) static void xdrrec_destroy(xdrs) - XDR *xdrs; + register XDR *xdrs; { - RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; + register RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private; mem_free(rstrm->the_buffer, rstrm->sendsize + rstrm->recvsize + BYTES_PER_XDR_UNIT); @@ -421,7 +421,7 @@ bool_t xdrrec_skiprecord(xdrs) XDR *xdrs; { - RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); + register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) { if (! skip_input_bytes(rstrm, rstrm->fbtbc)) @@ -443,7 +443,7 @@ bool_t xdrrec_eof(xdrs) XDR *xdrs; { - RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); + register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); while (rstrm->fbtbc > 0 || (! rstrm->last_frag)) { if (! skip_input_bytes(rstrm, rstrm->fbtbc)) @@ -468,19 +468,19 @@ xdrrec_endofrecord(xdrs, sendnow) XDR *xdrs; bool_t sendnow; { - RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); - u_long len; /* fragment length */ + register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private); + register u_long len; /* fragment length */ if (sendnow || rstrm->frag_sent || - ((u_long*)rstrm->out_finger + sizeof(u_long) >= - (u_long*)rstrm->out_boundry)) { + ((u_long)rstrm->out_finger + sizeof(u_long) >= + (u_long)rstrm->out_boundry)) { rstrm->frag_sent = FALSE; return (flush_out(rstrm, TRUE)); } - len = (u_long*)(rstrm->out_finger) - (u_long*)(rstrm->frag_header) - + len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->frag_header) - sizeof(u_long); *(rstrm->frag_header) = htonl((u_long)len | LAST_FRAG); - rstrm->frag_header = (u_long*)rstrm->out_finger; + rstrm->frag_header = (u_long *)rstrm->out_finger; rstrm->out_finger += sizeof(u_long); return (TRUE); } @@ -491,33 +491,33 @@ xdrrec_endofrecord(xdrs, sendnow) */ static bool_t flush_out(rstrm, eor) - RECSTREAM *rstrm; + register RECSTREAM *rstrm; bool_t eor; { - u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; - u_long len = (u_long*)(rstrm->out_finger) - - (u_long*)(rstrm->frag_header) - sizeof(u_long); + register u_long eormask = (eor == TRUE) ? LAST_FRAG : 0; + register u_long len = (u_long)(rstrm->out_finger) - + (u_long)(rstrm->frag_header) - sizeof(u_long); *(rstrm->frag_header) = htonl(len | eormask); - len = (u_long*)(rstrm->out_finger) - (u_long*)(rstrm->out_base); + len = (u_long)(rstrm->out_finger) - (u_long)(rstrm->out_base); if ((*(rstrm->writeit))(rstrm->tcp_handle, rstrm->out_base, (int)len) != (int)len) return (FALSE); - rstrm->frag_header = (u_long*)rstrm->out_base; + rstrm->frag_header = (u_long *)rstrm->out_base; rstrm->out_finger = (caddr_t)rstrm->out_base + sizeof(u_long); return (TRUE); } static bool_t /* knows nothing about records! Only about input buffers */ fill_input_buf(rstrm) - RECSTREAM *rstrm; + register RECSTREAM *rstrm; { - caddr_t where; + register caddr_t where; u_int i; - int len; + register int len; where = rstrm->in_base; - i = (size_t)(u_long*) rstrm->in_boundry % BYTES_PER_XDR_UNIT; + i = (long) rstrm->in_boundry % BYTES_PER_XDR_UNIT; where += i; len = rstrm->in_size - i; if ((len = (*(rstrm->readit))(rstrm->tcp_handle, where, len)) == -1) @@ -530,11 +530,11 @@ fill_input_buf(rstrm) static bool_t /* knows nothing about records! Only about input buffers */ get_input_bytes(rstrm, addr, len) - RECSTREAM *rstrm; - caddr_t addr; - int len; + register RECSTREAM *rstrm; + register caddr_t addr; + register int len; { - int current; + register int current; while (len > 0) { current = rstrm->in_boundry - rstrm->in_finger; @@ -554,7 +554,7 @@ get_input_bytes(rstrm, addr, len) static bool_t /* next two bytes of the input stream are treated as a header */ set_input_fragment(rstrm) - RECSTREAM *rstrm; + register RECSTREAM *rstrm; { u_long header; @@ -568,10 +568,10 @@ set_input_fragment(rstrm) static bool_t /* consumes input bytes; knows nothing about records! */ skip_input_bytes(rstrm, cnt) - RECSTREAM *rstrm; + register RECSTREAM *rstrm; long cnt; { - int current; + register int current; while (cnt > 0) { current = rstrm->in_boundry - rstrm->in_finger; @@ -589,7 +589,7 @@ skip_input_bytes(rstrm, cnt) static u_int fix_buf_size(s) - u_int s; + register u_int s; { if (s < 100) diff --git a/extlib/portablexdr-4.9.1/xdr_reference.c b/extlib/portablexdr-4.9.1/xdr_reference.c index f6ce9ea4..e78fe340 100644 --- a/extlib/portablexdr-4.9.1/xdr_reference.c +++ b/extlib/portablexdr-4.9.1/xdr_reference.c @@ -47,6 +47,8 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; #include "rpc/types.h" #include "rpc/xdr.h" +#define LASTUNSIGNED ((u_int)0-1) + /* * XDR an indirect pointer * xdr_reference is for recursively translating a structure that is @@ -58,13 +60,13 @@ static char sccsid[] = "@(#)xdr_reference.c 1.11 87/08/11 SMI"; */ bool_t xdr_reference(xdrs, pp, size, proc) - XDR *xdrs; + register XDR *xdrs; caddr_t *pp; /* the pointer to work on */ u_int size; /* size of the object pointed to */ xdrproc_t proc; /* xdr routine to handle the object */ { - caddr_t loc = *pp; - bool_t stat; + register caddr_t loc = *pp; + register bool_t stat; if (loc == NULL) switch (xdrs->x_op) { @@ -83,7 +85,7 @@ xdr_reference(xdrs, pp, size, proc) break; } - stat = (*proc)(xdrs, &loc); + stat = (*proc)(xdrs, loc, LASTUNSIGNED); if (xdrs->x_op == XDR_FREE) { mem_free(loc, size); @@ -114,7 +116,7 @@ xdr_reference(xdrs, pp, size, proc) */ bool_t xdr_pointer(xdrs,objpp,obj_size,xdr_obj) - XDR *xdrs; + register XDR *xdrs; char **objpp; u_int obj_size; xdrproc_t xdr_obj; diff --git a/extlib/portablexdr-4.9.1/xdr_stdio.c b/extlib/portablexdr-4.9.1/xdr_stdio.c index ccc5ed91..390aea30 100644 --- a/extlib/portablexdr-4.9.1/xdr_stdio.c +++ b/extlib/portablexdr-4.9.1/xdr_stdio.c @@ -90,7 +90,7 @@ static struct xdr_ops xdrstdio_ops = { */ void xdrstdio_create(xdrs, file, op) - XDR *xdrs; + register XDR *xdrs; FILE *file; enum xdr_op op; { @@ -108,7 +108,7 @@ xdrstdio_create(xdrs, file, op) */ static void xdrstdio_destroy(xdrs) - XDR *xdrs; + register XDR *xdrs; { (void)fflush((FILE *)xdrs->x_private); /* xx should we close the file ?? */ @@ -117,7 +117,7 @@ xdrstdio_destroy(xdrs) static bool_t xdrstdio_getlong(xdrs, lp) XDR *xdrs; - long *lp; + register long *lp; { if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1) diff --git a/scripts/create_certs.sh b/scripts/create_certs.sh new file mode 100755 index 00000000..bd49b6e5 --- /dev/null +++ b/scripts/create_certs.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# Root CA + +openssl genrsa -out rootCA.key 4096 +openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -subj "/C=GB/O=UKAEA/CN=UDA" -out rootCA.crt + +# Server certificate + +openssl genrsa -out server.key 4096 +openssl req -new -key server.key -subj "/C=GB/O=UKAEA/CN=localhost" -out server.csr +openssl x509 -req -in server.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out server.crt + +# Client certificate + +openssl genrsa -out client.key 4096 +openssl req -new -key client.key -subj "/C=GB/O=UKAEA/CN=client" -out client.csr +openssl x509 -req -in client.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out client.crt \ No newline at end of file diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 1c57d7a2..5ba20c8b 100755 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -7,7 +7,7 @@ include_directories( SYSTEM ${Boost_INCLUDE_DIR} ) # Hack to build on GCC/12.2.0 if( NOT WIN32 OR MINGW ) - if ( NOT APPLE ) + if ( NOT APPLE AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM") ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-use-after-free -Wno-mismatched-new-delete" ) endif() endif() @@ -16,12 +16,14 @@ find_package( LibXml2 REQUIRED ) if( WIN32 AND NOT MINGW ) add_compile_definitions( MINGW ) - add_definitions( /W2 /WX ) + message( AUTHOR_WARNING "BEWARE: Not treating MSVC warnings as errors due to known issue compiling capnp schema" ) + add_definitions( /W2 ) + #add_definitions( /W2 /WX ) else() add_definitions( -Wall -Werror -Wextra -Wno-unused-parameter -Wno-missing-field-initializers ) if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 5.0 ) add_definitions( -Wno-format-truncation -Wno-format-overflow ) - if( NOT MINGW ) + if( NOT MINGW AND NOT ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "IntelLLVM") ) add_definitions( -Wno-use-after-free ) endif() endif() @@ -42,7 +44,7 @@ add_subdirectory( authentication ) add_subdirectory( structures ) add_subdirectory( clientserver ) add_subdirectory( client ) -#add_subdirectory( client2 ) +add_subdirectory( client2 ) if( ENABLE_CAPNP ) add_compile_definitions( CAPNP_ENABLED=1 ) add_subdirectory( serialisation ) @@ -54,7 +56,7 @@ endif() if( NOT CLIENT_ONLY ) add_subdirectory( server ) -# add_subdirectory( server2 ) + add_subdirectory( server2 ) add_subdirectory( plugins ) endif() @@ -133,6 +135,12 @@ foreach( PKGCONFIG_FILE ${PKGCONFIG_FILES} ) ) endforeach() +install( + DIRECTORY + ${CMAKE_BINARY_DIR}/lib/pkgconfig + DESTINATION lib +) + find_program( XINETD_EXE xinetd PATHS /usr/sbin/ /usr/local/sbin/ ) configure_file( @@ -146,3 +154,23 @@ install( DESTINATION etc PERMISSIONS OWNER_EXECUTE OWNER_READ GROUP_EXECUTE GROUP_READ WORLD_EXECUTE WORLD_READ ) + +set( SERVICE_FILES + uda.socket + uda@.service +) + +foreach( SERVICE_FILE ${SERVICE_FILES} ) + configure_file( + "${CMAKE_SOURCE_DIR}/source/etc/${SERVICE_FILE}.in" + "${CMAKE_BINARY_DIR}/etc/${SERVICE_FILE}" + @ONLY + ) + + install( + FILES "${CMAKE_BINARY_DIR}/etc/${SERVICE_FILE}" + DESTINATION etc + PERMISSIONS OWNER_READ GROUP_READ WORLD_READ + ) +endforeach() + diff --git a/source/authentication/CMakeLists.txt b/source/authentication/CMakeLists.txt index aa5a6bca..3920900a 100755 --- a/source/authentication/CMakeLists.txt +++ b/source/authentication/CMakeLists.txt @@ -24,11 +24,12 @@ elseif( TIRPC_FOUND ) include_directories( ${TIRPC_INCLUDE_DIR} ) endif() -add_library( authentication-client-objects OBJECT udaClientSSL.cpp udaClientSSL.h udaServerSSL.h ) -target_link_libraries( authentication-client-objects OpenSSL::SSL LibXml2::LibXml2 ) +add_library( authentication-client-objects OBJECT udaClientSSL.cpp udaClientSSL.h udaServerSSL.h utils.cpp ) +target_link_libraries( authentication-client-objects PRIVATE OpenSSL::SSL LibXml2::LibXml2 ) +target_compile_definitions( authentication-client-objects PRIVATE ) if( NOT CLIENT_ONLY ) - add_library( authentication-server-objects OBJECT udaServerSSL.cpp udaClientSSL.h ) + add_library( authentication-server-objects OBJECT udaServerSSL.cpp udaClientSSL.h utils.cpp ) target_compile_definitions( authentication-server-objects PRIVATE -DSERVERBUILD ) - target_link_libraries( authentication-server-objects OpenSSL::SSL LibXml2::LibXml2 ) + target_link_libraries( authentication-server-objects PRIVATE OpenSSL::SSL LibXml2::LibXml2 ) endif() \ No newline at end of file diff --git a/source/authentication/udaClientSSL.cpp b/source/authentication/udaClientSSL.cpp index f92bd978..16aff91b 100755 --- a/source/authentication/udaClientSSL.cpp +++ b/source/authentication/udaClientSSL.cpp @@ -4,7 +4,7 @@ #include #include -#include +#include #include #include @@ -12,6 +12,8 @@ #include #include +#include "utils.h" + static bool g_sslDisabled = true; // Default state is not SSL authentication static int g_sslProtocol = 0; // The default server host name has the SSL protocol name prefix or static int g_sslSocket = -1; @@ -84,7 +86,6 @@ void closeUdaClientSSL() if (ctx != nullptr) { SSL_CTX_free(ctx); } - EVP_cleanup(); g_ssl = nullptr; g_ctx = nullptr; #ifdef _WIN32 @@ -275,7 +276,7 @@ int configureUdaClientSSLContext(const HostData* host) const ASN1_TIME* before = X509_get_notBefore(clientCert); const ASN1_TIME* after = X509_get_notAfter(clientCert); - char work[X509STRINGSIZE]; + char work[X509_STRING_SIZE]; UDA_LOG(UDA_LOG_DEBUG, "Client X509 subject: %s\n", X509_NAME_oneline(X509_get_subject_name(clientCert), work, sizeof(work))); UDA_LOG(UDA_LOG_DEBUG, "Client X509 issuer: %s\n", @@ -284,31 +285,22 @@ int configureUdaClientSSLContext(const HostData* host) time_t current_time = time(nullptr); char* c_time_string = ctime(¤t_time); - int rc = 0, count = 0; - BIO* b = BIO_new(BIO_s_mem()); - if (b && ASN1_TIME_print(b, before)) { - count = BIO_read(b, work, X509STRINGSIZE - 1); - BIO_free(b); - } - work[count] = '\0'; - UDA_LOG(UDA_LOG_DEBUG, "Client X509 not before: %s\n", work); + std::string before_string = to_string(before); + + UDA_LOG(UDA_LOG_DEBUG, "Client X509 not before: %s\n", before_string.c_str()); + int rc = 0; if ((rc = X509_cmp_time(before, ¤t_time)) >= 0) { // Not Before is after Now! X509_free(clientCert); UDA_LOG(UDA_LOG_DEBUG, "Current Time : %s\n", c_time_string); UDA_LOG(UDA_LOG_DEBUG, "Client X509 not before date is before the current date!\n"); - UDA_LOG(UDA_LOG_DEBUG, "The client SSL/x509 certificate is Not Valid - the Vaidity Date is in the future!\n"); - UDA_THROW_ERROR(999, "The client SSL/x509 certificate is Not Valid - the Vaidity Date is in the future"); + UDA_LOG(UDA_LOG_DEBUG, "The client SSL/x509 certificate is Not Valid - the Validity Date is in the future!\n"); + UDA_THROW_ERROR(999, "The client SSL/x509 certificate is Not Valid - the Validity Date is in the future"); } - count = 0; - b = BIO_new(BIO_s_mem()); - if (b && ASN1_TIME_print(b, after)) { - count = BIO_read(b, work, X509STRINGSIZE - 1); - BIO_free(b); - } - work[count] = '\0'; - UDA_LOG(UDA_LOG_DEBUG, "Client X509 not after : %s\n", work); + std::string after_string = to_string(after); + + UDA_LOG(UDA_LOG_DEBUG, "Client X509 not after : %s\n", after_string.c_str()); if ((rc = X509_cmp_time(after, ¤t_time)) <= 0) {// Not After is before Now! X509_free(clientCert); UDA_LOG(UDA_LOG_DEBUG, "Current Time : %s\n", c_time_string); @@ -319,7 +311,7 @@ int configureUdaClientSSLContext(const HostData* host) X509_free(clientCert); UDA_LOG(UDA_LOG_DEBUG, "Current Time : %s\n", c_time_string); - UDA_LOG(UDA_LOG_DEBUG, "Cient certificate date validity checked but not validated \n"); + UDA_LOG(UDA_LOG_DEBUG, "Client certificate date validity checked but not validated \n"); return 0; } @@ -407,7 +399,7 @@ int startUdaClientSSL() // Server's details - not required apart from logging - char work[X509STRINGSIZE]; + char work[X509_STRING_SIZE]; UDA_LOG(UDA_LOG_DEBUG, "Server certificate verified\n"); UDA_LOG(UDA_LOG_DEBUG, "X509 subject: %s\n", X509_NAME_oneline(X509_get_subject_name(peer), work, sizeof(work))); @@ -422,14 +414,9 @@ int startUdaClientSSL() time_t current_time = time(nullptr); char* c_time_string = ctime(¤t_time); - int count = 0; - BIO* b = BIO_new(BIO_s_mem()); - if (b && ASN1_TIME_print(b, before)) { - count = BIO_read(b, work, X509STRINGSIZE - 1); - BIO_free(b); - } - work[count] = '\0'; - UDA_LOG(UDA_LOG_DEBUG, "Server X509 not before: %s\n", work); + std::string before_string = to_string(before); + + UDA_LOG(UDA_LOG_DEBUG, "Server X509 not before: %s\n", before_string.c_str()); if ((rc = X509_cmp_time(before, ¤t_time)) >= 0) {// Not Before is after Now! X509_free(peer); UDA_LOG(UDA_LOG_DEBUG, "Current Time : %s\n", c_time_string); @@ -439,14 +426,9 @@ int startUdaClientSSL() UDA_THROW_ERROR(999, "The Server's SSL/x509 certificate is Not Valid - the Vaidity Date is in the future"); } - count = 0; - b = BIO_new(BIO_s_mem()); - if (b && ASN1_TIME_print(b, after)) { - count = BIO_read(b, work, X509STRINGSIZE - 1); - BIO_free(b); - } - work[count] = '\0'; - UDA_LOG(UDA_LOG_DEBUG, "Server X509 not after : %s\n", work); + std::string after_string = to_string(after); + + UDA_LOG(UDA_LOG_DEBUG, "Server X509 not after : %s\n", after_string.c_str()); if ((rc = X509_cmp_time(after, ¤t_time)) <= 0) {// Not After is before Now! X509_free(peer); UDA_LOG(UDA_LOG_DEBUG, "Current Time : %s\n", c_time_string); diff --git a/source/authentication/udaClientSSL.h b/source/authentication/udaClientSSL.h old mode 100755 new mode 100644 index 52a88d6f..5cfa4309 --- a/source/authentication/udaClientSSL.h +++ b/source/authentication/udaClientSSL.h @@ -7,26 +7,27 @@ // Create the SSL context and binding to the socket // 3 UDA protocol modes: TCP without SSL/TLS, TCP and UDP both with SSL/TLS -// This set of functions is concerned only with the SSL/TLS protocol (authentication and encryption) - not with establishing socket connections or non SSL TCP transport +// This set of functions is concerned only with the SSL/TLS protocol (authentication and encryption) - not with +// establishing socket connections or non SSL TCP transport -// Server host addressed beginng with SSL:// are assumed to be using SSL authentication. The SSL:// prefix is removed to make the connection. +// Server host addressed beginng with SSL:// are assumed to be using SSL authentication. The SSL:// prefix is removed to +// make the connection. -#include -#include +#include #include -#include +#include #include -#include +#include +#include -#define VERIFY_DEPTH 4 -#define X509STRINGSIZE 256 +#define VERIFY_DEPTH 4 +#include #include #include -#include bool getUdaClientSSLDisabled(); -SSL *getUdaClientSSL(); +SSL* getUdaClientSSL(); void putUdaClientSSLSocket(int s); void closeUdaClientSSL(); void putUdaClientSSLProtocol(int specified); diff --git a/source/authentication/udaServerSSL.cpp b/source/authentication/udaServerSSL.cpp old mode 100755 new mode 100644 index 93521c64..62ba90ac --- a/source/authentication/udaServerSSL.cpp +++ b/source/authentication/udaServerSSL.cpp @@ -3,35 +3,36 @@ #include "udaServerSSL.h" #include "server/createXDRStream.h" -#include -#include +#include +#include #include -#include +#include #include -#include -#include +#include +#include #include #include #include -#define VERIFY_DEPTH 4 -#define X509STRINGSIZE 256 +#include "utils.h" + +#define VERIFY_DEPTH 4 /* Note on initialisation: UDA Servers using plugins that connect to other UDA servers through the standard client API library need to block initialisation of the SSL library by the client. Initialisation must be done once only. -As all information passed between plugins and servers is through the interface structure, the state -of initialisation by the server must be passed within the interface. This state information is local +As all information passed between plugins and servers is through the interface structure, the state +of initialisation by the server must be passed within the interface. This state information is local and should not be passed to subsequent servers. An alternative and simpler mechanism is for the server -to assign a value to an environment variable, and for the client to test this environment variable. +to assign a value to an environment variable, and for the client to test this environment variable. */ -static bool g_sslDisabled = true; // Default state is not SSL authentication +static bool g_sslDisabled = true; // Default state is not SSL authentication static int g_sslSocket = -1; -static bool g_sslOK = false; // SSL Authentication has been passed successfully: default is NOT Passed -static bool g_sslInit = false; // Global initialisation of SSL completed +static bool g_sslOK = false; // SSL Authentication has been passed successfully: default is NOT Passed +static bool g_sslInit = false; // Global initialisation of SSL completed static SSL* g_ssl = nullptr; static SSL_CTX* g_ctx = nullptr; @@ -39,17 +40,11 @@ static void initUdaServerSSL(); static SSL_CTX* createUdaServerSSLContext(); static int configureUdaServerSSLContext(); static X509_CRL* loadUdaServerSSLCrl(const char* crlist); -static int addUdaServerSSLCrlsStore(X509_STORE* st, STACK_OF(X509_CRL)* crls); +static int addUdaServerSSLCrlsStore(X509_STORE* st, STACK_OF(X509_CRL) * crls); -void putUdaServerSSLSocket(int socket) -{ - g_sslSocket = socket; -} +void putUdaServerSSLSocket(int socket) { g_sslSocket = socket; } -bool getUdaServerSSLDisabled() -{ - return g_sslDisabled; -} +bool getUdaServerSSLDisabled() { return g_sslDisabled; } void reportServerSSLErrorCode(int rc) { @@ -93,7 +88,8 @@ void reportServerSSLErrorCode(int rc) void initUdaServerSSL() { - if (g_sslInit) return; // Already initialised + if (g_sslInit) + return; // Already initialised if (getenv("UDA_SSL_INITIALISED")) { g_sslInit = true; UDA_LOG(UDA_LOG_DEBUG, "Prior SSL initialisation\n"); @@ -125,8 +121,8 @@ void closeUdaServerSSL() SSL_shutdown(g_ssl); SSL_free(g_ssl); } - if (g_ctx != nullptr) SSL_CTX_free(g_ctx); - EVP_cleanup(); + if (g_ctx != nullptr) + SSL_CTX_free(g_ctx); g_ssl = nullptr; g_ctx = nullptr; #ifdef _WIN32 @@ -140,7 +136,7 @@ void closeUdaServerSSL() SSL_CTX* createUdaServerSSLContext() { - const SSL_METHOD* method = SSLv23_server_method(); // standard TCP + const SSL_METHOD* method = SSLv23_server_method(); // standard TCP // method = DTLSv1_server_method() // reliable UDP @@ -155,14 +151,6 @@ SSL_CTX* createUdaServerSSLContext() // Disable SSLv2 for v3 and TSLv1 negotiation SSL_CTX_set_options(g_ctx, SSL_OP_NO_SSLv2); -/* -// Set the Cipher List - if (SSL_CTX_set_cipher_list(g_ctx, "AES128-SHA") <= 0) { - printf("Error setting the cipher list.\n"); - exit(0); - } -*/ - UDA_LOG(UDA_LOG_DEBUG, "SSL Context created\n"); return g_ctx; @@ -185,9 +173,9 @@ int configureUdaServerSSLContext() if (!ca) { UDA_ADD_ERROR(999, "No Certificate Authority certificate!"); } -// if (!crlist) { -// UDA_ADD_ERROR(999, "No Certificate Revocation List!"); -// } + // if (!crlist) { + // UDA_ADD_ERROR(999, "No Certificate Revocation List!"); + // } UDA_LOG(UDA_LOG_DEBUG, "Certificate/Key/CRL environment variable problem!\n"); return 999; } @@ -214,12 +202,12 @@ int configureUdaServerSSLContext() SSL_CTX_set_verify(g_ctx, SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT, nullptr); SSL_CTX_set_verify_depth(g_ctx, VERIFY_DEPTH); - // Add verification against the Certificate Revocation List - X509_VERIFY_PARAM* params = X509_VERIFY_PARAM_new(); - X509_VERIFY_PARAM_set_flags(params, X509_V_FLAG_CRL_CHECK); - SSL_CTX_set1_param(g_ctx, params); - if (crlist != nullptr) { + // Add verification against the Certificate Revocation List + X509_VERIFY_PARAM* params = X509_VERIFY_PARAM_new(); + X509_VERIFY_PARAM_set_flags(params, X509_V_FLAG_CRL_CHECK); + SSL_CTX_set1_param(g_ctx, params); + X509_CRL* crl = loadUdaServerSSLCrl(crlist); if (!crl) { return 999; // CRL not loaded @@ -236,21 +224,6 @@ int configureUdaServerSSLContext() SSL_CTX_set1_verify_cert_store(g_ctx, st); } - // Set CA list used for client authentication - -/* - if(SSL_CTX_use_certificate_chain_file(g_ctx, getenv("UDA_SERVER_CA_SSL_CERT")) < 1){ - //printf("Error setting the CA chain file\n"); - exit(0); - } -*/ -/* - SSL_CTX_set_client_CA_list(g_ctx, SSL_load_client_CA_file(getenv("UDA_SERVER_CA_SSL_CERT"))); - - rc = load_CA(g_ssl, g_ctx, getenv("UDA_SERVER_CA_SSL_CERT")); // calls SSL_CTX_add_client_CA(g_ctx, X509 *cacert) and SSL_add_client_CA(g_ssl, X509 *cacert) - if(rc == 0)fprintf(logout, "Unable to load Client CA!\n"); -*/ - UDA_LOG(UDA_LOG_DEBUG, "SSL Context configured\n"); return 0; @@ -287,7 +260,7 @@ X509_CRL* loadUdaServerSSLCrl(const char* crlist) return crl; } -int addUdaServerSSLCrlsStore(X509_STORE* st, STACK_OF(X509_CRL)* crls) +int addUdaServerSSLCrlsStore(X509_STORE* st, STACK_OF(X509_CRL) * crls) { X509_CRL* crl; for (int i = 0; i < sk_X509_CRL_num(crls); i++) { @@ -352,7 +325,7 @@ int startUdaServerSSL() X509* peer = SSL_get_peer_certificate(g_ssl); if (peer != nullptr) { - if ((rc = SSL_get_verify_result(g_ssl)) != X509_V_OK) { + if ((rc = (int)SSL_get_verify_result(g_ssl)) != X509_V_OK) { // returns X509_V_OK if the certificate was not obtained as no error occured! X509_free(peer); UDA_LOG(UDA_LOG_DEBUG, "SSL Client certificate presented but verification error!\n"); @@ -362,14 +335,20 @@ int startUdaServerSSL() // Client's details - char work[X509STRINGSIZE]; + char work[X509_STRING_SIZE]; UDA_LOG(UDA_LOG_DEBUG, "Client certificate verified\n"); UDA_LOG(UDA_LOG_DEBUG, "X509 subject: %s\n", X509_NAME_oneline(X509_get_subject_name(peer), work, sizeof(work))); - UDA_LOG(UDA_LOG_DEBUG, "X509 issuer: %s\n", - X509_NAME_oneline(X509_get_issuer_name(peer), work, sizeof(work))); - UDA_LOG(UDA_LOG_DEBUG, "X509 not before: %d\n", X509_get_notBefore(peer)); - UDA_LOG(UDA_LOG_DEBUG, "X509 not after: %d\n", X509_get_notAfter(peer)); + UDA_LOG(UDA_LOG_DEBUG, "X509 issuer: %s\n", X509_NAME_oneline(X509_get_issuer_name(peer), work, sizeof(work))); + + ASN1_TIME* before = X509_getm_notBefore(peer); + ASN1_TIME* after = X509_getm_notAfter(peer); + + std::string before_string = to_string(before); + std::string after_string = to_string(after); + + UDA_LOG(UDA_LOG_DEBUG, "X509 not before: %d\n", before_string.c_str()); + UDA_LOG(UDA_LOG_DEBUG, "X509 not after: %d\n", after_string.c_str()); X509_free(peer); } else { X509_free(peer); @@ -391,11 +370,11 @@ int startUdaServerSSL() #ifdef UNUSED #elif defined(__GNUC__) -# define UNUSED __attribute__((unused)) +#define UNUSED __attribute__((unused)) #elif defined(__LCLINT__) -# define UNUSED /*@unused@*/ +#define UNUSED /*@unused@*/ #else -# define UNUSED +#define UNUSED #endif int writeUdaServerSSL(void* iohandle, const char* buf, int count) @@ -406,7 +385,7 @@ int writeUdaServerSSL(void* iohandle, const char* buf, int count) int rc; - fd_set wfds; // File Descriptor Set for Writing to the Socket + fd_set wfds; // File Descriptor Set for Writing to the Socket struct timeval tv = {}; auto io_data = reinterpret_cast(iohandle); @@ -417,7 +396,7 @@ int writeUdaServerSSL(void* iohandle, const char* buf, int count) while ((rc = select(g_sslSocket + 1, nullptr, &wfds, nullptr, &tv)) <= 0) { - if (rc < 0) { // Error + if (rc < 0) { // Error if (errno == EBADF) { UDA_LOG(UDA_LOG_DEBUG, "Client Socket is closed! Closing server down.\n"); } else { @@ -439,8 +418,9 @@ int writeUdaServerSSL(void* iohandle, const char* buf, int count) *io_data->server_tot_block_time += tv.tv_usec / 1000; if (*io_data->server_tot_block_time / 1000 > *io_data->server_timeout) { - UDA_LOG(UDA_LOG_DEBUG, "Total Blocking Time: %d (ms). Closing server down.\n", *io_data->server_tot_block_time); - return -1; // Timeout + UDA_LOG(UDA_LOG_DEBUG, "Total Blocking Time: %d (ms). Closing server down.\n", + *io_data->server_tot_block_time); + return -1; // Timeout } updateSelectParms(g_sslSocket, &wfds, &tv, *io_data->server_tot_block_time); @@ -480,7 +460,7 @@ int writeUdaServerSSL(void* iohandle, const char* buf, int count) int readUdaServerSSL(void* iohandle, char* buf, int count) { int rc; - fd_set rfds; // File Descriptor Set for Reading from the Socket + fd_set rfds; // File Descriptor Set for Reading from the Socket struct timeval tv, tvc; // Wait till it's possible to read from the socket @@ -494,7 +474,7 @@ int readUdaServerSSL(void* iohandle, char* buf, int count) while ((rc = select(g_sslSocket + 1, &rfds, nullptr, nullptr, &tvc)) <= 0) { - if (rc < 0) { // Error + if (rc < 0) { // Error if (errno == EBADF) { UDA_LOG(UDA_LOG_DEBUG, "Client Socket is closed! Closing server down.\n"); } else { @@ -504,11 +484,10 @@ int readUdaServerSSL(void* iohandle, char* buf, int count) return -1; } - *io_data->server_tot_block_time += (int)tv.tv_usec / 1000; // ms + *io_data->server_tot_block_time += (int)tv.tv_usec / 1000; // ms if (*io_data->server_tot_block_time > 1000 * *io_data->server_timeout) { - UDA_LOG(UDA_LOG_DEBUG, - "Total Wait Time Exceeds Lifetime Limit = %d (ms). Closing server down.\n", + UDA_LOG(UDA_LOG_DEBUG, "Total Wait Time Exceeds Lifetime Limit = %d (ms). Closing server down.\n", *io_data->server_timeout * 1000); return -1; } @@ -522,7 +501,7 @@ int readUdaServerSSL(void* iohandle, char* buf, int count) } #endif - updateSelectParms(g_sslSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep blocking and wait for data + updateSelectParms(g_sslSocket, &rfds, &tv, *io_data->server_tot_block_time); // Keep blocking and wait for data tvc = tv; } @@ -533,49 +512,49 @@ int readUdaServerSSL(void* iohandle, char* buf, int count) blocked = 0; rc = SSL_read(g_ssl, buf, count); - switch (SSL_get_error(g_ssl, rc)) { // check for SSL errors - case SSL_ERROR_NONE: // clean read + switch (SSL_get_error(g_ssl, rc)) { // check for SSL errors + case SSL_ERROR_NONE: // clean read break; - case SSL_ERROR_ZERO_RETURN: // connection closed by client (not caught by select?) + case SSL_ERROR_ZERO_RETURN: // connection closed by client (not caught by select?) reportServerSSLErrorCode(rc); UDA_LOG(UDA_LOG_DEBUG, "Client socket connection closed!\n"); UDA_ADD_ERROR(999, "Client socket connection closed!"); return -1; - case SSL_ERROR_WANT_READ: // the operation did not complete, try again + case SSL_ERROR_WANT_READ: // the operation did not complete, try again blocked = 1; break; - case SSL_ERROR_WANT_WRITE: //the operation did not complete, error + case SSL_ERROR_WANT_WRITE: // the operation did not complete, error reportServerSSLErrorCode(rc); UDA_LOG(UDA_LOG_DEBUG, "A read operation failed!\n"); UDA_ADD_ERROR(999, "A read operation failed!"); return -1; - case SSL_ERROR_SYSCALL: //some I/O error occured - disconnect? + case SSL_ERROR_SYSCALL: // some I/O error occured - disconnect? reportServerSSLErrorCode(rc); UDA_LOG(UDA_LOG_DEBUG, "Client socket read I/O error!\n"); UDA_ADD_ERROR(999, "Client socket read I/O error!"); return -1; - default: //some other error + default: // some other error reportServerSSLErrorCode(rc); UDA_LOG(UDA_LOG_DEBUG, "Read from socket failed!\n"); UDA_ADD_ERROR(999, "Read from socket failed!"); #ifndef _WIN32 int fopts = 0; if ((rc = fcntl(g_sslSocket, F_GETFL, &fopts)) < 0 || - errno == EBADF) { // Is the socket closed? Check status flags + errno == EBADF) { // Is the socket closed? Check status flags UDA_LOG(UDA_LOG_DEBUG, "writeUdaServerSSL: Client Socket is closed! Closing server down.\n"); } #endif return -1; } - } while (SSL_pending(g_ssl) && !blocked); // data remaining in buffer or re-read attempt + } while (SSL_pending(g_ssl) && !blocked); // data remaining in buffer or re-read attempt return rc; } -#endif // SERVERBUILD \ No newline at end of file +#endif // SERVERBUILD diff --git a/source/authentication/udaServerSSL.h b/source/authentication/udaServerSSL.h index c8dc84ee..89d273b0 100644 --- a/source/authentication/udaServerSSL.h +++ b/source/authentication/udaServerSSL.h @@ -5,9 +5,11 @@ // Create the SSL context and binding to the socket // 3 UDA protocol modes: TCP without SSL/TLS, TCP and UDP both with SSL/TLS -// This set of functions is concerned only with the SSL/TLS protocol (authentication and encryption) - not with establishing socket connections or non SSL TCP transport +// This set of functions is concerned only with the SSL/TLS protocol (authentication and encryption) - not with +// establishing socket connections or non SSL TCP transport -// Server host addressed beginng with SSL:// are assumed to be using SSL authentication. The SSL:// prefix is removed to make the connection. +// Server host addressed beginng with SSL:// are assumed to be using SSL authentication. The SSL:// prefix is removed to +// make the connection. #include diff --git a/source/authentication/utils.cpp b/source/authentication/utils.cpp new file mode 100644 index 00000000..ea851ece --- /dev/null +++ b/source/authentication/utils.cpp @@ -0,0 +1,19 @@ +#include "utils.h" + +#include +#include + +std::string to_string(const ASN1_TIME* asn1_time) +{ + char work[X509_STRING_SIZE]; + + int count = 0; + BIO* b = BIO_new(BIO_s_mem()); + if (b && ASN1_TIME_print(b, asn1_time)) { + count = BIO_read(b, work, X509_STRING_SIZE - 1); + BIO_free(b); + } + work[count] = '\0'; + + return work; +} \ No newline at end of file diff --git a/source/authentication/utils.h b/source/authentication/utils.h new file mode 100644 index 00000000..2e34b76c --- /dev/null +++ b/source/authentication/utils.h @@ -0,0 +1,8 @@ +#pragma once + +#include +#include + +#define X509_STRING_SIZE 256 + +std::string to_string(const ASN1_TIME* time); \ No newline at end of file diff --git a/source/bin/CMakeLists.txt b/source/bin/CMakeLists.txt index eaed9b46..8267775f 100644 --- a/source/bin/CMakeLists.txt +++ b/source/bin/CMakeLists.txt @@ -1,3 +1,8 @@ +if( "${NO_CLI}" ) + message( WARNING "Not building uda CLI due to option NO_CLI" ) + return() +endif() + add_executable( uda_cli uda_cli.cpp ) option( UDA_CLI_BOOST_STATIC "compile commandline interface with static boost libraries" OFF ) diff --git a/source/client/CMakeLists.txt b/source/client/CMakeLists.txt index ee5b83b2..2474b1ef 100755 --- a/source/client/CMakeLists.txt +++ b/source/client/CMakeLists.txt @@ -66,6 +66,8 @@ set( HEADER_FILES udaPutAPI.h updateSelectParms.h udaClientHostList.h + legacy_accAPI.h + legacy_client.h ) include_directories( @@ -119,7 +121,7 @@ if( MINGW OR WIN32 ) include_directories( ${XDR_INCLUDE_DIR} ) set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} ws2_32 ${XDR_LIBRARIES} ) if ( MINGW ) - set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} dlfcn-win32::dl stdc++ pthread ) + set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} dlfcn-win32::dl crypt32 stdc++ pthread ) else() set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} dlfcn-win32::dl ) endif() diff --git a/source/client/accAPI.cpp b/source/client/accAPI.cpp index a00b2f4d..0d41ac0d 100755 --- a/source/client/accAPI.cpp +++ b/source/client/accAPI.cpp @@ -96,8 +96,9 @@ int getThreadId(thread_t id) } // Lock the thread and set the previous STATE -void lockIdamThread(CLIENT_FLAGS* client_flags) +void udaLockThread() { + CLIENT_FLAGS* client_flags = udaClientFlags(); static unsigned int mutex_initialised = 0; if (!mutex_initialised) { @@ -162,8 +163,9 @@ void lockIdamThread(CLIENT_FLAGS* client_flags) /** * Unlock the thread and save the current STATE */ -void unlockUdaThread(CLIENT_FLAGS* client_flags) +void udaUnlockThread() { + CLIENT_FLAGS* client_flags = udaClientFlags(); #ifdef __GNUC__ thread_t threadId = pthread_self(); #else @@ -188,9 +190,9 @@ void unlockUdaThread(CLIENT_FLAGS* client_flags) /** * Free thread resources */ -void freeIdamThread(CLIENT_FLAGS* client_flags) +void udaFreeThread() { - lockIdamThread(client_flags); + udaLockThread(); #ifdef __GNUC__ thread_t threadId = pthread_self(); #else @@ -212,13 +214,13 @@ void freeIdamThread(CLIENT_FLAGS* client_flags) initServerBlock(&(idamState[threadCount].server_block), 0); threadList[threadCount] = 0; } - unlockUdaThread(client_flags); + udaUnlockThread(); } #else -void lockIdamThread() {} -void unlockIdamThread() {} -void freeIdamThread() {} +void udaLockThread() {} +void udaUnlockThread() {} +void udaFreeThread() {} #endif // NOPTHREADS int getIdamThreadLastHandle() @@ -240,8 +242,9 @@ void acc_freeDataBlocks() putIdamThreadLastHandle(-1); } -DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags) +DATA_BLOCK* udaGetCurrentDataBlock() { + CLIENT_FLAGS* client_flags = udaClientFlags(); if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) && getIdamThreadLastHandle() >= 0) { return &data_blocks[getIdamThreadLastHandle()]; @@ -249,8 +252,9 @@ DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags) return &data_blocks.back(); } -int acc_getCurrentDataBlockIndex(CLIENT_FLAGS* client_flags) +int udaGetCurrentDataBlockIndex() { + CLIENT_FLAGS* client_flags = udaClientFlags(); if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) && getIdamThreadLastHandle() >= 0) { return getIdamThreadLastHandle(); @@ -258,8 +262,9 @@ int acc_getCurrentDataBlockIndex(CLIENT_FLAGS* client_flags) return data_blocks.size() - 1; } -int acc_growIdamDataBlocks(CLIENT_FLAGS* client_flags) +int udaGrowDataBlocks() { + CLIENT_FLAGS* client_flags = udaClientFlags(); if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) && getIdamThreadLastHandle() >= 0) { return 0; @@ -284,8 +289,9 @@ static int findNewHandleIndex() return -1; } -int acc_getIdamNewDataHandle(CLIENT_FLAGS* client_flags) +int udaGetNewDataHandle() { + CLIENT_FLAGS* client_flags = udaClientFlags(); int newHandleIndex = -1; if ((client_flags->flags & CLIENTFLAG_REUSELASTHANDLE || client_flags->flags & CLIENTFLAG_FREEREUSELASTHANDLE) && @@ -372,8 +378,9 @@ void resetIdamPrivateFlag(unsigned int flag) * @return Void. */ -void setIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag) +void udaSetClientFlag(unsigned int flag) { + CLIENT_FLAGS* client_flags = udaClientFlags(); client_flags->flags = client_flags->flags | flag; } @@ -384,8 +391,9 @@ void setIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag) * @return Void. */ -void resetIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag) +void udaResetClientFlag(unsigned int flag) { + CLIENT_FLAGS* client_flags = udaClientFlags(); client_flags->flags &= !flag; } @@ -417,9 +425,10 @@ void resetIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag) * @param property the name of the property to set true or a name value pair. * @return Void. */ -void setIdamProperty(const char* property, CLIENT_FLAGS* client_flags) +void udaSetProperty(const char* property) { // User settings for Client and Server behaviour + CLIENT_FLAGS* client_flags = udaClientFlags(); char name[56]; char* value; @@ -477,9 +486,10 @@ void setIdamProperty(const char* property, CLIENT_FLAGS* client_flags) * @param property the name of the property. * @return Void. */ -int getIdamProperty(const char* property, const CLIENT_FLAGS* client_flags) +int udaGetProperty(const char* property) { // User settings for Client and Server behaviour + CLIENT_FLAGS* client_flags = udaClientFlags(); if (property[0] == 'g') { if (STR_IEQUALS(property, "get_datadble")) return client_flags->get_datadble; @@ -513,9 +523,10 @@ int getIdamProperty(const char* property, const CLIENT_FLAGS* client_flags) * @return Void. */ -void resetIdamProperty(const char* property, CLIENT_FLAGS* client_flags) +void udaResetProperty(const char* property) { // User settings for Client and Server behaviour + CLIENT_FLAGS* client_flags = udaClientFlags(); if (property[0] == 'g') { if (STR_IEQUALS(property, "get_datadble")) client_flags->get_datadble = 0; @@ -547,9 +558,10 @@ void resetIdamProperty(const char* property, CLIENT_FLAGS* client_flags) /** * @return Void. */ -void resetIdamProperties(CLIENT_FLAGS* client_flags) +void udaResetProperties() { // Reset on Both Client and Server + CLIENT_FLAGS* client_flags = udaClientFlags(); client_flags->get_datadble = 0; client_flags->get_dimdble = 0; @@ -851,9 +863,9 @@ int getIdamDataStatus(int handle) /** \return handle. */ -int getIdamLastHandle(CLIENT_FLAGS* client_flags) +int udaGetLastHandle() { - return acc_getCurrentDataBlockIndex(client_flags); + return udaGetCurrentDataBlockIndex(); } //! returns the number of data items in the data object diff --git a/source/client/accAPI.h b/source/client/accAPI.h index 53ce83af..70cfdf39 100755 --- a/source/client/accAPI.h +++ b/source/client/accAPI.h @@ -15,13 +15,13 @@ extern "C" { #define UDA_NUM_CLIENT_THREADS 30 -LIBRARY_API DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags); +LIBRARY_API DATA_BLOCK* udaGetCurrentDataBlock(); -LIBRARY_API int acc_getCurrentDataBlockIndex(CLIENT_FLAGS* client_flags); +LIBRARY_API int udaGetCurrentDataBlockIndex(); -LIBRARY_API int acc_growIdamDataBlocks(CLIENT_FLAGS* client_flags); +LIBRARY_API int udaGrowDataBlocks(); -LIBRARY_API int acc_getIdamNewDataHandle(CLIENT_FLAGS* client_flags); +LIBRARY_API int udaGetNewDataHandle(); LIBRARY_API void acc_freeDataBlocks(); @@ -29,21 +29,22 @@ LIBRARY_API void setIdamPrivateFlag(unsigned int flag); LIBRARY_API void resetIdamPrivateFlag(unsigned int flag); -LIBRARY_API void setIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag); +LIBRARY_API void udaSetClientFlag(unsigned int flag); -LIBRARY_API void resetIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag); +LIBRARY_API void udaResetClientFlag(unsigned int flag); -LIBRARY_API void setIdamProperty(const char* property, CLIENT_FLAGS* client_flags); +LIBRARY_API void udaSetProperty(const char* property); -LIBRARY_API int getIdamProperty(const char* property, const CLIENT_FLAGS* client_flags); +LIBRARY_API int udaGetProperty(const char* property); -LIBRARY_API void resetIdamProperty(const char* property, CLIENT_FLAGS* client_flags); +LIBRARY_API void udaResetProperty(const char* property); -LIBRARY_API void resetIdamProperties(CLIENT_FLAGS* client_flags); +LIBRARY_API void udaResetProperties(); -LIBRARY_API CLIENT_BLOCK saveIdamProperties(const CLIENT_FLAGS* client_flags); +LIBRARY_API CLIENT_BLOCK udaSaveProperties(); -LIBRARY_API void restoreIdamProperties(CLIENT_BLOCK cb, CLIENT_FLAGS* client_flags); +LIBRARY_API void udaRestoreProperties(CLIENT_BLOCK cb); +// LIBRARY_API void restoreIdamProperties(CLIENT_BLOCK cb, CLIENT_FLAGS* client_flags); LIBRARY_API CLIENT_BLOCK* getIdamProperties(int handle); @@ -83,7 +84,7 @@ LIBRARY_API int getIdamSignalStatus(int handle); LIBRARY_API int getIdamDataStatus(int handle); -LIBRARY_API int getIdamLastHandle(CLIENT_FLAGS* client_flags); +LIBRARY_API int udaGetLastHandle(); LIBRARY_API int getIdamDataNum(int handle); @@ -245,11 +246,11 @@ LIBRARY_API int getIdamDataCheckSum(int handle); LIBRARY_API int getIdamDimDataCheckSum(int handle, int ndim); -LIBRARY_API void lockIdamThread(CLIENT_FLAGS* client_flags); +LIBRARY_API void udaLockThread(); -LIBRARY_API void unlockUdaThread(CLIENT_FLAGS* client_flags); +LIBRARY_API void udaUnlockThread(); -LIBRARY_API void freeIdamThread(CLIENT_FLAGS* client_flags); +LIBRARY_API void udaFreeThread(); LIBRARY_API int getIdamThreadLastHandle(); diff --git a/source/client/clientXDRStream.cpp b/source/client/clientXDRStream.cpp index bf26fbcf..823a0e3c 100755 --- a/source/client/clientXDRStream.cpp +++ b/source/client/clientXDRStream.cpp @@ -25,7 +25,7 @@ std::pair clientCreateXDRStream() #if defined(SSLAUTHENTICATION) && !defined(FATCLIENT) if (getUdaClientSSLDisabled()) { -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr, reinterpret_cast(clientReadin), reinterpret_cast(clientWriteout)); @@ -43,7 +43,7 @@ std::pair clientCreateXDRStream() reinterpret_cast(clientWriteout)); #endif } else { -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr, reinterpret_cast(readUdaClientSSL), reinterpret_cast(writeUdaClientSSL)); @@ -63,7 +63,7 @@ std::pair clientCreateXDRStream() } #else -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, nullptr, reinterpret_cast(clientReadin), reinterpret_cast(clientWriteout)); diff --git a/source/client/connection.cpp b/source/client/connection.cpp index bacb9ac9..302d84ab 100755 --- a/source/client/connection.cpp +++ b/source/client/connection.cpp @@ -4,6 +4,9 @@ #ifdef _WIN32 # include # include // must be included before connection.h to avoid macro redefinition in rpc/types.h +# ifdef _MSC_VER +# define strncasecmp _strnicmp +# endif #endif #include "connection.h" diff --git a/source/client/connection.h b/source/client/connection.h index f8733150..af40d174 100755 --- a/source/client/connection.h +++ b/source/client/connection.h @@ -17,7 +17,7 @@ int connectionOpen(); int reconnect(ENVIRONMENT* environment, XDR** client_input, XDR** client_output, time_t* tv_server_start, int* user_timeout); int createConnection(XDR* client_input, XDR* client_output, time_t *tv_server_start, int user_timeout, int client_version); -void closeAllConnections(); +LIBRARY_API void closeAllConnections(); void closeConnection(ClosedownType type); int clientWriteout(void* iohandle, char* buf, int count); diff --git a/source/client/legacy_accAPI.h b/source/client/legacy_accAPI.h new file mode 100644 index 00000000..0e285133 --- /dev/null +++ b/source/client/legacy_accAPI.h @@ -0,0 +1,185 @@ +#ifndef UDA_LEGACY_ACCAPI_H +#define UDA_LEGACY_ACCAPI_H + +#include +#include "udaClient.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef UDA_CLIENT_FLAGS_API +// #warning "Using legacy API names with redundant \"client_flags\" arguments, these will be deprecated in future" + + LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags) + { + return udaGetCurrentDataBlock(); + } + + LIBRARY_API inline int acc_getCurrentDataBlockIndex(CLIENT_FLAGS* client_flags) + { + return udaGetCurrentDataBlockIndex(); + } + + LIBRARY_API inline int acc_growIdamDataBlocks(CLIENT_FLAGS* client_flags) + { + return udaGrowDataBlocks(); + } + + LIBRARY_API inline int acc_getIdamNewDataHandle(CLIENT_FLAGS* client_flags) + { + return udaGetNewDataHandle(); + } + + LIBRARY_API inline void setIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag) + { + udaSetClientFlag(flag); + } + + LIBRARY_API inline void resetIdamClientFlag(CLIENT_FLAGS* client_flags, unsigned int flag) + { + udaResetClientFlag(flag); + } + + LIBRARY_API inline void setIdamProperty(const char* property, CLIENT_FLAGS* client_flags) + { + udaSetProperty(property); + } + + LIBRARY_API inline int getIdamProperty(const char* property, const CLIENT_FLAGS* client_flags) + { + return udaGetProperty(property); + } + + LIBRARY_API inline void resetIdamProperty(const char* property, CLIENT_FLAGS* client_flags) + { + udaResetProperty(property); + } + + LIBRARY_API inline void resetIdamProperties(CLIENT_FLAGS* client_flags) + { + udaResetProperties(); + } + + CLIENT_BLOCK saveIdamProperties(const CLIENT_FLAGS* client_flags) + { + return udaSaveProperties(); + } + + LIBRARY_API inline void restoreIdamProperties(CLIENT_BLOCK cb, CLIENT_FLAGS* client_flags) + { + udaRestoreProperties(cb); + } + + LIBRARY_API inline int getIdamLastHandle(CLIENT_FLAGS* client_flags) + { + return udaGetLastHandle(); + } + + LIBRARY_API inline void lockIdamThread(CLIENT_FLAGS* client_flags) + { + udaLockThread(); + } + + LIBRARY_API inline void unlockUdaThread(CLIENT_FLAGS* client_flags) + { + udaUnlockThread(); + } + + LIBRARY_API inline void freeIdamThread(CLIENT_FLAGS* client_flags) + { + udaFreeThread(); + } + +#else + + LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock() + { + return udaGetCurrentDataBlock(); + } + + LIBRARY_API inline int acc_getCurrentDataBlockIndex() + { + return udaGetCurrentDataBlockIndex(); + } + + LIBRARY_API inline int acc_growIdamDataBlocks() + { + return udaGrowDataBlocks(); + } + + LIBRARY_API inline int acc_getIdamNewDataHandle() + { + return udaGetNewDataHandle(); + } + + LIBRARY_API inline void setIdamClientFlag(unsigned int flag) + { + udaSetClientFlag(flag); + } + + LIBRARY_API inline void resetIdamClientFlag(unsigned int flag) + { + udaResetClientFlag(flag); + } + + LIBRARY_API inline void setIdamProperty(const char* property) + { + udaSetProperty(property); + } + + LIBRARY_API inline int getIdamProperty(const char* property) + { + return udaGetProperty(property); + } + + LIBRARY_API inline void resetIdamProperty(const char* property) + { + udaResetProperty(property); + } + + LIBRARY_API inline void resetIdamProperties() + { + udaResetProperties(); + } + + LIBRARY_API inline CLIENT_BLOCK saveIdamProperties() + { + return udaSaveProperties(); + } + + LIBRARY_API inline void restoreIdamProperties(CLIENT_BLOCK cb) + { + udaRestoreProperties(cb); + } + + LIBRARY_API inline int getIdamLastHandle() + { + return udaGetLastHandle(); + } + + LIBRARY_API inline void lockIdamThread() + { + udaLockThread(); + } + + LIBRARY_API inline void unlockUdaThread() + { + udaUnlockThread(); + } + + LIBRARY_API inline void freeIdamThread() + { + udaFreeThread(); + } + +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif // UDA_LEGACY_ACCAPI_H diff --git a/source/client/legacy_client.h b/source/client/legacy_client.h new file mode 100644 index 00000000..b91280e7 --- /dev/null +++ b/source/client/legacy_client.h @@ -0,0 +1,26 @@ +#ifndef UDA_LEGACY_CLIENT_H +#define UDA_LEGACY_CLIENT_H + +#include +#include "udaClient.h" + +#ifdef __cplusplus +extern "C" { +#endif + +LIBRARY_API inline void idamFree(int handle) +{ + udaFree(handle); +} + +LIBRARY_API inline void idamFreeAll() +{ + udaFreeAll(); +} + +#ifdef __cplusplus +} +#endif + + +#endif diff --git a/source/client/udaClient.cpp b/source/client/udaClient.cpp index 5033e375..8169b0ce 100755 --- a/source/client/udaClient.cpp +++ b/source/client/udaClient.cpp @@ -125,7 +125,7 @@ int check_file_cache(const REQUEST_DATA* request_data, DATA_BLOCK** p_data_block if (data != nullptr) { // Success - int data_block_idx = acc_getIdamNewDataHandle(client_flags); + int data_block_idx = udaGetNewDataHandle(); if (data_block_idx < 0) { // Error return -data_block_idx; @@ -163,7 +163,7 @@ int check_mem_cache(uda::cache::UdaCache* cache, REQUEST_DATA* request_data, DAT if (data != nullptr) { // Success - int data_block_idx = acc_getIdamNewDataHandle(client_flags); + int data_block_idx = udaGetNewDataHandle(); if (data_block_idx < 0) { // Error return -data_block_idx; @@ -544,8 +544,10 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) # if defined(SSLAUTHENTICATION) && !defined(FATCLIENT) // Create the SSL binding and context, and verify the server certificate - if ((err = startUdaClientSSL()) != 0) { - break; + if (initServer) { + if ((err = startUdaClientSSL()) != 0) { + break; + } } # endif @@ -584,11 +586,15 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) updateClientBlock(&client_block, client_flags, *private_flags); // Allows User to Change Properties at run-time // Operating System Name - +#ifndef _MSC_VER if ((env = getenv("OSTYPE")) != nullptr) { strcpy(client_block.OSName, env); } - +#else + if ((env = getenv("OS")) != nullptr) { + strcpy(client_block.OSName, env); + } +#endif // Client's study DOI if ((env = getenv("UDA_CLIENT_DOI")) != nullptr) { @@ -937,7 +943,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) //------------------------------------------------------------------------------ // Allocate memory for the Data Block Structure // Re-use existing stale Data Blocks - int data_block_idx = acc_getIdamNewDataHandle(client_flags); + int data_block_idx = udaGetNewDataHandle(); if (data_block_idx < 0) { // Error data_block_indices[i] = -data_block_idx; @@ -1015,7 +1021,7 @@ int idamClient(REQUEST_BLOCK* request_block, int* indices) for (int i = 0; i < data_block_list0.count; ++i) { DATA_BLOCK* data_block0 = &data_block_list0.data[i]; - int data_block_idx = acc_getIdamNewDataHandle(client_flags); + int data_block_idx = udaGetNewDataHandle(); DATA_BLOCK* data_block = getIdamDataBlock(data_block_idx); // data blocks may have been realloc'ed copyDataBlock(data_block, data_block0); @@ -1433,9 +1439,7 @@ void udaFreeAll() uda::cache::free_cache(); #endif - CLIENT_FLAGS* client_flags = udaClientFlags(); - - for (int i = 0; i < acc_getCurrentDataBlockIndex(client_flags); ++i) { + for (int i = 0; i < udaGetCurrentDataBlockIndex(); ++i) { #ifndef FATCLIENT freeDataBlock(getIdamDataBlock(i)); #else @@ -1501,9 +1505,11 @@ void putIdamThreadClientBlock(CLIENT_BLOCK* str) client_block = *str; } -CLIENT_BLOCK saveIdamProperties(const CLIENT_FLAGS* client_flags) -{ // save current state of properties for future rollback +CLIENT_BLOCK udaSaveProperties() +{ + // save current state of properties for future rollback CLIENT_BLOCK cb = client_block; // Copy of Global Structure (maybe not initialised! i.e. idam API not called) + CLIENT_FLAGS* client_flags = udaClientFlags(); cb.get_datadble = client_flags->get_datadble; // Copy individual properties only cb.get_dimdble = client_flags->get_dimdble; cb.get_timedble = client_flags->get_timedble; @@ -1521,8 +1527,9 @@ CLIENT_BLOCK saveIdamProperties(const CLIENT_FLAGS* client_flags) return cb; } -void restoreIdamProperties(CLIENT_BLOCK cb, CLIENT_FLAGS* client_flags) -{ // Restore Properties to a prior saved state +void udaRestoreProperties(CLIENT_BLOCK cb) +{ + // Restore Properties to a prior saved state client_block.get_datadble = cb.get_datadble; // Overwrite Individual Global Structure Components client_block.get_dimdble = cb.get_dimdble; client_block.get_timedble = cb.get_timedble; @@ -1536,6 +1543,7 @@ void restoreIdamProperties(CLIENT_BLOCK cb, CLIENT_FLAGS* client_flags) client_block.clientFlags = cb.clientFlags; client_block.altRank = cb.altRank; + CLIENT_FLAGS* client_flags = udaClientFlags(); client_flags->get_datadble = client_block.get_datadble; client_flags->get_dimdble = client_block.get_dimdble; client_flags->get_timedble = client_block.get_timedble; diff --git a/source/client/udaGetAPI.cpp b/source/client/udaGetAPI.cpp index 3c1fd02d..fc43ed4e 100755 --- a/source/client/udaGetAPI.cpp +++ b/source/client/udaGetAPI.cpp @@ -148,7 +148,7 @@ int idamGetAPIWithHost(const char* data_object, const char* data_source, const c CLIENT_FLAGS* client_flags = udaClientFlags(); // Lock the thread - lockIdamThread(client_flags); + udaLockThread(); if (host != nullptr) { putIdamServerHost(host); @@ -176,7 +176,7 @@ int idamGetAPIWithHost(const char* data_object, const char* data_source, const c static bool reopen_logs = true; if (udaStartup(0, client_flags, &reopen_logs) != 0) { - unlockUdaThread(client_flags); + udaUnlockThread(); return PROBLEM_OPENING_LOGS; } @@ -217,7 +217,7 @@ int idamGetAPIWithHost(const char* data_object, const char* data_source, const c UDA_LOG(UDA_LOG_ERROR, "Error identifying the Data Source [%s]\n", data_source); addIdamError(UDA_CODE_ERROR_TYPE, __func__, 999, "Error identifying the Data Source"); } - unlockUdaThread(client_flags); + udaUnlockThread(); return -err; } @@ -227,7 +227,7 @@ int idamGetAPIWithHost(const char* data_object, const char* data_source, const c // Fetch Data #ifdef TESTSERVERCLIENT - unlockIdamThread(); + udaUnlockThread(); return -1; #endif @@ -246,7 +246,7 @@ int idamGetAPIWithHost(const char* data_object, const char* data_source, const c freeClientRequestBlock(&request_block); // Unlock the thread - unlockUdaThread(client_flags); + udaUnlockThread(); return handle; } @@ -260,7 +260,7 @@ int idamGetBatchAPIWithHost(const char** signals, const char** sources, int coun CLIENT_FLAGS* client_flags = udaClientFlags(); // Lock the thread - lockIdamThread(client_flags); + udaLockThread(); if (host != nullptr) { putIdamServerHost(host); @@ -287,7 +287,7 @@ int idamGetBatchAPIWithHost(const char** signals, const char** sources, int coun static bool reopen_logs = true; if (udaStartup(0, client_flags, &reopen_logs) != 0) { - unlockUdaThread(client_flags); + udaUnlockThread(); return PROBLEM_OPENING_LOGS; } @@ -328,7 +328,7 @@ int idamGetBatchAPIWithHost(const char** signals, const char** sources, int coun if (udaNumErrors() == 0) { addIdamError(UDA_CODE_ERROR_TYPE, __func__, 999, "Error identifying the Data Source"); } - unlockUdaThread(client_flags); + udaUnlockThread(); return -err; } @@ -339,7 +339,7 @@ int idamGetBatchAPIWithHost(const char** signals, const char** sources, int coun // Fetch Data #ifdef TESTSERVERCLIENT - unlockIdamThread(); + udaUnlockThread(); return -1; #endif @@ -353,6 +353,6 @@ int idamGetBatchAPIWithHost(const char** signals, const char** sources, int coun #endif // Unlock the thread - unlockUdaThread(client_flags); + udaUnlockThread(); return err; } diff --git a/source/client2/CMakeLists.txt b/source/client2/CMakeLists.txt index b1a59912..2bcadb38 100755 --- a/source/client2/CMakeLists.txt +++ b/source/client2/CMakeLists.txt @@ -7,8 +7,11 @@ find_package( fmt REQUIRED ) if( WIN32 OR MINGW ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) + find_package( dlfcn-win32 CONFIG REQUIRED ) + if( MINGW ) + find_package( ZLIB REQUIRED ) + find_package( Iconv REQUIRED ) + find_package( liblzma CONFIG REQUIRED ) endif() else() find_package( TIRPC QUIET ) @@ -17,14 +20,15 @@ else() endif() endif() +add_definitions( -DNOTGENERICENABLED ) +add_definitions( -DNO_GSL_LIB ) + if( LIBMEMCACHED_FOUND AND NOT NO_MEMCACHE ) set( EXTRA_LD_LIBRARY_PATHS "${EXTRA_LD_LIBRARY_PATHS};${LIBMEMCACHED_LIB_DIR}" CACHE INTERNAL "" ) else() add_definitions( -DNOLIBMEMCACHED ) endif() -add_definitions( -DNO_GSL_LIB ) - ######################################################################################################################## # Sources @@ -104,11 +108,11 @@ if( BUILD_SHARED_LIBS ) add_library( client2-shared SHARED ${CLIENT_OBJS} ) endif() -set( CLIENT_LINK_LIBS ${OPENSSL_LIBRARIES} ${CACHE_LIBRARIES} fmt::fmt ) +set( CLIENT_LINK_LIBS ${OPENSSL_LIBRARIES} ${CACHE_LIBRARIES} ${LIBXML2_LIBRARIES} fmt::fmt ) if( NOT CLIENT_ONLY ) set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} ${LIBXML2_LIBRARIES} ) if( MINGW ) - set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} ) + set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} Iconv::Iconv liblzma::liblzma ZLIB::ZLIB crypt32 ) endif() endif() @@ -116,7 +120,7 @@ if( MINGW OR WIN32 ) include_directories( ${XDR_INCLUDE_DIR} ) set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} ws2_32 ${XDR_LIBRARIES} ) if ( MINGW ) - set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} dl stdc++ ) + set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} dlfcn-win32::dl crypt32 stdc++ pthread ) else() set( CLIENT_LINK_LIBS ${CLIENT_LINK_LIBS} dlfcn-win32::dl ) endif() diff --git a/source/client2/client.cpp b/source/client2/client.cpp index c78eb4ce..88345f45 100644 --- a/source/client2/client.cpp +++ b/source/client2/client.cpp @@ -7,6 +7,10 @@ #include "accAPI.h" #include "exceptions.hpp" +#ifdef _WIN32 +# include "windows_defines.hpp" +#endif + #include #include #include @@ -583,7 +587,7 @@ int uda::client::Client::get(std::string_view data_signal, std::string_view data if (make_request_block(&environment_, &signal_ptr, &source_ptr, 1, &request_block) != 0) { if (udaNumErrors() == 0) { - UDA_LOG(UDA_LOG_ERROR, "Error identifying the Data Source [%s]\n", data_source); + UDA_LOG(UDA_LOG_ERROR, "Error identifying the Data Source [%s]\n", data_source.data()); addIdamError(UDA_CODE_ERROR_TYPE, __func__, 999, "Error identifying the Data Source"); } throw uda::exceptions::ClientError("Error identifying the Data Source [%1%]", data_source); diff --git a/source/client2/client_xdr_stream.cpp b/source/client2/client_xdr_stream.cpp index c59fa070..c98d14f8 100755 --- a/source/client2/client_xdr_stream.cpp +++ b/source/client2/client_xdr_stream.cpp @@ -24,7 +24,7 @@ std::pair uda::client::createXDRStream(IoData* io_data) #if defined(SSLAUTHENTICATION) && !defined(FATCLIENT) if (getUdaClientSSLDisabled()) { -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, io_data, reinterpret_cast(uda::client::readin), reinterpret_cast(uda::client::writeout)); @@ -42,7 +42,7 @@ std::pair uda::client::createXDRStream(IoData* io_data) reinterpret_cast(uda::client::writeout)); #endif } else { -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, io_data, reinterpret_cast(readUdaClientSSL), reinterpret_cast(writeUdaClientSSL)); @@ -62,7 +62,7 @@ std::pair uda::client::createXDRStream(IoData* io_data) } #else -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create(&client_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, io_data, reinterpret_cast(uda::client::readin), reinterpret_cast(uda::client::writeout)); diff --git a/source/client2/closedown.cpp b/source/client2/closedown.cpp index b8d9faea..48b60990 100755 --- a/source/client2/closedown.cpp +++ b/source/client2/closedown.cpp @@ -41,7 +41,7 @@ int uda::client::closedown(ClosedownType type, Connection* connection, XDR* clie if (connection != nullptr) { - connection->close(type); + connection->close_down(type); } *env_host = true; // Initialise at Startup diff --git a/source/client2/connection.cpp b/source/client2/connection.cpp index 82cad6b3..bac52e02 100755 --- a/source/client2/connection.cpp +++ b/source/client2/connection.cpp @@ -4,6 +4,7 @@ #ifdef _WIN32 # include # include // must be included before connection.h to avoid macro redefinition in rpc/types.h +# include "windows_defines.hpp" #endif #include "connection.hpp" @@ -15,7 +16,7 @@ #include #include -#if defined(__GNUC__) && !defined(MINGW) +#if defined(__GNUC__) && !defined(__MINGW32__) # ifndef _WIN32 # include # include @@ -315,7 +316,7 @@ int uda::client::Connection::create(XDR* client_input, XDR* client_output, const #ifndef _WIN32 ::close(client_socket); #else - ::closesocket(clientSocket); + ::closesocket(client_socket); #endif } client_socket = -1; @@ -362,7 +363,7 @@ int uda::client::Connection::create(XDR* client_input, XDR* client_output, const #ifndef _WIN32 ::close(client_socket); #else - ::closesocket(clientSocket); + ::closesocket(client_socket); #endif client_socket = -1; hostname = environment.server_host2; @@ -426,7 +427,7 @@ int uda::client::Connection::create(XDR* client_input, XDR* client_output, const #ifndef _WIN32 ::close(client_socket); #else - ::closesocket(clientSocket); + ::closesocket(client_socket); #endif } client_socket = -1; @@ -462,7 +463,7 @@ int uda::client::Connection::create(XDR* client_input, XDR* client_output, const ::close(client_socket); } #else - closesocket(clientSocket); + closesocket(client_socket); #endif client_socket = -1; if (result) freeaddrinfo(result); @@ -542,7 +543,7 @@ void uda::client::Connection::close_socket(int fh) } } -void uda::client::Connection::close(ClosedownType type) +void uda::client::Connection::close_down(ClosedownType type) { if (client_socket >= 0 && type != ClosedownType::CLOSE_ALL) { close_socket(client_socket); diff --git a/source/client2/connection.hpp b/source/client2/connection.hpp index a09c1950..a253299d 100755 --- a/source/client2/connection.hpp +++ b/source/client2/connection.hpp @@ -29,7 +29,7 @@ class Connection { int open(); int reconnect(XDR** client_input, XDR** client_output, time_t* tv_server_start, int* user_timeout); int create(XDR* client_input, XDR* client_output, const HostList& host_list); - void close(ClosedownType type); + void close_down(ClosedownType type); IoData io_data() { return IoData{ &client_socket }; } diff --git a/source/client2/windows_defines.hpp b/source/client2/windows_defines.hpp new file mode 100644 index 00000000..354f85ca --- /dev/null +++ b/source/client2/windows_defines.hpp @@ -0,0 +1,6 @@ +#pragma once + +#if _MSC_VER && !__INTEL_COMPILER +# define strncasecmp _strnicmp +#endif + diff --git a/source/clientserver/compressDim.cpp b/source/clientserver/compressDim.cpp index 2eefbd87..2297cdd0 100755 --- a/source/clientserver/compressDim.cpp +++ b/source/clientserver/compressDim.cpp @@ -35,12 +35,19 @@ int compress(DIMS* ddim) return 1; } T prev_diff = dim_data[1] - dim_data[0]; - T mean_diff = (dim_data[ndata - 1] - dim_data[0]) / (ndata - 1); + double mean_diff = (dim_data[ndata - 1] - dim_data[0]) / (ndata - 1); T precision = Precision::precision; bool constant = true; for (int i = 1; i < ndata; i++) { T diff = dim_data[i] - dim_data[i - 1]; + // avoid trying to compress data where delta is very small + if (diff < 5 * precision) + { + constant = false; + break; + } + T abs_diff = diff < prev_diff ? (prev_diff - diff) : (diff - prev_diff); if (abs_diff > precision) { constant = false; diff --git a/source/clientserver/memstream_win.cpp b/source/clientserver/memstream_win.cpp index a23e3a49..90641ac0 100644 --- a/source/clientserver/memstream_win.cpp +++ b/source/clientserver/memstream_win.cpp @@ -36,4 +36,4 @@ FILE *open_memstream(char **cp, size_t *lenp) { } return stream; -} \ No newline at end of file +} diff --git a/source/clientserver/protocol.h b/source/clientserver/protocol.h index 47950cb6..eb2f8e98 100755 --- a/source/clientserver/protocol.h +++ b/source/clientserver/protocol.h @@ -54,6 +54,10 @@ #define UDA_PROTOCOL_LIMITER 113 #define UDA_PROTOCOL_OPAQUE_STOP 200 +#if _MSC_VER && !__INTEL_COMPILER + int mkstemp(char* template_str); +#endif + struct IoData; //--------------------------------------------------------------------------------------------------- diff --git a/source/clientserver/protocol2.cpp b/source/clientserver/protocol2.cpp index e1b9dbfc..bfd6d5dc 100755 --- a/source/clientserver/protocol2.cpp +++ b/source/clientserver/protocol2.cpp @@ -734,7 +734,11 @@ static int handle_data_block(XDR* xdrs, int direction, const void* str, int prot break; } - if (data_block->data_n == 0) break; // No Data to Receive! + if (data_block->data_n == 0) { + data_block->data_type = UDA_TYPE_UNKNOWN; + data_block->rank = 0; + break; // No Data to Receive! + } if ((err = allocData(data_block)) != 0) break; // Allocate Heap Memory diff --git a/source/clientserver/protocolXML.cpp b/source/clientserver/protocolXML.cpp index 937bc98f..21894a22 100755 --- a/source/clientserver/protocolXML.cpp +++ b/source/clientserver/protocolXML.cpp @@ -75,6 +75,15 @@ # include "xdrHData.h" #endif +#if _MSC_VER && !__INTEL_COMPILER + #include + int mkstemp(char* template_str) + { + auto len = strlen(template_str) + 1; + return _mktemp_s(template_str, len); + } +#endif + int protocolXML(XDR* xdrs, int protocol_id, int direction, int* token, LOGMALLOCLIST* logmalloclist, USERDEFINEDTYPELIST* userdefinedtypelist, void* str, int protocolVersion, LOGSTRUCTLIST* log_struct_list, IoData* io_data, unsigned int private_flags, int malloc_source, diff --git a/source/clientserver/udaDefines.h b/source/clientserver/udaDefines.h index ffcf615e..c415229f 100755 --- a/source/clientserver/udaDefines.h +++ b/source/clientserver/udaDefines.h @@ -128,7 +128,7 @@ extern "C" { #if defined(_WIN32) # if !defined(__MINGW32__) -LIBRARY_API int gettimeofday(struct timeval* tp, struct timezone* tzp); + LIBRARY_API int gettimeofday(struct timeval* tp, struct timezone* tzp); # endif #endif diff --git a/source/clientserver/xdrlib.cpp b/source/clientserver/xdrlib.cpp index c233464d..67ef0b5a 100755 --- a/source/clientserver/xdrlib.cpp +++ b/source/clientserver/xdrlib.cpp @@ -1514,15 +1514,3 @@ bool_t xdr_signal_desc(XDR* xdrs, SIGNAL_DESC* str) && WrapXDRString(xdrs, (char*)str->xml, MAXMETA) && WrapXDRString(xdrs, (char*)str->xml_creation, DATE_LENGTH); } - -//bool_t xdr_hdc_buffer_length(XDR* xdrs, uint64_t* n) -//{ -// int rc = xdr_u_longlong_t(xdrs, n); -// return rc; -//} - -//bool_t xdr_hdc_buffer(XDR* xdrs, char* buffer, uint64_t n) -//{ -// int rc = xdr_vector(xdrs, buffer, n, sizeof(char), (xdrproc_t)xdr_char); -// return rc; -//} \ No newline at end of file diff --git a/source/clientserver/xdrlib.h b/source/clientserver/xdrlib.h index a2e3b6d5..59e71c69 100755 --- a/source/clientserver/xdrlib.h +++ b/source/clientserver/xdrlib.h @@ -73,9 +73,5 @@ bool_t xdr_signal(XDR* xdrs, SIGNAL* str); // From SIGNAL_DESC Table bool_t xdr_signal_desc(XDR* xdrs, SIGNAL_DESC* str); -//bool_t xdr_hdc_buffer_length(XDR* xdrs, uint64_t* n); - -//bool_t xdr_hdc_buffer(XDR* xdrs, char* buffer, uint64_t n); - #endif // UDA_CLIENTSERVER_XDRLIB_H diff --git a/source/etc/machine.d/github-ci-ssl.cfg b/source/etc/machine.d/github-ci-ssl.cfg new file mode 100644 index 00000000..b21f4307 --- /dev/null +++ b/source/etc/machine.d/github-ci-ssl.cfg @@ -0,0 +1,4 @@ +export UDA_SERVER_SSL_KEY=/usr/local/etc/certs/server.key +export UDA_SERVER_CA_SSL_CERT=/usr/local/etc/certs/rootCA.crt +export UDA_SERVER_SSL_CERT=/usr/local/etc/certs/server.crt +export UDA_SERVER_SSL_AUTHENTICATE=1 \ No newline at end of file diff --git a/source/etc/machine.d/mast.l.cfg b/source/etc/machine.d/mast.l.cfg index 9882e812..7905d3b3 100644 --- a/source/etc/machine.d/mast.l.cfg +++ b/source/etc/machine.d/mast.l.cfg @@ -12,6 +12,8 @@ export UDA_PORT2=${UDA_PORT} DATA_ARCHIVE=/net/raidsrvr/data +export UDA_BYTES_PLUGIN_ALLOWED_PATHS="/net/raidsrvr/data;/common/uda-scratch;/projects/physics/omfit" + export MAST_DATA=${DATA_ARCHIVE}/MAST_Data export MAST_IMAGES=${DATA_ARCHIVE}/MAST_IMAGES export MAST_NEW=${DATA_ARCHIVE}/MAST_NEW diff --git a/source/etc/uda-cpp.pc.in b/source/etc/uda-cpp.pc.in index 1bc14774..744bf6a3 100755 --- a/source/etc/uda-cpp.pc.in +++ b/source/etc/uda-cpp.pc.in @@ -8,6 +8,6 @@ Name: UDA Description: The Universal Data Access library URL: https://ukaea.github.io/UDA/ Version: @PROJECT_VERSION@ -Cflags: -std=c++11 -I${includedir} -I${includedir}/c++ @PKGCONFIG_INCLUDES@ +Cflags: -std=c++17 -I${includedir} -I${includedir}/c++ @PKGCONFIG_INCLUDES@ Libs: -L${libdir} -luda_cpp @PKGCONFIG_LIBRARIES@ Requires: @PKGCONFIG_REQUIRES@ diff --git a/source/etc/uda-fat-cpp.pc.in b/source/etc/uda-fat-cpp.pc.in index 24012f85..2ac8a375 100755 --- a/source/etc/uda-fat-cpp.pc.in +++ b/source/etc/uda-fat-cpp.pc.in @@ -8,6 +8,6 @@ Name: UDA Description: The Universal Data Access library URL: https://ukaea.github.io/UDA/ Version: @PROJECT_VERSION@ -Cflags: -DFATCLIENT -std=c++11 -I${includedir} -I${includedir}/c++ @PKGCONFIG_INCLUDES@ +Cflags: -DFATCLIENT -std=c++17 -I${includedir} -I${includedir}/c++ @PKGCONFIG_INCLUDES@ Libs: -L${libdir} -lfatuda_cpp @PKGCONFIG_LIBRARIES@ Requires: @PKGCONFIG_REQUIRES@ diff --git a/source/etc/uda.socket.in b/source/etc/uda.socket.in new file mode 100644 index 00000000..a574c368 --- /dev/null +++ b/source/etc/uda.socket.in @@ -0,0 +1,13 @@ +[Unit] +Description=@USER@-uda Listener + +[Socket] +ListenStream=0.0.0.0:@UDA_SERVER_PORT@ +Accept=yes +NoDelay=true +KeepAlive=true +MaxConnections=100 +MaxConnectionsPerSource=30 + +[Install] +WantedBy=sockets.target \ No newline at end of file diff --git a/source/etc/uda@.service.in b/source/etc/uda@.service.in new file mode 100644 index 00000000..f9492d78 --- /dev/null +++ b/source/etc/uda@.service.in @@ -0,0 +1,16 @@ +[Unit] +Description=@USER@-uda service + +[Service] +ExecStart=@CMAKE_INSTALL_PREFIX@/etc/udaserver.sh +Type=forking +User=@USER@ +#Group=yes +UMask=002 +StandardInput=socket +LimitNOFILE=30 + +StandardOutput=file:@CMAKE_INSTALL_PREFIX@/etc/uda.logfile +StandardError=inherit +SuccessExitStatus=0 +LogLevelMax=info \ No newline at end of file diff --git a/source/etc/udaserver.cfg.in b/source/etc/udaserver.cfg.in index 5ed0a31c..1c7bece1 100755 --- a/source/etc/udaserver.cfg.in +++ b/source/etc/udaserver.cfg.in @@ -9,7 +9,7 @@ export UDA_ROOT=@CMAKE_INSTALL_PREFIX@ export UDA_LOG=$UDA_ROOT/etc export UDA_LOG_MODE=a -export UDA_LOG_LEVEL=DEBUG # Options: INFO, DEBUG, WARN, ERROR, ACCESS +export UDA_LOG_LEVEL=ERROR # Options: INFO, DEBUG, WARN, ERROR, ACCESS export UDA_DEBUG_APPEND=a #------------------------------------------------------------------------------------------------------ @@ -39,4 +39,4 @@ export UDA_PLUGIN_DEBUG_SINGLEFILE=1 export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:$UDA_ROOT/lib:$UDA_ROOT/lib/plugins" export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:@EXTRA_LD_LIBRARY_PATHS@" -export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH \ No newline at end of file +export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH diff --git a/source/plugins/bytes/CMakeLists.txt b/source/plugins/bytes/CMakeLists.txt index 49045947..ac1e9de0 100644 --- a/source/plugins/bytes/CMakeLists.txt +++ b/source/plugins/bytes/CMakeLists.txt @@ -1,6 +1,7 @@ ######################################################################################################################## # Dependencies find_package( LibXml2 QUIET ) +find_package( Boost COMPONENTS ) if( NOT LIBXML2_FOUND ) message( WARNING "Libxml2 not found - skipping template plugin" ) @@ -9,6 +10,13 @@ endif() include( plugins ) +set ( STDFS_VAR "" ) +if( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 9.1 ) + set ( STDFS_VAR "stdc++fs" ) +elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 9.0 ) + set ( STDFS_VAR "c++fs" ) +endif() + uda_plugin( NAME BYTES ENTRY_FUNC bytesPlugin @@ -20,4 +28,6 @@ uda_plugin( ${LIBXML2_INCLUDE_DIR} EXTRA_LINK_LIBS ${LIBXML2_LIBRARIES} + Boost::boost + ${STDFS_VAR} ) diff --git a/source/plugins/bytes/bytesPlugin.cpp b/source/plugins/bytes/bytesPlugin.cpp index fb6950b7..b6c2b232 100644 --- a/source/plugins/bytes/bytesPlugin.cpp +++ b/source/plugins/bytes/bytesPlugin.cpp @@ -5,6 +5,21 @@ #include "readBytesNonOptimally.h" +#if defined __has_include +# if !__has_include() +#include +namespace filesystem = std::experimental::filesystem; +# else +#include +namespace filesystem = std::filesystem; +# endif +#else +#include +namespace filesystem = std::filesystem; +#endif + +#include + static int do_help(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); static int do_version(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); @@ -143,6 +158,37 @@ int do_maxinterfaceversion(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) //---------------------------------------------------------------------------------------- // Add functionality here .... + +// Check if path starts with pre-approved file path +// Raises Plugin Error if not +int check_allowed_path(const char* expandedPath) { + std::string full_path; + try { + full_path = filesystem::canonical(expandedPath).string(); + } catch (filesystem::filesystem_error& e) { + UDA_LOG(UDA_LOG_DEBUG, "Filepath [%s] not found! Error: %s\n", full_path.c_str(), e.what()); + RAISE_PLUGIN_ERROR("Provided File Path Not Found!\n"); + } + char* env_str = std::getenv("UDA_BYTES_PLUGIN_ALLOWED_PATHS"); + std::vector allowed_paths; + if (env_str) { // gotta check if environment variable exists before using it + boost::split(allowed_paths, std::getenv("UDA_BYTES_PLUGIN_ALLOWED_PATHS"), boost::is_any_of(";")); + } + bool good_path = false; + for (std::string allowed_path : allowed_paths) { + if (full_path.rfind(allowed_path.c_str(), 0) != std::string::npos) { + good_path = true; + break; + } + } + if (!good_path) { + UDA_LOG(UDA_LOG_DEBUG, "Bad Path Provided %s\n", expandedPath); + RAISE_PLUGIN_ERROR("Bad File Path Provided\n"); + } + return 0; +} + + int do_read(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) { DATA_SOURCE* data_source = idam_plugin_interface->data_source; @@ -154,7 +200,9 @@ int do_read(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) StringCopy(data_source->path, path, MAXPATH); UDA_LOG(UDA_LOG_DEBUG, "expandEnvironmentvariables! \n"); - expand_environment_variables(data_source->path); + expand_environment_variables(data_source->path); + + check_allowed_path(data_source->path); return readBytes(*data_source, *signal_desc, data_block, idam_plugin_interface->environment); } diff --git a/source/plugins/keyvalue/keyvaluePlugin.cpp b/source/plugins/keyvalue/keyvaluePlugin.cpp index fc80555e..c1cc3f7b 100755 --- a/source/plugins/keyvalue/keyvaluePlugin.cpp +++ b/source/plugins/keyvalue/keyvaluePlugin.cpp @@ -51,25 +51,25 @@ int keyValue(IDAM_PLUGIN_INTERFACE* plugin_interface) plugin_interface->pluginVersion = THISPLUGIN_VERSION; - REQUEST_DATA* request_block = plugin_interface->request_data; + REQUEST_DATA* request_data = plugin_interface->request_data; int rc = 0; - if (STR_IEQUALS(request_block->function, "help")) { + if (STR_IEQUALS(request_data->function, "help")) { rc = plugin.help(plugin_interface); - } else if (STR_IEQUALS(request_block->function, "version")) { + } else if (STR_IEQUALS(request_data->function, "version")) { rc = plugin.version(plugin_interface); - } else if (STR_IEQUALS(request_block->function, "builddate")) { + } else if (STR_IEQUALS(request_data->function, "builddate")) { rc = plugin.build_date(plugin_interface); - } else if (STR_IEQUALS(request_block->function, "defaultmethod")) { + } else if (STR_IEQUALS(request_data->function, "defaultmethod")) { rc = plugin.default_method(plugin_interface); - } else if (STR_IEQUALS(request_block->function, "maxinterfaceversion")) { + } else if (STR_IEQUALS(request_data->function, "maxinterfaceversion")) { rc = plugin.max_interface_version(plugin_interface); - } else if (STR_IEQUALS(request_block->function, "write")) { + } else if (STR_IEQUALS(request_data->function, "write")) { rc = plugin.write(plugin_interface); - } else if (STR_IEQUALS(request_block->function, "read")) { + } else if (STR_IEQUALS(request_data->function, "read")) { rc = plugin.read(plugin_interface); - } else if (STR_IEQUALS(request_block->function, "delete")) { + } else if (STR_IEQUALS(request_data->function, "delete")) { rc = plugin.del(plugin_interface); } else { RAISE_PLUGIN_ERROR("Unknown function requested!"); @@ -84,10 +84,10 @@ int uda::keyvalue::Plugin::init(IDAM_PLUGIN_INTERFACE* plugin_interface) initPlugin(plugin_interface); #endif - REQUEST_DATA* request_block = plugin_interface->request_data; + REQUEST_DATA* request_data = plugin_interface->request_data; if (!initialised_ - || !strcasecmp(request_block->function, "init") || !strcasecmp(request_block->function, "initialise")) { + || !strcasecmp(request_data->function, "init") || !strcasecmp(request_data->function, "initialise")) { options_ = leveldb_options_create(); leveldb_options_set_create_if_missing(options_, 1); @@ -109,9 +109,9 @@ int uda::keyvalue::Plugin::init(IDAM_PLUGIN_INTERFACE* plugin_interface) void uda::keyvalue::Plugin::reset(IDAM_PLUGIN_INTERFACE* plugin_interface) { - REQUEST_DATA* request_block = plugin_interface->request_data; + REQUEST_DATA* request_data = plugin_interface->request_data; - if (plugin_interface->housekeeping || !strcasecmp(request_block->function, "reset")) { + if (plugin_interface->housekeeping || !strcasecmp(request_data->function, "reset")) { if (!initialised_) return; leveldb_close(db_); @@ -330,4 +330,4 @@ int uda::keyvalue::Plugin::del(IDAM_PLUGIN_INTERFACE* plugin_interface) } return 0; -} \ No newline at end of file +} diff --git a/source/plugins/template/templatePlugin.cpp b/source/plugins/template/templatePlugin.cpp index 7346cda2..3395d5b1 100755 --- a/source/plugins/template/templatePlugin.cpp +++ b/source/plugins/template/templatePlugin.cpp @@ -209,7 +209,7 @@ int TemplatePlugin::function(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) FIND_REQUIRED_STRING_VALUE(nvl, required); double* array = nullptr; - size_t narray = -1; + size_t narray = 0; FIND_REQUIRED_DOUBLE_ARRAY(nvl, array); int optional = -1; diff --git a/source/plugins/uda/uda_plugin.cpp b/source/plugins/uda/uda_plugin.cpp index 30b4ec7c..f71028c6 100755 --- a/source/plugins/uda/uda_plugin.cpp +++ b/source/plugins/uda/uda_plugin.cpp @@ -57,7 +57,7 @@ extern int UDAPlugin(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) // Resetting all UDA client properties - resetIdamProperties(udaClientFlags()); + udaResetProperties(); udaFreeAll(); putIdamServerHost(oldServerHost); // Original Host @@ -82,7 +82,7 @@ extern int UDAPlugin(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) // Resetting all UDA client properties - resetIdamProperties(udaClientFlags()); + udaResetProperties(); // Hand over Server IO File Handles to UDA Client library @@ -309,20 +309,19 @@ Notes: there are three pathways depending on the request pattern // Set Properties CLIENT_BLOCK* client_block = idam_plugin_interface->client_block; - auto client_flags = udaClientFlags(); - if (client_block->get_nodimdata) setIdamProperty("get_nodimdata", client_flags); - if (client_block->get_timedble) setIdamProperty("get_timedble", client_flags); - if (client_block->get_dimdble) setIdamProperty("get_dimdble", client_flags); - if (client_block->get_datadble) setIdamProperty("get_datadble", client_flags); + if (client_block->get_nodimdata) udaSetProperty("get_nodimdata"); + if (client_block->get_timedble) udaSetProperty("get_timedble"); + if (client_block->get_dimdble) udaSetProperty("get_dimdble"); + if (client_block->get_datadble) udaSetProperty("get_datadble"); - if (client_block->get_bad) setIdamProperty("get_bad", client_flags); - if (client_block->get_meta) setIdamProperty("get_meta", client_flags); - if (client_block->get_asis) setIdamProperty("get_asis", client_flags); - if (client_block->get_uncal) setIdamProperty("get_uncal", client_flags); - if (client_block->get_notoff) setIdamProperty("get_notoff", client_flags); - if (client_block->get_scalar) setIdamProperty("get_scalar", client_flags); - if (client_block->get_bytes) setIdamProperty("get_bytes", client_flags); + if (client_block->get_bad) udaSetProperty("get_bad"); + if (client_block->get_meta) udaSetProperty("get_meta"); + if (client_block->get_asis) udaSetProperty("get_asis"); + if (client_block->get_uncal) udaSetProperty("get_uncal"); + if (client_block->get_notoff) udaSetProperty("get_notoff"); + if (client_block->get_scalar) udaSetProperty("get_scalar"); + if (client_block->get_bytes) udaSetProperty("get_bytes"); // Timeout ... @@ -330,8 +329,8 @@ Notes: there are three pathways depending on the request pattern // Client Flags ... - resetIdamClientFlag(client_flags, CLIENTFLAG_FULLRESET); - setIdamClientFlag(client_flags, client_block->clientFlags); + udaResetClientFlag((unsigned int)CLIENTFLAG_FULLRESET); + udaSetClientFlag(client_block->clientFlags); // Client application provenance @@ -575,7 +574,7 @@ Notes: there are three pathways depending on the request pattern } resetIdamPrivateFlag(PRIVATEFLAG_FULLRESET); - resetIdamClientFlag(client_flags, CLIENTFLAG_FULLRESET); + udaResetClientFlag((unsigned int)CLIENTFLAG_FULLRESET); //---------------------------------------------------------------------- // Test for Errors: Close Socket and Free heap diff --git a/source/server/CMakeLists.txt b/source/server/CMakeLists.txt index df291626..617597b7 100755 --- a/source/server/CMakeLists.txt +++ b/source/server/CMakeLists.txt @@ -138,6 +138,8 @@ endif() set( LINK_DL ) if( WIN32 OR MINGW ) set( LINK_DL dlfcn-win32::dl ) +else() + set( LINK_DL dl ) endif() set( LINK_M ) @@ -287,12 +289,6 @@ install( DESTINATION etc ) -install( - DIRECTORY - ${CMAKE_BINARY_DIR}/lib/pkgconfig - DESTINATION lib -) - install( DIRECTORY ${CMAKE_SOURCE_DIR}/source/etc/machine.d diff --git a/source/server/createXDRStream.cpp b/source/server/createXDRStream.cpp index f686ab99..e397221e 100755 --- a/source/server/createXDRStream.cpp +++ b/source/server/createXDRStream.cpp @@ -18,7 +18,7 @@ std::pair serverCreateXDRStream(IoData* io_data) #if !defined(FATCLIENT) && defined(SSLAUTHENTICATION) if (getUdaServerSSLDisabled()) { -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create( &server_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, io_data, reinterpret_cast(server_read), reinterpret_cast(server_write)); @@ -36,7 +36,7 @@ std::pair serverCreateXDRStream(IoData* io_data) reinterpret_cast(server_write)); #endif } else { -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create( &server_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, io_data, reinterpret_cast(readUdaServerSSL), reinterpret_cast(writeUdaServerSSL)); @@ -56,7 +56,7 @@ std::pair serverCreateXDRStream(IoData* io_data) } #else // SSLAUTHENTICATION -#if defined (__APPLE__) || defined(__TIRPC__) +#if defined (__APPLE__) || defined(__TIRPC__) || defined(_WIN32) xdrrec_create(&server_output, DB_READ_BLOCK_SIZE, DB_WRITE_BLOCK_SIZE, io_data, reinterpret_cast(server_read), reinterpret_cast(server_write)); diff --git a/source/server/getServerEnvironment.cpp b/source/server/getServerEnvironment.cpp index f0a56aea..1b72083f 100755 --- a/source/server/getServerEnvironment.cpp +++ b/source/server/getServerEnvironment.cpp @@ -63,25 +63,25 @@ ENVIRONMENT* getServerEnvironment() if ((env = getenv("UDA_DEVICE")) != nullptr) { strcpy(g_environ.api_device, env); } else { - UDA_LOG(UDA_LOG_WARN, "UDA_DEVICE environment variable not set"); + UDA_LOG(UDA_LOG_WARN, "UDA_DEVICE environment variable not set\n"); } if ((env = getenv("UDA_ARCHIVE")) != nullptr) { strcpy(g_environ.api_archive, env); } else { - UDA_LOG(UDA_LOG_WARN, "UDA_ARCHIVE environment variable not set"); + UDA_LOG(UDA_LOG_WARN, "UDA_ARCHIVE environment variable not set\n"); } if ((env = getenv("UDA_API_DELIM")) != nullptr) { strcpy(g_environ.api_delim, env); } else { - UDA_LOG(UDA_LOG_WARN, "UDA_API_DELIM environment variable not set"); + UDA_LOG(UDA_LOG_WARN, "UDA_API_DELIM environment variable not set\n"); } if ((env = getenv("UDA_FILE_FORMAT")) != nullptr) { strcpy(g_environ.api_format, env); } else { - UDA_LOG(UDA_LOG_WARN, "UDA_FILE_FORMAT environment variable not set"); + UDA_LOG(UDA_LOG_WARN, "UDA_FILE_FORMAT environment variable not set\n"); } //------------------------------------------------------------------------------------------- diff --git a/source/server/serverSubsetData.cpp b/source/server/serverSubsetData.cpp index 26592552..3d2fafee 100755 --- a/source/server/serverSubsetData.cpp +++ b/source/server/serverSubsetData.cpp @@ -1629,6 +1629,27 @@ double EpsilonSelector::Epsilon = DBL_EPSILON; template <> float EpsilonSelector::Epsilon = FLT_EPSILON; +namespace uda { + +template::value && std::is_signed::value, bool> = true> +T abs(T in) { + return in < 0 ? -in : in; +} + +template::value && !std::is_signed::value, bool> = true> +T abs(T in) { + return in; +} + +float abs(float in) { + return fabsf(in); +} + +double abs(double in) { + return fabs(in); +} + +} template int get_subset_indices_for_type(const std::string& operation, DIMS* dim, double value, unsigned int* subset_indices) @@ -1646,16 +1667,16 @@ int get_subset_indices_for_type(const std::string& operation, DIMS* dim, double } if (count == 0 && operation == "~=") { for (int k = 0; k < dim->dim_n; k++) { - if (fabs(p[k] - (T)value) <= EpsilonSelector::Epsilon) { + if (uda::abs(p[k] - (T)value) <= EpsilonSelector::Epsilon) { subset_indices[count++] = k; } } if (count == 0) { int index = -1; double delta; - double minvalue = fabs((T)value - p[0]); + double minvalue = uda::abs((T)value - p[0]); for (int k = 0; k < dim->dim_n; k++) { - delta = fabs((T)value - p[k]); + delta = uda::abs((T)value - p[k]); if (delta < minvalue) { // Look for the Single Nearest Value minvalue = delta; index = k; @@ -1669,11 +1690,11 @@ int get_subset_indices_for_type(const std::string& operation, DIMS* dim, double index == dim->dim_n - 1) { // Check not an end point by default if (dim->dim_n > 1) { if (index == 0) { - delta = fabs(p[1] - p[0]); + delta = uda::abs(p[1] - p[0]); } else { - delta = fabs(p[dim->dim_n - 1] - p[dim->dim_n - 2]); + delta = uda::abs(p[dim->dim_n - 1] - p[dim->dim_n - 2]); } - if (fabs((T)value - p[index]) > delta) count = 0; // Suspect match! + if (uda::abs((T)value - p[index]) > delta) count = 0; // Suspect match! } } } @@ -1713,9 +1734,9 @@ int get_subset_indices_for_type(const std::string& operation, DIMS* dim, double } } else { int index = -1; - double delta, minvalue = fabs((T)value - p[0]); + double delta, minvalue = uda::abs((T)value - p[0]); for (int k = 0; k < dim->dim_n; k++) { - delta = fabs((T)value - p[k]); + delta = uda::abs((T)value - p[k]); if (delta < minvalue) { // Look for the Single Nearest Value minvalue = delta; @@ -1732,11 +1753,11 @@ int get_subset_indices_for_type(const std::string& operation, DIMS* dim, double // Check not an end point by default if (dim->dim_n > 1) { if (index == 0) { - delta = fabs(p[1] - p[0]); + delta = uda::abs(p[1] - p[0]); } else { - delta = fabs(p[dim->dim_n - 1] - p[dim->dim_n - 2]); + delta = uda::abs(p[dim->dim_n - 1] - p[dim->dim_n - 2]); } - if (fabs((T)value - p[index]) > delta) { + if (uda::abs((T)value - p[index]) > delta) { count = 0; } // Suspect match! } diff --git a/source/server2/CMakeLists.txt b/source/server2/CMakeLists.txt index d896d5f0..3af40078 100755 --- a/source/server2/CMakeLists.txt +++ b/source/server2/CMakeLists.txt @@ -8,9 +8,7 @@ find_package( fmt REQUIRED ) if( WIN32 OR MINGW ) find_package( XDR REQUIRED ) - if( NOT MINGW ) - find_package( dlfcn-win32 CONFIG REQUIRED ) - endif() + find_package( dlfcn-win32 CONFIG REQUIRED ) else() find_package( TIRPC QUIET ) if( TIRPC_FOUND ) @@ -53,7 +51,7 @@ add_definitions( -DSERVERBUILD ) add_library( server2-objects OBJECT ${SRC_FILES} ) -target_link_libraries( server2-objects PRIVATE fmt::fmt ) +target_link_libraries( server2-objects PRIVATE spdlog::spdlog fmt::fmt ) set( SERVER2_OBJ $ @@ -61,6 +59,7 @@ set( SERVER2_OBJ $ $ $ + $ ) add_library( server2-static STATIC ${SERVER2_OBJ} ) @@ -70,22 +69,18 @@ endif() set( LINK_XDR ) set( EXE_FLAG ) -set( EXE_EXT ) if( WIN32 OR MINGW ) set( EXE_FLAG WIN32 ) - if( MINGW ) - set( EXE_EXT ".exe" ) - endif() include_directories( ${XDR_INCLUDE_DIR} ) set( LINK_XDR ${XDR_LIBRARIES} ws2_32 ) -elseif( TIRPC_FOUND ) +elseif(TIRPC_FOUND ) include_directories( ${TIRPC_INCLUDE_DIR} ) set( LINK_XDR ${LINK_XDR} ${TIRPC_LIBRARIES} ) endif() -target_link_libraries( server2-static PRIVATE ${LINK_XDR} ) +target_link_libraries( server2-static PRIVATE ${LINK_XDR} fmt::fmt ) if( BUILD_SHARED_LIBS ) - target_link_libraries( server2-shared PRIVATE ${LINK_XDR} ) + target_link_libraries( server2-shared PRIVATE ${LINK_XDR} fmt::fmt ) endif() add_executable( server2-exe ${EXE_FLAG} server_main.cpp) @@ -108,7 +103,7 @@ if( WIN32 OR MINGW ) endif() set( LINK_DL ) -if( WIN32 AND NOT MINGW ) +if( WIN32 OR MINGW ) set( LINK_DL dlfcn-win32::dl ) else() set( LINK_DL dl ) diff --git a/source/server2/server.hpp b/source/server2/server.hpp index f01662de..23c70ef7 100644 --- a/source/server2/server.hpp +++ b/source/server2/server.hpp @@ -13,6 +13,7 @@ #include "clientserver/parseXML.h" #include "clientserver/socketStructs.h" #include "cache/memcache.hpp" +#include "clientserver/export.h" namespace uda { @@ -29,9 +30,9 @@ class Server { constexpr static int ServerVersion = 8; constexpr static int LegacyServerVersion = 6; - Server(); - void run(); - void close(); + LIBRARY_API Server(); + LIBRARY_API void run(); + LIBRARY_API void close(); private: void startup(); diff --git a/source/server2/server_main.cpp b/source/server2/server_main.cpp index 814db0ee..52e5b171 100755 --- a/source/server2/server_main.cpp +++ b/source/server2/server_main.cpp @@ -22,7 +22,7 @@ int main() try { uda::Server server; - server.run(); +// server.run(); } catch (uda::server::Exception& ex) { return ex.code(); } diff --git a/source/server2/xdr_protocol.cpp b/source/server2/xdr_protocol.cpp index 69bb8a71..e3823f50 100644 --- a/source/server2/xdr_protocol.cpp +++ b/source/server2/xdr_protocol.cpp @@ -15,7 +15,6 @@ #include #include -#include #include "server.hpp" @@ -25,6 +24,12 @@ # define write _write #endif +#ifndef _WIN32 +# include +#else +# include +#endif + constexpr int MinBlockTime = 1000; constexpr int MaxBlockTime = 10000; diff --git a/source/structures/CMakeLists.txt b/source/structures/CMakeLists.txt index 0b64f038..5701de4f 100755 --- a/source/structures/CMakeLists.txt +++ b/source/structures/CMakeLists.txt @@ -11,6 +11,10 @@ else() endif() find_package( LibXml2 REQUIRED ) +if ( WIN32 ) + find_package( Iconv REQUIRED ) + message( "ICONV INCLUDE DIR: ${Iconv_INCLUDE_DIR}" ) +endif() ######################################################################################################################## # Sources @@ -28,7 +32,7 @@ include_directories( ) if( MINGW OR WIN32 ) - include_directories( ${XDR_INCLUDE_DIR} ) + include_directories( ${XDR_INCLUDE_DIR} ${Iconv_INCLUDE_DIR} ) # add_compile_options( -Wno-error=use-after-free ) elseif( TIRPC_FOUND ) include_directories( ${TIRPC_INCLUDE_DIR} ) diff --git a/source/uda.h b/source/uda.h index 1b46d94a..43f76bd3 100755 --- a/source/uda.h +++ b/source/uda.h @@ -13,6 +13,8 @@ # include # include # include +# include +# include #endif #endif // UDA_H diff --git a/source/wrappers/CMakeLists.txt b/source/wrappers/CMakeLists.txt index bd5f36db..6d966d0a 100755 --- a/source/wrappers/CMakeLists.txt +++ b/source/wrappers/CMakeLists.txt @@ -1,9 +1,6 @@ ######################################################################################################################## # Dependencies -find_package( IDL ) -find_package( Java 1.6 ) -find_package( JNI ) find_package( Boost ) if( NOT NO_CXX_WRAPPER ) @@ -23,6 +20,7 @@ else() endif() if( NOT NO_IDL_WRAPPER ) + find_package( IDL ) if( IDL_FOUND ) remove_definitions( -Wall -Werror ) add_subdirectory( idl ) @@ -35,6 +33,8 @@ else() endif() if( NOT NO_JAVA_WRAPPER ) + find_package( Java 1.6 ) + find_package( JNI ) if( JAVA_FOUND AND JNI_FOUND ) add_subdirectory( java ) else() diff --git a/source/wrappers/c++/client.cpp b/source/wrappers/c++/client.cpp index 95fba912..2f00165f 100755 --- a/source/wrappers/c++/client.cpp +++ b/source/wrappers/c++/client.cpp @@ -44,10 +44,10 @@ void uda::Client::setProperty(Property prop, bool value) throw UDAException("Unknown property"); } - CLIENT_FLAGS* client_flags = udaClientFlags(); + // CLIENT_FLAGS* client_flags = udaClientFlags(); value - ? setIdamProperty(name.c_str(), client_flags) - : resetIdamProperty(name.c_str(), client_flags); + ? udaSetProperty(name.c_str()) + : udaResetProperty(name.c_str()); } void uda::Client::setProperty(Property prop, int value) @@ -74,11 +74,11 @@ void uda::Client::setProperty(Property prop, int value) case PROP_TIMEOUT: name = (boost::format("timeout=%1%") % value).str(); - setIdamProperty(name.c_str(), udaClientFlags()); + udaSetProperty(name.c_str()); break; case PROP_ALTRANK: name = (boost::format("altrank=%1%") % value).str(); - setIdamProperty(name.c_str(), udaClientFlags()); + udaSetProperty(name.c_str()); break; default: @@ -93,31 +93,36 @@ void uda::Client::close() int uda::Client::property(Property prop) { - auto client_flags = udaClientFlags(); + // auto client_flags = udaClientFlags(); switch (prop) { - case PROP_DATADBLE: return getIdamProperty("get_datadble", client_flags); - case PROP_DIMDBLE: return getIdamProperty("get_dimdble", client_flags); - case PROP_TIMEDBLE: return getIdamProperty("get_timedble", client_flags); - case PROP_BYTES: return getIdamProperty("get_bytes", client_flags); - case PROP_BAD: return getIdamProperty("get_bad", client_flags); - case PROP_META: return getIdamProperty("get_meta", client_flags); - case PROP_ASIS: return getIdamProperty("get_asis", client_flags); - case PROP_UNCAL: return getIdamProperty("get_uncal", client_flags); - case PROP_NOTOFF: return getIdamProperty("get_notoff", client_flags); - case PROP_SYNTHETIC: return getIdamProperty("get_synthetic", client_flags); - case PROP_SCALAR: return getIdamProperty("get_scalar", client_flags); - case PROP_NODIMDATA: return getIdamProperty("get_nodimdata", client_flags); - case PROP_VERBOSE: return getIdamProperty("verbose", client_flags); - case PROP_DEBUG: return getIdamProperty("debug", client_flags); - case PROP_ALTDATA: return getIdamProperty("altdata", client_flags); - case PROP_TIMEOUT: return getIdamProperty("timeout", client_flags); - case PROP_ALTRANK: return getIdamProperty("altrank", client_flags); + case PROP_DATADBLE: return udaGetProperty("get_datadble"); + case PROP_DIMDBLE: return udaGetProperty("get_dimdble"); + case PROP_TIMEDBLE: return udaGetProperty("get_timedble"); + case PROP_BYTES: return udaGetProperty("get_bytes"); + case PROP_BAD: return udaGetProperty("get_bad"); + case PROP_META: return udaGetProperty("get_meta"); + case PROP_ASIS: return udaGetProperty("get_asis"); + case PROP_UNCAL: return udaGetProperty("get_uncal"); + case PROP_NOTOFF: return udaGetProperty("get_notoff"); + case PROP_SYNTHETIC: return udaGetProperty("get_synthetic"); + case PROP_SCALAR: return udaGetProperty("get_scalar"); + case PROP_NODIMDATA: return udaGetProperty("get_nodimdata"); + case PROP_VERBOSE: return udaGetProperty("verbose"); + case PROP_DEBUG: return udaGetProperty("debug"); + case PROP_ALTDATA: return udaGetProperty("altdata"); + case PROP_TIMEOUT: return udaGetProperty("timeout"); + case PROP_ALTRANK: return udaGetProperty("altrank"); default: throw UDAException("Unknown property"); } } +const char *uda::Client::getErrorMsg(int handle) +{ + return getIdamErrorMsg(handle); +} + void uda::Client::setServerHostName(const std::string& hostName) { putIdamServerHost(hostName.c_str()); @@ -272,6 +277,11 @@ static int typeIDToUDAType(const std::type_info& type) return UDA_TYPE_UNKNOWN; } +int uda::Client::getFileID(int handle) +{ + return *reinterpret_cast(getIdamData(handle)); +} + //typedef struct PutDataBlock { // int data_type; // unsigned int rank; @@ -285,33 +295,40 @@ static int typeIDToUDAType(const std::type_info& type) // char* blockName; // Name of the Data Block //} PUTDATA_BLOCK; -void uda::Client::put(const uda::Signal& signal) +int uda::Client::put(const std::string& instruction) +{ + int handle = idamPutAPI(instruction.c_str(), NULL); + return handle; +} + +int uda::Client::put(const uda::Signal& signal) { std::string filename = (boost::format("%s%06d.nc") % signal.alias() % signal.shot()).str(); std::string signal_class; switch (signal.signalClass()) { case uda::ANALYSED: - signal_class = "Analysed"; + signal_class = "analysed data"; break; case uda::RAW: - signal_class = "Raw"; + signal_class = "raw data"; break; case uda::MODELLED: - signal_class = "Modelled"; + signal_class = "modelled data"; break; } - std::string request = (boost::format("putdata::open(/create," - " filename='%s'," - " conventions='Fusion-1.0'," - " class='%s'," - " title='%s'," + std::string request = (boost::format("putdata::open(" + " filename=%s," + " conventions=\"Fusion01.1\"," + " data_class=\"%s\"," + " title=\"%s\"," " shot=%d," " pass=%d," - " comment='%s'," + " comment=\"%s\"," " code=%s," - " version=1)") + " version=1," + "/create)") % filename % signal_class % signal.title() % signal.shot() % signal.pass() % signal.comment() % signal.code()).str(); @@ -331,11 +348,11 @@ void uda::Client::put(const uda::Signal& signal) pdblock.data = (char*)array.byte_data(); - idamPutAPI("", &pdblock); + return idamPutAPI("", &pdblock); } template -void put_scalar(const std::string& instruction, T data) +int put_scalar(const std::string& instruction, T data) { PUTDATA_BLOCK putdata_block{}; initIdamPutDataBlock(&putdata_block); @@ -350,25 +367,26 @@ void put_scalar(const std::string& instruction, T data) putdata_block.data = reinterpret_cast(dp); - idamPutAPI(instruction.c_str(), &putdata_block); + int handle = idamPutAPI(instruction.c_str(), &putdata_block); delete dp; + return handle; } -void uda::Client::put(const std::string& instruction, char data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, int8_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, int16_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, int32_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, int64_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, uint8_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, uint16_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, uint32_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, uint64_t data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, float data) { put_scalar(instruction, data); } -void uda::Client::put(const std::string& instruction, double data) { put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, char data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, int8_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, int16_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, int32_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, int64_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, uint8_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, uint16_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, uint32_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, uint64_t data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, float data) { return put_scalar(instruction, data); } +int uda::Client::put(const std::string& instruction, double data) { return put_scalar(instruction, data); } template -void put_vector(const std::string& instruction, const std::vector& data) +int put_vector(const std::string& instruction, const std::vector& data) { PUTDATA_BLOCK putdata_block{}; initIdamPutDataBlock(&putdata_block); @@ -384,22 +402,23 @@ void put_vector(const std::string& instruction, const std::vector& data) putdata_block.data = reinterpret_cast(const_cast(data.data())); - idamPutAPI(instruction.c_str(), &putdata_block); + int handle = idamPutAPI(instruction.c_str(), &putdata_block); delete[] shape; + return handle; } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } -void uda::Client::put(const std::string& instruction, const std::vector& data) { put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } +int uda::Client::put(const std::string& instruction, const std::vector& data) { return put_vector(instruction, data); } uda::Client::~Client() { @@ -409,7 +428,7 @@ uda::Client::~Client() // udaFreeAll(nullptr, nullptr); } -void uda::Client::put(const std::string& instruction, const uda::Array& data) +int uda::Client::put(const std::string& instruction, const uda::Array& data) { // Use to convert size_t to int struct Downcast @@ -438,5 +457,5 @@ void uda::Client::put(const std::string& instruction, const uda::Array& data) putdata_block.data = reinterpret_cast(data.byte_data()); - idamPutAPI(instruction.c_str(), &putdata_block); + return idamPutAPI(instruction.c_str(), &putdata_block); } diff --git a/source/wrappers/c++/client.hpp b/source/wrappers/c++/client.hpp index 9b881cdc..a71c1f7d 100755 --- a/source/wrappers/c++/client.hpp +++ b/source/wrappers/c++/client.hpp @@ -149,38 +149,44 @@ class LIBRARY_API Client { static std::string serverHostName(); static int serverPort(); + const char *getErrorMsg(int handle); + const uda::Result& get(const std::string& signalName, const std::string& dataSource); uda::ResultList get_batch(const std::vector& signals, const std::string& source); uda::ResultList get_batch(const std::vector>& requests); - void put(const uda::Signal& putdata); - - void put(const std::string& instruction, char data); - void put(const std::string& instruction, int8_t data); - void put(const std::string& instruction, int16_t data); - void put(const std::string& instruction, int32_t data); - void put(const std::string& instruction, int64_t data); - void put(const std::string& instruction, uint8_t data); - void put(const std::string& instruction, uint16_t data); - void put(const std::string& instruction, uint32_t data); - void put(const std::string& instruction, uint64_t data); - void put(const std::string& instruction, float data); - void put(const std::string& instruction, double data); - - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - void put(const std::string& instruction, const std::vector& data); - - void put(const std::string& instruction, const uda::Array& data); + int getFileID(int handle); + + int put(const uda::Signal& putdata); + + int put(const std::string& instruction); + + int put(const std::string& instruction, char data); + int put(const std::string& instruction, int8_t data); + int put(const std::string& instruction, int16_t data); + int put(const std::string& instruction, int32_t data); + int put(const std::string& instruction, int64_t data); + int put(const std::string& instruction, uint8_t data); + int put(const std::string& instruction, uint16_t data); + int put(const std::string& instruction, uint32_t data); + int put(const std::string& instruction, uint64_t data); + int put(const std::string& instruction, float data); + int put(const std::string& instruction, double data); + + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + int put(const std::string& instruction, const std::vector& data); + + int put(const std::string& instruction, const uda::Array& data); void close(); diff --git a/source/wrappers/fortran/accAPI_F.c b/source/wrappers/fortran/accAPI_F.c index e3d81470..4c8b1634 100755 --- a/source/wrappers/fortran/accAPI_F.c +++ b/source/wrappers/fortran/accAPI_F.c @@ -409,7 +409,7 @@ extern void setidamproperty_(char* property, int lproperty) strncpy(s, property, lproperty); s[lproperty] = '\0'; s = TrimString(s); - setIdamProperty(s); + udaSetProperty(s); free( s); } @@ -419,7 +419,7 @@ extern void getidamproperty_(const char* property, int* value, int lproperty) strncpy(s, property, lproperty); s[lproperty] = '\0'; s = TrimString(s); - *value = getIdamProperty(s); + *value = udaGetProperty(s); } extern void resetidamproperty_(char* property, int lproperty) @@ -428,13 +428,13 @@ extern void resetidamproperty_(char* property, int lproperty) strncpy(s, property, lproperty); s[lproperty] = '\0'; s = TrimString(s); - resetIdamProperty(s); + udaResetProperty(s); free( s); } extern void resetidamproperties_() { - resetIdamProperties(); + udaResetProperties(); return; } @@ -612,7 +612,7 @@ extern void getidamdatastatus_(int* handle, int* status) extern void getidamlasthandle_(int* handle) { - *handle = getIdamLastHandle(); + *handle = udaGetLastHandle(); } extern void getidamdatanum_(int* hd, int* datanum) diff --git a/source/wrappers/idl/idam_dlm.c b/source/wrappers/idl/idam_dlm.c index 149f5d60..935a2660 100755 --- a/source/wrappers/idl/idam_dlm.c +++ b/source/wrappers/idl/idam_dlm.c @@ -1186,18 +1186,17 @@ IDL_VPTR IDL_CDECL idamputapi(int argc, IDL_VPTR argv[], char* argk) sout->status = (IDL_LONG)status; sout->error_code = (IDL_LONG)error_code; - CLIENT_FLAGS* client_flags = udaClientFlags(); - sout->get_datadble = (IDL_LONG)getIdamProperty("get_datadble", client_flags); // (IDL_LONG) kw.get_datadble; - sout->get_dimdble = (IDL_LONG)getIdamProperty("get_dimdble", client_flags); // (IDL_LONG) kw.get_dimdble; - sout->get_timedble = (IDL_LONG)getIdamProperty("get_timedble", client_flags); // (IDL_LONG) kw.get_timedble; - sout->get_scalar = (IDL_LONG)getIdamProperty("get_scalar", client_flags); // (IDL_LONG) kw.get_scalar; - sout->get_bytes = (IDL_LONG)getIdamProperty("get_bytes", client_flags); // (IDL_LONG) kw.get_bytes; - sout->get_asis = (IDL_LONG)getIdamProperty("get_asis", client_flags); // (IDL_LONG) kw.get_asis; - sout->get_bad = (IDL_LONG)getIdamProperty("get_bad", client_flags); // (IDL_LONG) kw.get_bad; - sout->get_meta = (IDL_LONG)getIdamProperty("get_meta", client_flags); // (IDL_LONG) kw.get_meta; - sout->get_uncal = (IDL_LONG)getIdamProperty("get_uncal", client_flags); // (IDL_LONG) kw.get_uncal; - sout->get_notoff = (IDL_LONG)getIdamProperty("get_notoff", client_flags); // (IDL_LONG) kw.get_notoff; - sout->get_nodimdata = (IDL_LONG)getIdamProperty("get_nodimdata", client_flags); // (IDL_LONG) kw.get_nodimdata; + sout->get_datadble = (IDL_LONG)udaGetProperty("get_datadble"); // (IDL_LONG) kw.get_datadble; + sout->get_dimdble = (IDL_LONG)udaGetProperty("get_dimdble"); // (IDL_LONG) kw.get_dimdble; + sout->get_timedble = (IDL_LONG)udaGetProperty("get_timedble"); // (IDL_LONG) kw.get_timedble; + sout->get_scalar = (IDL_LONG)udaGetProperty("get_scalar"); // (IDL_LONG) kw.get_scalar; + sout->get_bytes = (IDL_LONG)udaGetProperty("get_bytes"); // (IDL_LONG) kw.get_bytes; + sout->get_asis = (IDL_LONG)udaGetProperty("get_asis"); // (IDL_LONG) kw.get_asis; + sout->get_bad = (IDL_LONG)udaGetProperty("get_bad"); // (IDL_LONG) kw.get_bad; + sout->get_meta = (IDL_LONG)udaGetProperty("get_meta"); // (IDL_LONG) kw.get_meta; + sout->get_uncal = (IDL_LONG)udaGetProperty("get_uncal"); // (IDL_LONG) kw.get_uncal; + sout->get_notoff = (IDL_LONG)udaGetProperty("get_notoff"); // (IDL_LONG) kw.get_notoff; + sout->get_nodimdata = (IDL_LONG)udaGetProperty("get_nodimdata"); // (IDL_LONG) kw.get_nodimdata; IDL_StrStore(&(sout->signal), ""); IDL_StrStore(&(sout->source), ""); @@ -1277,7 +1276,7 @@ IDL_VPTR IDL_CDECL idamputapi(int argc, IDL_VPTR argv[], char* argk) //-------------------------------------------------------------------------- // Cleanup Keywords IDL_KW_FREE; - // restoreIdamProperties(cblock); + // udaRestoreProperties(cblock); return (ivReturn); } @@ -1296,8 +1295,7 @@ IDL_VPTR IDL_CDECL callidam2(int argc, IDL_VPTR argv[], char* argk) char source[STRING_LENGTH]; int exp_number = 0; - CLIENT_FLAGS* client_flags = udaClientFlags(); - CLIENT_BLOCK cblock = saveIdamProperties(client_flags); // preserve the current set of client properties + CLIENT_BLOCK cblock = udaSaveProperties(); // preserve the current set of client properties int handle, status, error_code; char* error_msg; @@ -1544,55 +1542,55 @@ IDL_VPTR IDL_CDECL callidam2(int argc, IDL_VPTR argv[], char* argk) // Process Keywords (take Priority over Passed Arguments) if (kw.debug) { - setIdamProperty("debug", client_flags); // Cannot be reset (currently!) + udaSetProperty("debug"); // Cannot be reset (currently!) } if (kw.verbose) { - setIdamProperty("verbose", client_flags); + udaSetProperty("verbose"); } if (kw.get_datadble) { - setIdamProperty("get_datadble", client_flags); // Properties passed by Keyword must be reset to the prior state + udaSetProperty("get_datadble"); // Properties passed by Keyword must be reset to the prior state } if (kw.get_dimdble) { - setIdamProperty("get_dimdble", client_flags); + udaSetProperty("get_dimdble"); } if (kw.get_timedble) { - setIdamProperty("get_timedble", client_flags); + udaSetProperty("get_timedble"); } if (kw.get_scalar) { - setIdamProperty("get_scalar", client_flags); + udaSetProperty("get_scalar"); } if (kw.get_bytes) { - setIdamProperty("get_bytes", client_flags); + udaSetProperty("get_bytes"); } if (kw.get_asis) { - setIdamProperty("get_asis", client_flags); + udaSetProperty("get_asis"); } if (kw.get_bad) { - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); } if (kw.get_meta) { - setIdamProperty("get_meta", client_flags); + udaSetProperty("get_meta"); } if (kw.get_uncal) { - setIdamProperty("get_uncal", client_flags); + udaSetProperty("get_uncal"); } if (kw.get_notoff) { - setIdamProperty("get_notoff", client_flags); + udaSetProperty("get_notoff"); } if (kw.get_nodimdata) { - setIdamProperty("get_nodimdata", client_flags); + udaSetProperty("get_nodimdata"); } //-------------------------------------------------------------------------- @@ -1623,7 +1621,7 @@ IDL_VPTR IDL_CDECL callidam2(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_BAD_HANDLE)); } @@ -1637,7 +1635,7 @@ IDL_VPTR IDL_CDECL callidam2(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_HEAP_ALLOC_ERROR)); } @@ -1651,17 +1649,17 @@ IDL_VPTR IDL_CDECL callidam2(int argc, IDL_VPTR argv[], char* argk) sout->status = (IDL_LONG)status; sout->error_code = (IDL_LONG)error_code; - sout->get_datadble = (IDL_LONG)getIdamProperty("get_datadble", client_flags); // (IDL_LONG) kw.get_datadble; - sout->get_dimdble = (IDL_LONG)getIdamProperty("get_dimdble", client_flags); // (IDL_LONG) kw.get_dimdble; - sout->get_timedble = (IDL_LONG)getIdamProperty("get_timedble", client_flags); // (IDL_LONG) kw.get_timedble; - sout->get_scalar = (IDL_LONG)getIdamProperty("get_scalar", client_flags); // (IDL_LONG) kw.get_scalar; - sout->get_bytes = (IDL_LONG)getIdamProperty("get_bytes", client_flags); // (IDL_LONG) kw.get_bytes; - sout->get_asis = (IDL_LONG)getIdamProperty("get_asis", client_flags); // (IDL_LONG) kw.get_asis; - sout->get_bad = (IDL_LONG)getIdamProperty("get_bad", client_flags); // (IDL_LONG) kw.get_bad; - sout->get_meta = (IDL_LONG)getIdamProperty("get_meta", client_flags); // (IDL_LONG) kw.get_meta; - sout->get_uncal = (IDL_LONG)getIdamProperty("get_uncal", client_flags); // (IDL_LONG) kw.get_uncal; - sout->get_notoff = (IDL_LONG)getIdamProperty("get_notoff", client_flags); // (IDL_LONG) kw.get_notoff; - sout->get_nodimdata = (IDL_LONG)getIdamProperty("get_nodimdata", client_flags); // (IDL_LONG) kw.get_nodimdata; + sout->get_datadble = (IDL_LONG)udaGetProperty("get_datadble"); // (IDL_LONG) kw.get_datadble; + sout->get_dimdble = (IDL_LONG)udaGetProperty("get_dimdble"); // (IDL_LONG) kw.get_dimdble; + sout->get_timedble = (IDL_LONG)udaGetProperty("get_timedble"); // (IDL_LONG) kw.get_timedble; + sout->get_scalar = (IDL_LONG)udaGetProperty("get_scalar"); // (IDL_LONG) kw.get_scalar; + sout->get_bytes = (IDL_LONG)udaGetProperty("get_bytes"); // (IDL_LONG) kw.get_bytes; + sout->get_asis = (IDL_LONG)udaGetProperty("get_asis"); // (IDL_LONG) kw.get_asis; + sout->get_bad = (IDL_LONG)udaGetProperty("get_bad"); // (IDL_LONG) kw.get_bad; + sout->get_meta = (IDL_LONG)udaGetProperty("get_meta"); // (IDL_LONG) kw.get_meta; + sout->get_uncal = (IDL_LONG)udaGetProperty("get_uncal"); // (IDL_LONG) kw.get_uncal; + sout->get_notoff = (IDL_LONG)udaGetProperty("get_notoff"); // (IDL_LONG) kw.get_notoff; + sout->get_nodimdata = (IDL_LONG)udaGetProperty("get_nodimdata"); // (IDL_LONG) kw.get_nodimdata; IDL_StrStore(&(sout->signal), signal); IDL_StrStore(&(sout->source), source); @@ -1704,7 +1702,7 @@ IDL_VPTR IDL_CDECL callidam2(int argc, IDL_VPTR argv[], char* argk) // Cleanup Keywords IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (ivReturn); } @@ -1726,8 +1724,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) int useIdamGetAPI = 0; static IDL_LONG exp_number, pass = -1, mdstreenum; - CLIENT_FLAGS* client_flags = udaClientFlags(); - CLIENT_BLOCK cblock = saveIdamProperties(client_flags); // preserve the current set of client properties + CLIENT_BLOCK cblock = udaSaveProperties(); // preserve the current set of client properties int handle, rank, order, status, error_code; char* error_msg; @@ -1952,7 +1949,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_ARGUMENTS)); } @@ -1968,7 +1965,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NOT_IMPLEMENTED)); } @@ -2001,48 +1998,48 @@ callidam(int argc, IDL_VPTR argv[], char* argk) mdsnode = IDL_STRING_STR(&(asin->mdsnode)); if ((int)asin->get_datadble) { - setIdamProperty( - "get_datadble", client_flags); // Properties passed by Structure must be reset to the prior state + udaSetProperty( + "get_datadble"); // Properties passed by Structure must be reset to the prior state } if ((int)asin->get_dimdble) { - setIdamProperty("get_dimdble", client_flags); + udaSetProperty("get_dimdble"); } if ((int)asin->get_timedble) { - setIdamProperty("get_timedble", client_flags); + udaSetProperty("get_timedble"); } if ((int)asin->get_scalar) { - setIdamProperty("get_scalar", client_flags); + udaSetProperty("get_scalar"); } if ((int)asin->get_bytes) { - setIdamProperty("get_bytes", client_flags); + udaSetProperty("get_bytes"); } if ((int)asin->get_asis) { - setIdamProperty("get_asis", client_flags); + udaSetProperty("get_asis"); } if ((int)asin->get_bad) { - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); } if ((int)asin->get_meta) { - setIdamProperty("get_meta", client_flags); + udaSetProperty("get_meta"); } if ((int)asin->get_uncal) { - setIdamProperty("get_uncal", client_flags); + udaSetProperty("get_uncal"); } if ((int)asin->get_notoff) { - setIdamProperty("get_notoff", client_flags); + udaSetProperty("get_notoff"); } if ((int)asin->get_nodimdata) { - setIdamProperty("get_nodimdata", client_flags); + udaSetProperty("get_nodimdata"); } if (strlen(signal) > 0 && strlen(source) > 0) { @@ -2062,7 +2059,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_EXP_NUMBER)); } @@ -2081,7 +2078,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NOT_IMPLEMENTED)); } @@ -2110,7 +2107,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_EXP_NUMBER)); } } @@ -2133,7 +2130,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_SIGNAL_ARGUMENT)); } @@ -2152,7 +2149,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NOT_IMPLEMENTED)); } @@ -2172,7 +2169,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_SIGNAL_ARGUMENT)); } @@ -2365,55 +2362,55 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } if (kw.debug) { - setIdamProperty("debug", client_flags); // Cannot be reset (currently!) + udaSetProperty("debug"); // Cannot be reset (currently!) } if (kw.verbose) { - setIdamProperty("verbose", client_flags); + udaSetProperty("verbose"); } if (kw.get_datadble) { - setIdamProperty("get_datadble", client_flags); // Properties passed by Keyword must be reset to the prior state + udaSetProperty("get_datadble"); // Properties passed by Keyword must be reset to the prior state } if (kw.get_dimdble) { - setIdamProperty("get_dimdble", client_flags); + udaSetProperty("get_dimdble"); } if (kw.get_timedble) { - setIdamProperty("get_timedble", client_flags); + udaSetProperty("get_timedble"); } if (kw.get_scalar) { - setIdamProperty("get_scalar", client_flags); + udaSetProperty("get_scalar"); } if (kw.get_bytes) { - setIdamProperty("get_bytes", client_flags); + udaSetProperty("get_bytes"); } if (kw.get_asis) { - setIdamProperty("get_asis", client_flags); + udaSetProperty("get_asis"); } if (kw.get_bad) { - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); } if (kw.get_meta) { - setIdamProperty("get_meta", client_flags); + udaSetProperty("get_meta"); } if (kw.get_uncal) { - setIdamProperty("get_uncal", client_flags); + udaSetProperty("get_uncal"); } if (kw.get_notoff) { - setIdamProperty("get_notoff", client_flags); + udaSetProperty("get_notoff"); } if (kw.get_nodimdata) { - setIdamProperty("get_nodimdata", client_flags); + udaSetProperty("get_nodimdata"); } //-------------------------------------------------------------------------- @@ -2422,7 +2419,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) if (kw.help) { userhelp(stdout, "getidam"); IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(0)); } @@ -2515,7 +2512,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_API_IDENTIFIED)); } } @@ -2540,7 +2537,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_BAD_HANDLE)); } @@ -2557,7 +2554,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_HEAP_ALLOC_ERROR)); } @@ -2573,17 +2570,17 @@ callidam(int argc, IDL_VPTR argv[], char* argk) sout->status = (IDL_LONG)status; sout->error_code = (IDL_LONG)error_code; - sout->get_datadble = (IDL_LONG)getIdamProperty("get_datadble", client_flags); // (IDL_LONG) kw.get_datadble; - sout->get_dimdble = (IDL_LONG)getIdamProperty("get_dimdble", client_flags); // (IDL_LONG) kw.get_dimdble; - sout->get_timedble = (IDL_LONG)getIdamProperty("get_timedble", client_flags); // (IDL_LONG) kw.get_timedble; - sout->get_scalar = (IDL_LONG)getIdamProperty("get_scalar", client_flags); // (IDL_LONG) kw.get_scalar; - sout->get_bytes = (IDL_LONG)getIdamProperty("get_bytes", client_flags); // (IDL_LONG) kw.get_bytes; - sout->get_asis = (IDL_LONG)getIdamProperty("get_asis", client_flags); // (IDL_LONG) kw.get_asis; - sout->get_bad = (IDL_LONG)getIdamProperty("get_bad", client_flags); // (IDL_LONG) kw.get_bad; - sout->get_meta = (IDL_LONG)getIdamProperty("get_meta", client_flags); // (IDL_LONG) kw.get_meta; - sout->get_uncal = (IDL_LONG)getIdamProperty("get_uncal", client_flags); // (IDL_LONG) kw.get_uncal; - sout->get_notoff = (IDL_LONG)getIdamProperty("get_notoff", client_flags); // (IDL_LONG) kw.get_notoff; - sout->get_nodimdata = (IDL_LONG)getIdamProperty("get_nodimdata", client_flags); // (IDL_LONG) kw.get_nodimdata; + sout->get_datadble = (IDL_LONG)udaGetProperty("get_datadble"); // (IDL_LONG) kw.get_datadble; + sout->get_dimdble = (IDL_LONG)udaGetProperty("get_dimdble"); // (IDL_LONG) kw.get_dimdble; + sout->get_timedble = (IDL_LONG)udaGetProperty("get_timedble"); // (IDL_LONG) kw.get_timedble; + sout->get_scalar = (IDL_LONG)udaGetProperty("get_scalar"); // (IDL_LONG) kw.get_scalar; + sout->get_bytes = (IDL_LONG)udaGetProperty("get_bytes"); // (IDL_LONG) kw.get_bytes; + sout->get_asis = (IDL_LONG)udaGetProperty("get_asis"); // (IDL_LONG) kw.get_asis; + sout->get_bad = (IDL_LONG)udaGetProperty("get_bad"); // (IDL_LONG) kw.get_bad; + sout->get_meta = (IDL_LONG)udaGetProperty("get_meta"); // (IDL_LONG) kw.get_meta; + sout->get_uncal = (IDL_LONG)udaGetProperty("get_uncal"); // (IDL_LONG) kw.get_uncal; + sout->get_notoff = (IDL_LONG)udaGetProperty("get_notoff"); // (IDL_LONG) kw.get_notoff; + sout->get_nodimdata = (IDL_LONG)udaGetProperty("get_nodimdata"); // (IDL_LONG) kw.get_nodimdata; IDL_StrStore(&(sout->signal), signal); IDL_StrStore(&(sout->source), source); @@ -2627,7 +2624,7 @@ callidam(int argc, IDL_VPTR argv[], char* argk) // Cleanup Keywords IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (ivReturn); } @@ -2640,11 +2637,10 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) int data_n, rank, ndata, errtype; - CLIENT_FLAGS* client_flags = udaClientFlags(); - CLIENT_BLOCK cblock = saveIdamProperties(client_flags); // preserve the current set of client properties + CLIENT_BLOCK cblock = udaSaveProperties(); // preserve the current set of client properties CLIENT_BLOCK* idamcblock = NULL; int data_get_bad = 0; - int client_get_bad = getIdamProperty("get_bad", client_flags); // Current client get_bad property + int client_get_bad = udaGetProperty("get_bad"); // Current client get_bad property IDAM_SIN* sin = NULL; // Input Structure IDAM_DOUT* sout = NULL; // Returned Structure @@ -2845,7 +2841,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } if ((int)sin->get_bad) { // Reset on exit - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); client_get_bad = 1; } @@ -2871,7 +2867,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_DATA_HAS_ERROR)); } @@ -2889,7 +2885,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_DATA_TO_RETURN)); } @@ -2907,7 +2903,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_DATA_TO_RETURN)); } @@ -2917,7 +2913,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_DATA_TO_RETURN)); } @@ -2927,7 +2923,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_RANK_TOO_HIGH)); } @@ -3134,7 +3130,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_UNKNOWN_DATA_TYPE)); } @@ -3144,7 +3140,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_HEAP_ALLOC_ERROR)); } @@ -3174,7 +3170,7 @@ getidamdata(int argc, IDL_VPTR argv[], char* argk) // Cleanup Keywords and IDAM Heap IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (ivReturn); } @@ -3199,11 +3195,10 @@ getdataarray(int argc, IDL_VPTR argv[], char* argk) IDAM_SIN* sin; // Returned Structure - CLIENT_FLAGS* client_flags = udaClientFlags(); - CLIENT_BLOCK cblock = saveIdamProperties(client_flags); // preserve the current set of client properties + CLIENT_BLOCK cblock = udaSaveProperties(); // preserve the current set of client properties CLIENT_BLOCK* idamcblock = NULL; int data_get_bad = 0; - int client_get_bad = getIdamProperty("get_bad", client_flags); // Current client get_bad property + int client_get_bad = udaGetProperty("get_bad"); // Current client get_bad property char* dvec; IDL_VPTR idlArray = NULL; @@ -3259,7 +3254,7 @@ getdataarray(int argc, IDL_VPTR argv[], char* argk) sin = (IDAM_SIN*)argv[0]->value.s.arr->data; // Input Structure if ((int)sin->get_bad) { // Reset on exit - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); client_get_bad = 1; } @@ -3289,7 +3284,7 @@ getdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_DATA_HAS_ERROR)); } @@ -3303,7 +3298,7 @@ getdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_DATA_TO_RETURN)); } @@ -3402,7 +3397,7 @@ getdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_UNKNOWN_DATA_TYPE)); } @@ -3411,7 +3406,7 @@ getdataarray(int argc, IDL_VPTR argv[], char* argk) // Cleanup Keywords IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (idlArray); } @@ -3437,11 +3432,10 @@ geterrorarray(int argc, IDL_VPTR argv[], char* argk) IDAM_SIN* sin; // Returned Structure - CLIENT_FLAGS* client_flags = udaClientFlags(); - CLIENT_BLOCK cblock = saveIdamProperties(client_flags); //preserve the current set of client properties + CLIENT_BLOCK cblock = udaSaveProperties(); //preserve the current set of client properties CLIENT_BLOCK* idamcblock = NULL; int data_get_bad = 0; - int client_get_bad = getIdamProperty("get_bad", client_flags); // Current client get_bad property + int client_get_bad = udaGetProperty("get_bad"); // Current client get_bad property char* dvec; IDL_VPTR idlArray = NULL; @@ -3497,7 +3491,7 @@ geterrorarray(int argc, IDL_VPTR argv[], char* argk) sin = (IDAM_SIN*)argv[0]->value.s.arr->data; // Input Structure if ((int)sin->get_bad) { // Reset on exit - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); client_get_bad = 1; } @@ -3507,7 +3501,7 @@ geterrorarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_VALID_HANDLE)); } @@ -3528,7 +3522,7 @@ geterrorarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_DATA_HAS_ERROR)); } @@ -3542,7 +3536,7 @@ geterrorarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_DATA_TO_RETURN)); } @@ -3643,7 +3637,7 @@ geterrorarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_UNKNOWN_DATA_TYPE)); } @@ -3652,7 +3646,7 @@ geterrorarray(int argc, IDL_VPTR argv[], char* argk) // Cleanup Keywords IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (idlArray); } @@ -3681,11 +3675,10 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) IDAM_SIN* sin = NULL; // Input Structure IDAM_DIMOUT* sout = NULL; // Returned Structure - CLIENT_FLAGS* client_flags = udaClientFlags(); - CLIENT_BLOCK cblock = saveIdamProperties(client_flags); // preserve the current set of client properties + CLIENT_BLOCK cblock = udaSaveProperties(); // preserve the current set of client properties CLIENT_BLOCK* idamcblock = NULL; int data_get_bad = 0; - int client_get_bad = getIdamProperty("get_bad", client_flags); // Current client get_bad property + int client_get_bad = udaGetProperty("get_bad"); // Current client get_bad property IDL_VPTR ivReturn = NULL; @@ -3888,7 +3881,7 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) dimid = IDL_LongScalar(argv[1]); if ((int)sin->get_bad) { // Reset on exit - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); client_get_bad = 1; } @@ -3898,7 +3891,7 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_VALID_HANDLE)); } @@ -3919,7 +3912,7 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_DATA_HAS_ERROR)); } @@ -3933,7 +3926,7 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_DATA_TO_RETURN)); } @@ -3946,7 +3939,7 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_SUCH_DIMENSION)); } @@ -4119,7 +4112,7 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_HEAP_ALLOC_ERROR)); } @@ -4141,7 +4134,7 @@ getidamdimdata(int argc, IDL_VPTR argv[], char* argk) // Cleanup Keywords IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (ivReturn); } @@ -4165,11 +4158,10 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) IDAM_SIN* sin; // Returned Structure - CLIENT_FLAGS* client_flags = udaClientFlags(); - CLIENT_BLOCK cblock = saveIdamProperties(client_flags); // preserve the current set of client properties + CLIENT_BLOCK cblock = udaSaveProperties(); // preserve the current set of client properties CLIENT_BLOCK* idamcblock = NULL; int data_get_bad = 0; - int client_get_bad = getIdamProperty("get_bad", client_flags); // Current client get_bad property + int client_get_bad = udaGetProperty("get_bad"); // Current client get_bad property char* dvec; IDL_VPTR idlArray = NULL; @@ -4228,7 +4220,7 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) dimid = IDL_LongScalar(argv[1]); if ((int)sin->get_bad) { // Reset on exit - setIdamProperty("get_bad", client_flags); + udaSetProperty("get_bad"); client_get_bad = 1; } @@ -4238,7 +4230,7 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_VALID_HANDLE)); } @@ -4259,7 +4251,7 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_DATA_HAS_ERROR)); } @@ -4273,7 +4265,7 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_DATA_TO_RETURN)); } @@ -4286,7 +4278,7 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_NO_SUCH_DIMENSION)); } @@ -4403,7 +4395,7 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) } IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (IDL_GettmpLong(GDE_UNKNOWN_DATA_TYPE)); } @@ -4412,7 +4404,7 @@ getdimdataarray(int argc, IDL_VPTR argv[], char* argk) // Cleanup Keywords IDL_KW_FREE; - restoreIdamProperties(cblock, client_flags); + udaRestoreProperties(cblock); return (idlArray); } @@ -6865,8 +6857,7 @@ setproperty(int argc, IDL_VPTR argv[], char* argk) { IDL_ENSURE_STRING(argv[0]); // Single String IDL_ENSURE_SCALAR(argv[0]); - CLIENT_FLAGS* client_flags = udaClientFlags(); - setIdamProperty((char*)IDL_STRING_STR(&argv[0]->value.str), client_flags); + udaSetProperty((char*)IDL_STRING_STR(&argv[0]->value.str)); return (IDL_GettmpLong(0)); } @@ -6876,8 +6867,7 @@ resetproperty(int argc, IDL_VPTR argv[], char* argk) { IDL_ENSURE_STRING(argv[0]); // Single String IDL_ENSURE_SCALAR(argv[0]); - CLIENT_FLAGS* client_flags = udaClientFlags(); - resetIdamProperty((char*)IDL_STRING_STR(&argv[0]->value.str), client_flags); + udaResetProperty((char*)IDL_STRING_STR(&argv[0]->value.str)); return (IDL_GettmpLong(0)); } @@ -6885,8 +6875,7 @@ IDL_VPTR IDL_CDECL resetproperties(int argc, IDL_VPTR argv[], char* argk) { - CLIENT_FLAGS* client_flags = udaClientFlags(); - resetIdamProperties(client_flags); + udaResetProperties(); return (IDL_GettmpLong(0)); } @@ -6895,8 +6884,7 @@ IDL_VPTR IDL_CDECL setidamclientflag(int argc, IDL_VPTR argv[], char* argk) { IDL_ENSURE_SCALAR(argv[0]); - CLIENT_FLAGS* client_flags = udaClientFlags(); - setIdamClientFlag(client_flags, (unsigned int)IDL_ULongScalar(argv[0])); + udaSetClientFlag((unsigned int)IDL_ULongScalar(argv[0])); return (IDL_GettmpLong(0)); } @@ -6905,8 +6893,7 @@ IDL_VPTR IDL_CDECL resetidamclientflag(int argc, IDL_VPTR argv[], char* argk) { IDL_ENSURE_SCALAR(argv[0]); - CLIENT_FLAGS* client_flags = udaClientFlags(); - resetIdamClientFlag(client_flags, (unsigned int)IDL_ULongScalar(argv[0])); + udaResetClientFlag((unsigned int)IDL_ULongScalar(argv[0])); return (IDL_GettmpLong(0)); } @@ -7392,8 +7379,7 @@ IDL_VPTR IDL_CDECL getlasthandle(int argc, IDL_VPTR argv[], char* argk) { - CLIENT_FLAGS* client_flags = udaClientFlags(); - return (IDL_GettmpLong(getIdamLastHandle(client_flags))); + return (IDL_GettmpLong(udaGetLastHandle())); } //==================================================================================== diff --git a/source/wrappers/java/idam_jni.c b/source/wrappers/java/idam_jni.c index 0efaa344..14e81dc7 100755 --- a/source/wrappers/java/idam_jni.c +++ b/source/wrappers/java/idam_jni.c @@ -95,12 +95,12 @@ JNIEXPORT void JNICALL Java_jIdam_Idam_resetIdamPrivateFlag(JNIEnv* env, jobject JNIEXPORT void JNICALL Java_jIdam_Idam_setIdamClientFlag(JNIEnv* env, jobject obj, jint flag) { - setIdamClientFlag(udaClientFlags(), (unsigned int)flag); + udaSetClientFlag((unsigned int)flag); } JNIEXPORT void JNICALL Java_jIdam_Idam_resetIdamClientFlag(JNIEnv* env, jobject obj, jint flag) { - resetIdamClientFlag(udaClientFlags(), (unsigned int)flag); + udaResetClientFlag((unsigned int)flag); } //-------------------------------------------------------------- @@ -110,7 +110,7 @@ JNIEXPORT void JNICALL Java_jIdam_Idam_setIdamProperty(JNIEnv* env, jobject obj, { const char* property = (*env)->GetStringUTFChars(env, _property, NULL); if (property == NULL) return; - setIdamProperty(property, udaClientFlags()); + udaSetProperty(property); (*env)->ReleaseStringUTFChars(env, _property, property); } @@ -118,7 +118,7 @@ JNIEXPORT jint JNICALL Java_jIdam_Idam_getIdamProperty(JNIEnv* env, jobject obj, { const char* property = (*env)->GetStringUTFChars(env, _property, NULL); if (property == NULL) return 0; - jint value = (jint)getIdamProperty(property, udaClientFlags()); + jint value = (jint)udaGetProperty(property); (*env)->ReleaseStringUTFChars(env, _property, property); return (value); } @@ -127,13 +127,13 @@ JNIEXPORT void JNICALL Java_jIdam_Idam_resetIdamProperty(JNIEnv* env, jobject ob { const char* property = (*env)->GetStringUTFChars(env, _property, NULL); if (property == NULL) return; - resetIdamProperty(property, udaClientFlags()); + udaResetProperty(property); (*env)->ReleaseStringUTFChars(env, _property, property); } JNIEXPORT void JNICALL Java_jIdam_Idam_resetIdamProperties(JNIEnv* env, jobject obj) { - resetIdamProperties(udaClientFlags()); + udaResetProperties(); } //-------------------------------------------------------------- @@ -257,7 +257,7 @@ JNIEXPORT jint JNICALL Java_jIdam_Idam_getIdamDataStatus(JNIEnv* env, jobject ob JNIEXPORT jint JNICALL Java_jIdam_Idam_getIdamLastHandle(JNIEnv* env, jobject obj) { - return (jint)getIdamLastHandle(udaClientFlags()); + return (jint)udaGetLastHandle(); } diff --git a/source/wrappers/java/idam_jni.h b/source/wrappers/java/idam_jni.h index 18f9163b..40014d7b 100755 --- a/source/wrappers/java/idam_jni.h +++ b/source/wrappers/java/idam_jni.h @@ -44,7 +44,7 @@ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_setIdamPrivateFlag /* * Class: Idam - * Method: setIdamClientFlag + * Method: udaSetClientFlag * Signature: (I)V */ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_setIdamClientFlag @@ -52,7 +52,7 @@ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_setIdamClientFlag /* * Class: Idam - * Method: setIdamProperty + * Method: udaSetProperty * Signature: (Ljava/lang/String;)V */ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_setIdamProperty @@ -60,7 +60,7 @@ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_setIdamProperty /* * Class: Idam - * Method: getIdamProperty + * Method: udaGetProperty * Signature: (Ljava/lang/String;)I */ LIBRARY_API JNIEXPORT jint JNICALL Java_Idam_getIdamProperty @@ -76,7 +76,7 @@ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_resetIdamPrivateFlag /* * Class: Idam - * Method: resetIdamClientFlag + * Method: udaResetClientFlag * Signature: (I)V */ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_resetIdamClientFlag @@ -84,7 +84,7 @@ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_resetIdamClientFlag /* * Class: Idam - * Method: resetIdamProperty + * Method: udaResetProperty * Signature: (Ljava/lang/String;)V */ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_resetIdamProperty @@ -92,7 +92,7 @@ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_resetIdamProperty /* * Class: Idam - * Method: resetIdamProperties + * Method: udaResetProperties * Signature: ()V */ LIBRARY_API JNIEXPORT void JNICALL Java_Idam_resetIdamProperties @@ -268,7 +268,7 @@ LIBRARY_API JNIEXPORT jint JNICALL Java_Idam_getIdamDataStatus /* * Class: Idam - * Method: getIdamLastHandle + * Method: udaGetLastHandle * Signature: (I)I */ LIBRARY_API JNIEXPORT jint JNICALL Java_Idam_getIdamLastHandle diff --git a/source/wrappers/java/jIdam/Idam.java b/source/wrappers/java/jIdam/Idam.java index dee74a69..c4a91564 100755 --- a/source/wrappers/java/jIdam/Idam.java +++ b/source/wrappers/java/jIdam/Idam.java @@ -31,14 +31,14 @@ public class Idam { // Set Server Properties public static native void setIdamPrivateFlag(int flag); - public static native void setIdamClientFlag(int flag); - public static native void setIdamProperty(String property); - public static native int getIdamProperty(String property); + public static native void udaSetClientFlag(int flag); + public static native void udaSetProperty(String property); + public static native int udaGetProperty(String property); public static native void resetIdamPrivateFlag(int flag); - public static native void resetIdamClientFlag(int flag); - public static native void resetIdamProperty(String property); - public static native void resetIdamProperties(); + public static native void udaResetClientFlag(int flag); + public static native void udaResetProperty(String property); + public static native void udaResetProperties(); // Server Identification @@ -77,7 +77,7 @@ public class Idam { // Last Data Access structure handle - public static native int getIdamLastHandle(int handle); + public static native int udaGetLastHandle(int handle); // Data properties diff --git a/source/wrappers/python/CMakeLists.txt b/source/wrappers/python/CMakeLists.txt index 9cf44455..98b585fb 100755 --- a/source/wrappers/python/CMakeLists.txt +++ b/source/wrappers/python/CMakeLists.txt @@ -5,6 +5,7 @@ install( FILES ${CYTHON_FILES} pyuda/cpyuda/uda.pxd DESTINATION python_installer file( GLOB INSTALL_FILES pyuda/*.py ) install( FILES ${INSTALL_FILES} DESTINATION python_installer/pyuda ) +install( FILES ${CMAKE_CURRENT_LIST_DIR}/uda/__init__.py DESTINATION python_installer/uda ) configure_file( ${CMAKE_CURRENT_LIST_DIR}/pyuda/_version.py.in ${CMAKE_CURRENT_BINARY_DIR}/pyuda/_version.py @ONLY ) install( FILES ${CMAKE_CURRENT_BINARY_DIR}/pyuda/_version.py DESTINATION python_installer/pyuda ) @@ -14,6 +15,7 @@ find_package( LibXml2 REQUIRED ) find_package( LibMemcached QUIET ) find_package( fmt REQUIRED ) find_package( TIRPC QUIET ) +find_package( XDR QUIET ) find_library( STDCXX_LIBRARY_FILE stdc++ HINTS ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES} ) get_filename_component(STDCXX_LIB_DIR ${STDCXX_LIBRARY_FILE} DIRECTORY ) @@ -29,28 +31,44 @@ if( ENABLE_CAPNP ) set( EXTRA_LIBS ${EXTRA_LIBS} capnp kj ) set( UDA_LIBS ${UDA_LIBS} serialisation ) set( CAPNP_FLAG "True" ) - get_filename_component( CAPNP_LIB_CMAKE_DIR "${CapnProto_DIR}" DIRECTORY ) - get_filename_component( CAPNP_LIB_DIR "${CAPNP_LIB_CMAKE_DIR}" DIRECTORY ) + if( NOT WIN32 ) + get_filename_component( CAPNP_LIB_CMAKE_DIR "${CapnProto_DIR}" DIRECTORY ) + get_filename_component( CAPNP_LIB_DIR "${CAPNP_LIB_CMAKE_DIR}" DIRECTORY ) + endif() else() set( CAPNP_FLAG "False" ) endif() -get_filename_component( FMT_ROOT_DIR "${fmt_CONFIG}/../../../../" ABSOLUTE ) -set( FMT_INCLUDE_DIR ${FMT_ROOT_DIR}/include ) -set( FMT_LIB_DIR ${FMT_ROOT_DIR}/lib64 ) - -get_filename_component( OPENSSL_LIB_DIR "${OPENSSL_SSL_LIBRARY}" DIRECTORY ) -get_filename_component( LIBXML_LIB_DIR "${LIBXML2_LIBRARIES}" DIRECTORY ) +if ( WIN32 ) + # assuming vcpkg... + get_filename_component( FMT_ROOT_DIR "${fmt_CONFIG}/../../../" ABSOLUTE ) + set( FMT_INCLUDE_DIR ${FMT_ROOT_DIR}/include ) + set( FMT_LIB_DIR ${FMT_ROOT_DIR}/lib ) +else() + get_filename_component( FMT_ROOT_DIR "${fmt_CONFIG}/../../../../" ABSOLUTE ) + set( FMT_INCLUDE_DIR ${FMT_ROOT_DIR}/include ) + set( FMT_LIB_DIR ${FMT_ROOT_DIR}/lib64 ) + get_filename_component( OPENSSL_LIB_DIR "${OPENSSL_SSL_LIBRARY}" DIRECTORY ) + get_filename_component( LIBXML_LIB_DIR "${LIBXML2_LIBRARIES}" DIRECTORY ) +endif() -if( DEFINED TIRPC_INCLUDE_DIR ) +if( DEFINED TIRPC_INCLUDE_DIR AND NOT WIN32) get_filename_component( MAYBE_TIRPC "${TIRPC_INCLUDE_DIR}" NAME ) if( MAYBE_TIRPC STREQUAL "tirpc" ) set( TIRPC_PYUDA_INCLUDE_DIR ${TIRPC_INCLUDE_DIR} ) else() set( TIRPC_PYUDA_INCLUDE_DIR ${TIRPC_INCLUDE_DIR}/tirpc ) endif() +else() + set( TIRPC_PYUDA_INCLUDE_DIR ${XDR_INCLUDE_DIR} ) endif() -configure_file( ${CMAKE_CURRENT_LIST_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py @ONLY ) +if ( WIN32 ) + configure_file( ${CMAKE_CURRENT_LIST_DIR}/win.setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py @ONLY ) +else() + configure_file( ${CMAKE_CURRENT_LIST_DIR}/setup.py.in ${CMAKE_CURRENT_BINARY_DIR}/setup.py @ONLY ) +endif() install( FILES ${CMAKE_CURRENT_BINARY_DIR}/setup.py DESTINATION python_installer ) +install( FILES ${CMAKE_CURRENT_LIST_DIR}/pyproject.toml DESTINATION python_installer ) +install( FILES ${CMAKE_CURRENT_LIST_DIR}/README.md DESTINATION python_installer ) diff --git a/source/wrappers/python/README.md b/source/wrappers/python/README.md new file mode 100644 index 00000000..ac796c68 --- /dev/null +++ b/source/wrappers/python/README.md @@ -0,0 +1,19 @@ +pyuda is the python interface to the uda client library. It is used for remote access to scientific and experimental data from a number of international labs hosting uda data servers. + +- **Website:** https://ukaea.github.io/UDA/ +- **Documentation:** https://ukaea.github.io/UDA/ +- **Source Code:** https://github.com/ukaea/UDA +- **Issue Tracker:** https://github.com/ukaea/UDA/issues + + +## Quick-start + +```py +import pyuda + +pyuda.Client.server = "" +pyuda.Client.port = +client = pyuda.Client() +signal_object = client.get(signal, source) + +``` diff --git a/source/wrappers/python/pyproject.toml b/source/wrappers/python/pyproject.toml new file mode 100644 index 00000000..679531a5 --- /dev/null +++ b/source/wrappers/python/pyproject.toml @@ -0,0 +1,37 @@ +[build-system] +requires = [ + "setuptools>=42", + "oldest-supported-numpy; python_version < '3.13'", + "numpy >=1.7, <2; python_version >= '3.13'", + "Cython>=0.29", + "six", +] +build-backend = "setuptools.build_meta" + +[project.urls] +homepage = "https://ukaea.github.io/UDA/" +documentation = "https://ukaea.github.io/UDA/" +source = "https://github.com/ukaea/UDA" +tracker = "https://github.com/ukaea/UDA/issues" + +[project] +name = "uda" +dynamic = ["version"] +readme = {file = 'README.md', content-type = "text/markdown"} +license = {text = "Apache-2.0 license"} +dependencies = ["numpy>1.7, <2", "six"] +requires-python = ">= 3.5" + +classifiers = [ + 'Intended Audience :: Science/Research', + 'Programming Language :: C', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3 :: Only', + 'Operating System :: POSIX :: Linux', + 'Operating System :: MacOS :: MacOS X', + 'Operating System :: Microsoft :: Windows', +] + +[project.optional-dependencies] +plot = ["pyplot"] +full = ["pyplot", "rich"] diff --git a/source/wrappers/python/pyuda/cpyuda/client.pyx b/source/wrappers/python/pyuda/cpyuda/client.pyx index 0dc57b7c..122a706c 100644 --- a/source/wrappers/python/pyuda/cpyuda/client.pyx +++ b/source/wrappers/python/pyuda/cpyuda/client.pyx @@ -40,21 +40,19 @@ else: def set_property(prop_name, value): if prop_name.lower() not in _properties: raise ValueError('invalid property ' + prop_name) - cdef uda.CLIENT_FLAGS* client_flags = uda.udaClientFlags() if _properties[prop_name][1]: prop_string = prop_name + '=' + str(value) - uda.setIdamProperty(prop_string.encode(), client_flags) + uda.udaSetProperty(prop_string.encode()) elif value: - uda.setIdamProperty(prop_name.encode(), client_flags) + uda.udaSetProperty(prop_name.encode()) else: - uda.resetIdamProperty(prop_name.encode(), client_flags) + uda.udaResetProperty(prop_name.encode()) def get_property(prop_name): if prop_name.lower() not in _properties: raise ValueError('invalid property ' + prop_name) - cdef uda.CLIENT_FLAGS* client_flags = uda.udaClientFlags() - prop = uda.getIdamProperty(prop_name.encode(), client_flags) + prop = uda.udaGetProperty(prop_name.encode()) if _properties[prop_name][1]: return prop else: diff --git a/source/wrappers/python/pyuda/cpyuda/cpyuda.pyx b/source/wrappers/python/pyuda/cpyuda/cpyuda.pyx index ca66fd9f..844ac552 100644 --- a/source/wrappers/python/pyuda/cpyuda/cpyuda.pyx +++ b/source/wrappers/python/pyuda/cpyuda/cpyuda.pyx @@ -6,4 +6,4 @@ include "result.pyx" include "tree_node.pyx" include "types.pyx" IF CAPNP: - include "capnp_tree.pyx" \ No newline at end of file + include "capnp_tree.pyx" diff --git a/source/wrappers/python/pyuda/cpyuda/uda.pxd b/source/wrappers/python/pyuda/cpyuda/uda.pxd index edbc188a..5a1b447c 100644 --- a/source/wrappers/python/pyuda/cpyuda/uda.pxd +++ b/source/wrappers/python/pyuda/cpyuda/uda.pxd @@ -112,9 +112,9 @@ cdef extern from "client/accAPI.h": int getIdamErrorType(int handle); void putIdamServerHost(const char* host); void putIdamServerPort(int port); - int getIdamProperty(const char* property, const CLIENT_FLAGS* client_flags) - void setIdamProperty(const char* property, CLIENT_FLAGS* client_flags); - void resetIdamProperty(const char* property, CLIENT_FLAGS* client_flags); + int udaGetProperty(const char* property) + void udaSetProperty(const char* property); + void udaResetProperty(const char* property); const char* getIdamDataLabel(int handle); const char* getIdamDataUnits(int handle); const char* getIdamDataDesc(int handle); diff --git a/source/wrappers/python/setup.py.in b/source/wrappers/python/setup.py.in index c94e793f..2c4da60c 100644 --- a/source/wrappers/python/setup.py.in +++ b/source/wrappers/python/setup.py.in @@ -3,7 +3,7 @@ import os import sys import sysconfig -from distutils.core import setup, Extension +from setuptools import setup, Extension from Cython.Build import cythonize from Cython.Compiler.Main import default_options import numpy @@ -11,7 +11,7 @@ import numpy default_options['compile_time_env'] = {'CAPNP': @CAPNP_FLAG@} extra_link_args = [] -extra_compile_args = ['-std=c++11'] +extra_compile_args = ['-std=c++17'] root = os.environ.get('UDA_DIR', '@CMAKE_INSTALL_PREFIX@') @@ -78,15 +78,21 @@ ext = Extension( define_macros=extra_macros, ) + +def get_version(v): + if v.count('.') > 2: + v = ".Post".join(v.rsplit('.', 1)) + print("setup version = %s" % v) + return v + + setup( - name='@PROJECT_NAME@', - version='@PROJECT_VERSION@', + name='uda', + version=get_version('@PROJECT_VERSION@'), description='Unified Data Access (UDA)', + long_description='Unified Data Access (UDA)', author='Jonathan Hollocombe', author_email='jonathan.hollocombe@ukaea.uk', - url='https://github.com/ukaea/UDA', - packages=['pyuda'], + packages=['pyuda', 'uda'], ext_modules=cythonize([ext]), - setup_requires=['numpy>=1.7', 'Cython>=0.29', 'six'], - install_requires=['numpy>=1.7', 'six'], ) diff --git a/source/wrappers/python/uda/__init__.py b/source/wrappers/python/uda/__init__.py new file mode 100644 index 00000000..d16731cc --- /dev/null +++ b/source/wrappers/python/uda/__init__.py @@ -0,0 +1,24 @@ +from __future__ import (division, print_function, absolute_import) + +from logging import DEBUG, WARNING, INFO, ERROR + +from pyuda import cpyuda + +from pyuda._client import Client +from pyuda._signal import Signal +from pyuda._video import Video +from pyuda._dim import Dim +from pyuda._structured import StructuredData +from pyuda._json import SignalEncoder, SignalDecoder +from pyuda._version import __version__, __version_info__ + + +UDAException = cpyuda.UDAException +ProtocolException = cpyuda.ProtocolException +ServerException = cpyuda.ServerException +InvalidUseException = cpyuda.InvalidUseException +Properties = cpyuda.Properties + + +__all__ = (UDAException, ProtocolException, ServerException, InvalidUseException, + Client, Signal, Video, Dim, Properties, DEBUG, WARNING, INFO, ERROR) diff --git a/source/wrappers/python/win.setup.py.in b/source/wrappers/python/win.setup.py.in new file mode 100644 index 00000000..cb56dd95 --- /dev/null +++ b/source/wrappers/python/win.setup.py.in @@ -0,0 +1,94 @@ +#!/usr/bin/env python + +import os +import sys +import sysconfig +from setuptools import setup, Extension +from Cython.Build import cythonize +from Cython.Compiler.Main import default_options +import numpy + +default_options['compile_time_env'] = {'CAPNP': @CAPNP_FLAG@} + +extra_link_args = [] +extra_compile_args = ['-std=c++17'] + +root = os.environ.get('UDA_DIR', '@CMAKE_INSTALL_PREFIX@') + +print('Detected platform: ' + sys.platform) +print('Detected system: ' + sysconfig.get_platform()) + +stalib_ext = '' +dynlib_ext = '' +if sys.platform.lower().startswith('linux'): + stalib_ext = 'a' + dynlib_ext = 'so' +elif sys.platform.lower() == 'darwin': + stalib_ext = 'a' + dynlib_ext = 'dylib' + # On Mac OS we have to force setting of rpath + extra_link_args.append('-Wl,-rpath,%s' % os.path.join(root, 'lib')) +else: + stalib_ext = 'lib' + dynlib_ext = 'dll' + extra_compile_args = ['/MD'] + +uda_lib_names = '@UDA_LIBS@'.split(';') if '@UDA_LIBS@' else [] +build_fat = os.environ.get('UDA_FAT_PYTHON', False) +if build_fat: + uda_libs = [ + 'libfat@PROJECT_NAME@_client.' + stalib_ext, + 'lib@PROJECT_NAME@_plugins.' + stalib_ext, + ] + ['lib@PROJECT_NAME@_' + name + '.' + stalib_ext for name in uda_lib_names] + extra_libs = ['xml2', 'pq'] + extra_macros = [('FATCLIENT', None)] +else: + uda_libs = [ + '@PROJECT_NAME@_client.dll.' + stalib_ext, + ] + ['@PROJECT_NAME@_' + name + '.' + stalib_ext for name in uda_lib_names] + extra_libs = '@EXTRA_LIBS@'.split(';') if '@EXTRA_LIBS@' else [] + extra_macros = [] + +ext = Extension( + 'cpyuda', + ['pyuda/cpyuda/cpyuda.pyx'], + include_dirs=list(filter(None, [ + '@TIRPC_PYUDA_INCLUDE_DIR@', + '@LIBXML2_INCLUDE_DIR@', + os.path.join(root, 'include', 'uda'), + numpy.get_include(), + '@FMT_INCLUDE_DIR@' + ])), + libraries=list(filter(None, extra_libs)), + library_dirs=list(filter(None, [ + '@OPENSSL_LIB_DIR@', + '@LIBXML_LIB_DIR@', + '@CAPNP_LIB_DIR@', + '@FMT_LIB_DIR@', + os.path.join(root, 'lib') + ])), + extra_objects=[os.path.join(root, 'lib', uda_lib) for uda_lib in uda_libs], + extra_link_args=extra_link_args, + extra_compile_args=extra_compile_args, + language='c++', + define_macros=extra_macros, +) + + +def get_version(v): + if v.count('.') > 2: + v = ".Post".join(v.rsplit('.', 1)) + print("setup version = %s" % v) + return v + + +setup( + name='ukaea_pyuda_test', + version=get_version('@PROJECT_VERSION@'), + description='Unified Data Access (UDA)', + long_description='Unified Data Access (UDA)', + author='Jonathan Hollocombe', + author_email='jonathan.hollocombe@ukaea.uk', + packages=['pyuda', 'uda'], + ext_modules=cythonize([ext]), +) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3e03a954..1a89a16a 100755 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -52,6 +52,7 @@ set( TESTS ) include_directories( SYSTEM ${Boost_INCLUDE_DIR} ) +include_directories( SYSTEM ${Boost_INCLUDE_DIRS} ) include_directories( SYSTEM ${LIBXML2_INCLUDE_DIR} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR} ) diff --git a/test/catch.hpp b/test/catch.hpp old mode 100755 new mode 100644 index e24e264c..d2a12427 --- a/test/catch.hpp +++ b/test/catch.hpp @@ -36,7 +36,7 @@ # pragma clang diagnostic ignored "-Wcovered-switch-default" # endif #elif defined __GNUC__ -// Because REQUIREs trigger GCC's -Wparentheses, and because still + // Because REQUIREs trigger GCC's -Wparentheses, and because still // supported version of g++ have only buggy support for _Pragmas, // Wparentheses have to be suppressed globally. # pragma GCC diagnostic ignored "-Wparentheses" // See #674 for details @@ -96,7 +96,7 @@ // start catch_user_interfaces.h namespace Catch { -unsigned int rngSeed(); + unsigned int rngSeed(); } // end catch_user_interfaces.h @@ -186,13 +186,13 @@ unsigned int rngSeed(); //////////////////////////////////////////////////////////////////////////////// // Assume that non-Windows platforms support posix signals by default #if !defined(CATCH_PLATFORM_WINDOWS) -#define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS #endif //////////////////////////////////////////////////////////////////////////////// // We know some environments not to support full POSIX signals #if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) -#define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS #endif #ifdef __OS400__ @@ -284,7 +284,7 @@ unsigned int rngSeed(); //////////////////////////////////////////////////////////////////////////////// // Embarcadero C++Build #if defined(__BORLANDC__) -#define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN + #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN #endif //////////////////////////////////////////////////////////////////////////////// @@ -295,7 +295,7 @@ unsigned int rngSeed(); // Otherwise all supported compilers support COUNTER macro, // but user still might want to turn it off #if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) -#define CATCH_INTERNAL_CONFIG_COUNTER + #define CATCH_INTERNAL_CONFIG_COUNTER #endif //////////////////////////////////////////////////////////////////////////////// @@ -304,7 +304,7 @@ unsigned int rngSeed(); // This means that it is detected as Windows, but does not provide // the same set of capabilities as real Windows does. #if defined(UNDER_RTSS) || defined(RTX64_BUILD) -#define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH + #define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH #define CATCH_INTERNAL_CONFIG_NO_ASYNC #define CATCH_CONFIG_COLOUR_NONE #endif @@ -315,27 +315,27 @@ unsigned int rngSeed(); // Various stdlib support checks that require __has_include #if defined(__has_include) -// Check if string_view is available and usable -#if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW -#endif - -// Check if optional is available and usable -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) - -// Check if byte is available and usable -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# include + // Check if string_view is available and usable + #if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW + #endif + + // Check if optional is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # define CATCH_INTERNAL_CONFIG_CPP17_OPTIONAL + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + + // Check if byte is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # include # if defined(__cpp_lib_byte) && (__cpp_lib_byte > 0) # define CATCH_INTERNAL_CONFIG_CPP17_BYTE # endif -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) -// Check if variant is available and usable -# if __has_include() && defined(CATCH_CPP17_OR_GREATER) -# if defined(__clang__) && (__clang_major__ < 8) + // Check if variant is available and usable + # if __has_include() && defined(CATCH_CPP17_OR_GREATER) + # if defined(__clang__) && (__clang_major__ < 8) // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 // fix should be in clang 8, workaround in libstdc++ 8.2 # include @@ -347,7 +347,7 @@ unsigned int rngSeed(); # else # define CATCH_INTERNAL_CONFIG_CPP17_VARIANT # endif // defined(__clang__) && (__clang_major__ < 8) -# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) + # endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) #endif // defined(__has_include) #if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) @@ -483,61 +483,61 @@ std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); namespace Catch { -struct CaseSensitive { enum Choice { + struct CaseSensitive { enum Choice { Yes, No }; }; -class NonCopyable { - NonCopyable( NonCopyable const& ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable& operator = ( NonCopyable const& ) = delete; - NonCopyable& operator = ( NonCopyable && ) = delete; + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; -protected: - NonCopyable(); - virtual ~NonCopyable(); -}; + protected: + NonCopyable(); + virtual ~NonCopyable(); + }; -struct SourceLineInfo { + struct SourceLineInfo { - SourceLineInfo() = delete; - SourceLineInfo( char const* _file, std::size_t _line ) noexcept - : file( _file ), - line( _line ) - {} + SourceLineInfo() = delete; + SourceLineInfo( char const* _file, std::size_t _line ) noexcept + : file( _file ), + line( _line ) + {} - SourceLineInfo( SourceLineInfo const& other ) = default; - SourceLineInfo& operator = ( SourceLineInfo const& ) = default; - SourceLineInfo( SourceLineInfo&& ) noexcept = default; - SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; + SourceLineInfo( SourceLineInfo const& other ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo( SourceLineInfo&& ) noexcept = default; + SourceLineInfo& operator = ( SourceLineInfo&& ) noexcept = default; - bool empty() const noexcept { return file[0] == '\0'; } - bool operator == ( SourceLineInfo const& other ) const noexcept; - bool operator < ( SourceLineInfo const& other ) const noexcept; + bool empty() const noexcept { return file[0] == '\0'; } + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; - char const* file; - std::size_t line; -}; + char const* file; + std::size_t line; + }; -std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); -// Bring in operator<< from global namespace into Catch namespace -// This is necessary because the overload of operator<< above makes -// lookup stop at namespace Catch -using ::operator<<; + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; -// Use this in variadic streaming macros to allow -// >> +StreamEndStop -// as well as -// >> stuff +StreamEndStop -struct StreamEndStop { - std::string operator+() const; -}; -template -T const& operator + ( T const& value, StreamEndStop ) { - return value; -} + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop { + std::string operator+() const; + }; + template + T const& operator + ( T const& value, StreamEndStop ) { + return value; + } } #define CATCH_INTERNAL_LINEINFO \ @@ -546,9 +546,9 @@ T const& operator + ( T const& value, StreamEndStop ) { // end catch_common.h namespace Catch { -struct RegistrarForTagAliases { - RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); -}; + struct RegistrarForTagAliases { + RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); + }; } // end namespace Catch @@ -567,26 +567,26 @@ struct RegistrarForTagAliases { namespace Catch { -class TestSpec; + class TestSpec; -struct ITestInvoker { - virtual void invoke () const = 0; - virtual ~ITestInvoker(); -}; + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; -class TestCase; -struct IConfig; + class TestCase; + struct IConfig; -struct ITestCaseRegistry { - virtual ~ITestCaseRegistry(); - virtual std::vector const& getAllTests() const = 0; - virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; -}; + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + virtual std::vector const& getAllTests() const = 0; + virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; + }; -bool isThrowSafe( TestCase const& testCase, IConfig const& config ); -bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); -std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); -std::vector const& getAllTestCasesSorted( IConfig const& config ); + bool isThrowSafe( TestCase const& testCase, IConfig const& config ); + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); } @@ -600,86 +600,86 @@ std::vector const& getAllTestCasesSorted( IConfig const& config ); namespace Catch { -/// A non-owning string class (similar to the forthcoming std::string_view) -/// Note that, because a StringRef may be a substring of another string, -/// it may not be null terminated. -class StringRef { -public: - using size_type = std::size_t; - using const_iterator = const char*; + /// A non-owning string class (similar to the forthcoming std::string_view) + /// Note that, because a StringRef may be a substring of another string, + /// it may not be null terminated. + class StringRef { + public: + using size_type = std::size_t; + using const_iterator = const char*; -private: - static constexpr char const* const s_empty = ""; + private: + static constexpr char const* const s_empty = ""; - char const* m_start = s_empty; - size_type m_size = 0; + char const* m_start = s_empty; + size_type m_size = 0; -public: // construction - constexpr StringRef() noexcept = default; + public: // construction + constexpr StringRef() noexcept = default; - StringRef( char const* rawChars ) noexcept; + StringRef( char const* rawChars ) noexcept; - constexpr StringRef( char const* rawChars, size_type size ) noexcept - : m_start( rawChars ), - m_size( size ) - {} + constexpr StringRef( char const* rawChars, size_type size ) noexcept + : m_start( rawChars ), + m_size( size ) + {} - StringRef( std::string const& stdString ) noexcept - : m_start( stdString.c_str() ), - m_size( stdString.size() ) - {} + StringRef( std::string const& stdString ) noexcept + : m_start( stdString.c_str() ), + m_size( stdString.size() ) + {} - explicit operator std::string() const { - return std::string(m_start, m_size); - } + explicit operator std::string() const { + return std::string(m_start, m_size); + } -public: // operators - auto operator == ( StringRef const& other ) const noexcept -> bool; - auto operator != (StringRef const& other) const noexcept -> bool { - return !(*this == other); - } + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != (StringRef const& other) const noexcept -> bool { + return !(*this == other); + } - auto operator[] ( size_type index ) const noexcept -> char { - assert(index < m_size); - return m_start[index]; - } + auto operator[] ( size_type index ) const noexcept -> char { + assert(index < m_size); + return m_start[index]; + } -public: // named queries - constexpr auto empty() const noexcept -> bool { - return m_size == 0; - } - constexpr auto size() const noexcept -> size_type { - return m_size; - } + public: // named queries + constexpr auto empty() const noexcept -> bool { + return m_size == 0; + } + constexpr auto size() const noexcept -> size_type { + return m_size; + } - // Returns the current start pointer. If the StringRef is not - // null-terminated, throws std::domain_exception - auto c_str() const -> char const*; + // Returns the current start pointer. If the StringRef is not + // null-terminated, throws std::domain_exception + auto c_str() const -> char const*; -public: // substrings and searches - // Returns a substring of [start, start + length). - // If start + length > size(), then the substring is [start, size()). - // If start > size(), then the substring is empty. - auto substr( size_type start, size_type length ) const noexcept -> StringRef; + public: // substrings and searches + // Returns a substring of [start, start + length). + // If start + length > size(), then the substring is [start, size()). + // If start > size(), then the substring is empty. + auto substr( size_type start, size_type length ) const noexcept -> StringRef; - // Returns the current start pointer. May not be null-terminated. - auto data() const noexcept -> char const*; + // Returns the current start pointer. May not be null-terminated. + auto data() const noexcept -> char const*; - constexpr auto isNullTerminated() const noexcept -> bool { - return m_start[m_size] == '\0'; - } + constexpr auto isNullTerminated() const noexcept -> bool { + return m_start[m_size] == '\0'; + } -public: // iterators - constexpr const_iterator begin() const { return m_start; } - constexpr const_iterator end() const { return m_start + m_size; } -}; + public: // iterators + constexpr const_iterator begin() const { return m_start; } + constexpr const_iterator end() const { return m_start + m_size; } + }; -auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; -auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; + auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; + auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; -constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { - return StringRef( rawChars, size ); -} + constexpr auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } } // namespace Catch constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { @@ -921,38 +921,38 @@ constexpr auto operator "" _catch_sr( char const* rawChars, std::size_t size ) n #include namespace Catch { -template -struct always_false : std::false_type {}; - -template struct true_given : std::true_type {}; -struct is_callable_tester { - template - true_given()(std::declval()...))> static test(int); - template - std::false_type static test(...); -}; + template + struct always_false : std::false_type {}; + + template struct true_given : std::true_type {}; + struct is_callable_tester { + template + true_given()(std::declval()...))> static test(int); + template + std::false_type static test(...); + }; -template -struct is_callable; + template + struct is_callable; -template -struct is_callable : decltype(is_callable_tester::test(0)) {}; + template + struct is_callable : decltype(is_callable_tester::test(0)) {}; #if defined(__cpp_lib_is_invocable) && __cpp_lib_is_invocable >= 201703 -// std::result_of is deprecated in C++17 and removed in C++20. Hence, it is + // std::result_of is deprecated in C++17 and removed in C++20. Hence, it is // replaced with std::invoke_result here. template using FunctionReturnType = std::remove_reference_t>>; #else -// Keep ::type here because we still support C++11 -template -using FunctionReturnType = typename std::remove_reference::type>::type>::type; + // Keep ::type here because we still support C++11 + template + using FunctionReturnType = typename std::remove_reference::type>::type>::type; #endif } // namespace Catch namespace mpl_{ -struct na; + struct na; } // end catch_meta.hpp @@ -991,7 +991,7 @@ struct AutoReg : NonCopyable { } // end namespace Catch #if defined(CATCH_CONFIG_DISABLE) -#define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ + #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ static void TestName() #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ namespace{ \ @@ -1043,26 +1043,26 @@ struct AutoReg : NonCopyable { #endif #endif -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ static void TestName(); \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ static void TestName() -#define INTERNAL_CATCH_TESTCASE( ... ) \ + #define INTERNAL_CATCH_TESTCASE( ... ) \ INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), __VA_ARGS__ ) -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ namespace{ \ @@ -1073,18 +1073,18 @@ struct AutoReg : NonCopyable { } \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION \ void TestName::test() -#define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_S_T_ ), ClassName, __VA_ARGS__ ) -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION -/////////////////////////////////////////////////////////////////////////////// -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\ + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, Signature, ... )\ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ @@ -1114,22 +1114,22 @@ struct AutoReg : NonCopyable { INTERNAL_CATCH_DEFINE_SIG_TEST(TestFunc,INTERNAL_CATCH_REMOVE_PARENS(Signature)) #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) #else -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename TestType, __VA_ARGS__ ) ) #endif #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) #else -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_SIG(Name, Tags, Signature, ...) \ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) ) #endif -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(TestName, TestFuncName, Name, Tags, Signature, TmplTypes, TypesList) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ @@ -1163,22 +1163,22 @@ struct AutoReg : NonCopyable { static void TestFuncName() #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T,__VA_ARGS__) #else -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE(Name, Tags, ...)\ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, typename T, __VA_ARGS__ ) ) #endif #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2(INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__) #else -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_SIG(Name, Tags, Signature, ...)\ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, Signature, __VA_ARGS__ ) ) #endif -#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\ + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2(TestName, TestFunc, Name, Tags, TmplList)\ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ @@ -1205,10 +1205,10 @@ struct AutoReg : NonCopyable { template \ static void TestFunc() -#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \ + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE(Name, Tags, TmplList) \ INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), Name, Tags, TmplList ) -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, Signature, ... ) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ @@ -1238,22 +1238,22 @@ struct AutoReg : NonCopyable { INTERNAL_CATCH_DEFINE_SIG_TEST_METHOD(TestName, INTERNAL_CATCH_REMOVE_PARENS(Signature)) #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) #else -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, typename T, __VA_ARGS__ ) ) #endif #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) #else -#define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... ) \ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_C_L_A_S_S_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ) , ClassName, Name, Tags, Signature, __VA_ARGS__ ) ) #endif -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2(TestNameClass, TestName, ClassName, Name, Tags, Signature, TmplTypes, TypesList)\ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_ZERO_VARIADIC_WARNINGS \ @@ -1290,22 +1290,22 @@ struct AutoReg : NonCopyable { void TestName::test() #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T, __VA_ARGS__ ) #else -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD( ClassName, Name, Tags, ... )\ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, typename T,__VA_ARGS__ ) ) #endif #ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature, __VA_ARGS__ ) #else -#define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ + #define INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_SIG( ClassName, Name, Tags, Signature, ... )\ INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_PRODUCT_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_ ), INTERNAL_CATCH_UNIQUE_NAME( C_A_T_C_H_T_E_M_P_L_A_T_E_T_E_S_T_F_U_N_C_ ), ClassName, Name, Tags, Signature,__VA_ARGS__ ) ) #endif -#define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \ + #define INTERNAL_CATCH_TEMPLATE_LIST_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, TmplList) \ CATCH_INTERNAL_START_WARNINGS_SUPPRESSION \ CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ CATCH_INTERNAL_SUPPRESS_UNUSED_TEMPLATE_WARNINGS \ @@ -1349,8 +1349,8 @@ struct AutoReg : NonCopyable { namespace Catch { -// ResultWas::OfType enum -struct ResultWas { enum OfType { + // ResultWas::OfType enum + struct ResultWas { enum OfType { Unknown = -1, Ok = 0, Info = 1, @@ -1370,11 +1370,11 @@ struct ResultWas { enum OfType { }; }; -bool isOk( ResultWas::OfType resultType ); -bool isJustInfo( int flags ); + bool isOk( ResultWas::OfType resultType ); + bool isJustInfo( int flags ); -// ResultDisposition::Flags enum -struct ResultDisposition { enum Flags { + // ResultDisposition::Flags enum + struct ResultDisposition { enum Flags { Normal = 0x01, ContinueOnFailure = 0x02, // Failures fail test, but execution continues @@ -1382,28 +1382,28 @@ struct ResultDisposition { enum Flags { SuppressFail = 0x08 // Failures are reported but do not fail the test }; }; -ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); -bool shouldContinueOnFailure( int flags ); -inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } -bool shouldSuppressFailure( int flags ); + bool shouldContinueOnFailure( int flags ); + inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } + bool shouldSuppressFailure( int flags ); } // end namespace Catch // end catch_result_type.h namespace Catch { -struct AssertionInfo -{ - StringRef macroName; - SourceLineInfo lineInfo; - StringRef capturedExpression; - ResultDisposition::Flags resultDisposition; - - // We want to delete this constructor but a compiler bug in 4.8 means - // the struct is then treated as non-aggregate - //AssertionInfo() = delete; -}; + struct AssertionInfo + { + StringRef macroName; + SourceLineInfo lineInfo; + StringRef capturedExpression; + ResultDisposition::Flags resultDisposition; + + // We want to delete this constructor but a compiler bug in 4.8 means + // the struct is then treated as non-aggregate + //AssertionInfo() = delete; + }; } // end namespace Catch @@ -1424,35 +1424,35 @@ struct AssertionInfo namespace Catch { -std::ostream& cout(); -std::ostream& cerr(); -std::ostream& clog(); + std::ostream& cout(); + std::ostream& cerr(); + std::ostream& clog(); -class StringRef; + class StringRef; -struct IStream { - virtual ~IStream(); - virtual std::ostream& stream() const = 0; -}; + struct IStream { + virtual ~IStream(); + virtual std::ostream& stream() const = 0; + }; -auto makeStream( StringRef const &filename ) -> IStream const*; + auto makeStream( StringRef const &filename ) -> IStream const*; -class ReusableStringStream : NonCopyable { - std::size_t m_index; - std::ostream* m_oss; -public: - ReusableStringStream(); - ~ReusableStringStream(); + class ReusableStringStream : NonCopyable { + std::size_t m_index; + std::ostream* m_oss; + public: + ReusableStringStream(); + ~ReusableStringStream(); - auto str() const -> std::string; + auto str() const -> std::string; - template - auto operator << ( T const& value ) -> ReusableStringStream& { - *m_oss << value; - return *this; - } - auto get() -> std::ostream& { return *m_oss; } -}; + template + auto operator << ( T const& value ) -> ReusableStringStream& { + *m_oss << value; + return *this; + } + auto get() -> std::ostream& { return *m_oss; } + }; } // end catch_stream.h @@ -1462,32 +1462,32 @@ class ReusableStringStream : NonCopyable { namespace Catch { -namespace Detail { -struct EnumInfo { - StringRef m_name; - std::vector> m_values; + namespace Detail { + struct EnumInfo { + StringRef m_name; + std::vector> m_values; - ~EnumInfo(); + ~EnumInfo(); - StringRef lookup( int value ) const; -}; -} // namespace Detail + StringRef lookup( int value ) const; + }; + } // namespace Detail -struct IMutableEnumValuesRegistry { - virtual ~IMutableEnumValuesRegistry(); + struct IMutableEnumValuesRegistry { + virtual ~IMutableEnumValuesRegistry(); - virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values ) = 0; + virtual Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values ) = 0; - template - Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list values ) { - static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int"); - std::vector intValues; - intValues.reserve( values.size() ); - for( auto enumValue : values ) - intValues.push_back( static_cast( enumValue ) ); - return registerEnum( enumName, allEnums, intValues ); - } -}; + template + Detail::EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::initializer_list values ) { + static_assert(sizeof(int) >= sizeof(E), "Cannot serialize enum to int"); + std::vector intValues; + intValues.reserve( values.size() ); + for( auto enumValue : values ) + intValues.push_back( static_cast( enumValue ) ); + return registerEnum( enumName, allEnums, intValues ); + } + }; } // Catch @@ -1549,55 +1549,55 @@ inline id performOptionalSelector( id obj, SEL sel ) { #endif namespace Catch { -namespace Detail { + namespace Detail { -extern const std::string unprintableString; + extern const std::string unprintableString; -std::string rawMemoryToString( const void *object, std::size_t size ); + std::string rawMemoryToString( const void *object, std::size_t size ); -template -std::string rawMemoryToString( const T& object ) { - return rawMemoryToString( &object, sizeof(object) ); -} + template + std::string rawMemoryToString( const T& object ) { + return rawMemoryToString( &object, sizeof(object) ); + } -template -class IsStreamInsertable { - template - static auto test(int) - -> decltype(std::declval() << std::declval(), std::true_type()); + template + class IsStreamInsertable { + template + static auto test(int) + -> decltype(std::declval() << std::declval(), std::true_type()); - template - static auto test(...)->std::false_type; + template + static auto test(...)->std::false_type; -public: - static const bool value = decltype(test(0))::value; -}; + public: + static const bool value = decltype(test(0))::value; + }; -template -std::string convertUnknownEnumToString( E e ); + template + std::string convertUnknownEnumToString( E e ); -template -typename std::enable_if< - !std::is_enum::value && !std::is_base_of::value, + template + typename std::enable_if< + !std::is_enum::value && !std::is_base_of::value, std::string>::type convertUnstreamable( T const& ) { - return Detail::unprintableString; -} -template -typename std::enable_if< - !std::is_enum::value && std::is_base_of::value, - std::string>::type convertUnstreamable(T const& ex) { - return ex.what(); -} + return Detail::unprintableString; + } + template + typename std::enable_if< + !std::is_enum::value && std::is_base_of::value, + std::string>::type convertUnstreamable(T const& ex) { + return ex.what(); + } -template -typename std::enable_if< - std::is_enum::value + template + typename std::enable_if< + std::is_enum::value , std::string>::type convertUnstreamable( T const& value ) { - return convertUnknownEnumToString( value ); -} + return convertUnknownEnumToString( value ); + } #if defined(_MANAGED) -//! Convert a CLR string to a utf8 std::string + //! Convert a CLR string to a utf8 std::string template std::string clrReferenceToString( T^ ref ) { if (ref == nullptr) @@ -1608,215 +1608,215 @@ typename std::enable_if< } #endif -} // namespace Detail + } // namespace Detail -// If we decide for C++14, change these to enable_if_ts -template -struct StringMaker { - template - static - typename std::enable_if<::Catch::Detail::IsStreamInsertable::value, std::string>::type - convert(const Fake& value) { - ReusableStringStream rss; - // NB: call using the function-like syntax to avoid ambiguity with - // user-defined templated operator<< under clang. - rss.operator<<(value); - return rss.str(); - } + // If we decide for C++14, change these to enable_if_ts + template + struct StringMaker { + template + static + typename std::enable_if<::Catch::Detail::IsStreamInsertable::value, std::string>::type + convert(const Fake& value) { + ReusableStringStream rss; + // NB: call using the function-like syntax to avoid ambiguity with + // user-defined templated operator<< under clang. + rss.operator<<(value); + return rss.str(); + } - template - static - typename std::enable_if::value, std::string>::type - convert( const Fake& value ) { + template + static + typename std::enable_if::value, std::string>::type + convert( const Fake& value ) { #if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) - return Detail::convertUnstreamable(value); + return Detail::convertUnstreamable(value); #else - return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); #endif - } -}; + } + }; -namespace Detail { + namespace Detail { -// This function dispatches all stringification requests inside of Catch. -// Should be preferably called fully qualified, like ::Catch::Detail::stringify -template -std::string stringify(const T& e) { - return ::Catch::StringMaker::type>::type>::convert(e); -} + // This function dispatches all stringification requests inside of Catch. + // Should be preferably called fully qualified, like ::Catch::Detail::stringify + template + std::string stringify(const T& e) { + return ::Catch::StringMaker::type>::type>::convert(e); + } -template -std::string convertUnknownEnumToString( E e ) { - return ::Catch::Detail::stringify(static_cast::type>(e)); -} + template + std::string convertUnknownEnumToString( E e ) { + return ::Catch::Detail::stringify(static_cast::type>(e)); + } #if defined(_MANAGED) -template + template std::string stringify( T^ e ) { return ::Catch::StringMaker::convert(e); } #endif -} // namespace Detail + } // namespace Detail -// Some predefined specializations + // Some predefined specializations -template<> -struct StringMaker { - static std::string convert(const std::string& str); -}; + template<> + struct StringMaker { + static std::string convert(const std::string& str); + }; #ifdef CATCH_CONFIG_CPP17_STRING_VIEW -template<> + template<> struct StringMaker { static std::string convert(std::string_view str); }; #endif -template<> -struct StringMaker { - static std::string convert(char const * str); -}; -template<> -struct StringMaker { - static std::string convert(char * str); -}; + template<> + struct StringMaker { + static std::string convert(char const * str); + }; + template<> + struct StringMaker { + static std::string convert(char * str); + }; #ifdef CATCH_CONFIG_WCHAR -template<> -struct StringMaker { - static std::string convert(const std::wstring& wstr); -}; + template<> + struct StringMaker { + static std::string convert(const std::wstring& wstr); + }; # ifdef CATCH_CONFIG_CPP17_STRING_VIEW -template<> + template<> struct StringMaker { static std::string convert(std::wstring_view str); }; # endif -template<> -struct StringMaker { - static std::string convert(wchar_t const * str); -}; -template<> -struct StringMaker { - static std::string convert(wchar_t * str); -}; + template<> + struct StringMaker { + static std::string convert(wchar_t const * str); + }; + template<> + struct StringMaker { + static std::string convert(wchar_t * str); + }; #endif -// TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, -// while keeping string semantics? -template -struct StringMaker { - static std::string convert(char const* str) { - return ::Catch::Detail::stringify(std::string{ str }); - } -}; -template -struct StringMaker { - static std::string convert(signed char const* str) { - return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); - } -}; -template -struct StringMaker { - static std::string convert(unsigned char const* str) { - return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); - } -}; + // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, + // while keeping string semantics? + template + struct StringMaker { + static std::string convert(char const* str) { + return ::Catch::Detail::stringify(std::string{ str }); + } + }; + template + struct StringMaker { + static std::string convert(signed char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); + } + }; + template + struct StringMaker { + static std::string convert(unsigned char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); + } + }; #if defined(CATCH_CONFIG_CPP17_BYTE) -template<> + template<> struct StringMaker { static std::string convert(std::byte value); }; #endif // defined(CATCH_CONFIG_CPP17_BYTE) -template<> -struct StringMaker { - static std::string convert(int value); -}; -template<> -struct StringMaker { - static std::string convert(long value); -}; -template<> -struct StringMaker { - static std::string convert(long long value); -}; -template<> -struct StringMaker { - static std::string convert(unsigned int value); -}; -template<> -struct StringMaker { - static std::string convert(unsigned long value); -}; -template<> -struct StringMaker { - static std::string convert(unsigned long long value); -}; + template<> + struct StringMaker { + static std::string convert(int value); + }; + template<> + struct StringMaker { + static std::string convert(long value); + }; + template<> + struct StringMaker { + static std::string convert(long long value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned int value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned long value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned long long value); + }; -template<> -struct StringMaker { - static std::string convert(bool b); -}; + template<> + struct StringMaker { + static std::string convert(bool b); + }; -template<> -struct StringMaker { - static std::string convert(char c); -}; -template<> -struct StringMaker { - static std::string convert(signed char c); -}; -template<> -struct StringMaker { - static std::string convert(unsigned char c); -}; + template<> + struct StringMaker { + static std::string convert(char c); + }; + template<> + struct StringMaker { + static std::string convert(signed char c); + }; + template<> + struct StringMaker { + static std::string convert(unsigned char c); + }; -template<> -struct StringMaker { - static std::string convert(std::nullptr_t); -}; + template<> + struct StringMaker { + static std::string convert(std::nullptr_t); + }; -template<> -struct StringMaker { - static std::string convert(float value); - static int precision; -}; + template<> + struct StringMaker { + static std::string convert(float value); + static int precision; + }; -template<> -struct StringMaker { - static std::string convert(double value); - static int precision; -}; + template<> + struct StringMaker { + static std::string convert(double value); + static int precision; + }; -template -struct StringMaker { - template - static std::string convert(U* p) { - if (p) { - return ::Catch::Detail::rawMemoryToString(p); - } else { - return "nullptr"; + template + struct StringMaker { + template + static std::string convert(U* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } } - } -}; + }; -template -struct StringMaker { - static std::string convert(R C::* p) { - if (p) { - return ::Catch::Detail::rawMemoryToString(p); - } else { - return "nullptr"; + template + struct StringMaker { + static std::string convert(R C::* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } } - } -}; + }; #if defined(_MANAGED) -template + template struct StringMaker { static std::string convert( T^ ref ) { return ::Catch::Detail::clrReferenceToString(ref); @@ -1824,23 +1824,23 @@ template }; #endif -namespace Detail { -template -std::string rangeToString(InputIterator first, Sentinel last) { - ReusableStringStream rss; - rss << "{ "; - if (first != last) { - rss << ::Catch::Detail::stringify(*first); - for (++first; first != last; ++first) - rss << ", " << ::Catch::Detail::stringify(*first); + namespace Detail { + template + std::string rangeToString(InputIterator first, Sentinel last) { + ReusableStringStream rss; + rss << "{ "; + if (first != last) { + rss << ::Catch::Detail::stringify(*first); + for (++first; first != last; ++first) + rss << ", " << ::Catch::Detail::stringify(*first); + } + rss << " }"; + return rss.str(); + } } - rss << " }"; - return rss.str(); -} -} #ifdef __OBJC__ -template<> + template<> struct StringMaker { static std::string convert(NSString * nsstring) { if (!nsstring) @@ -1984,71 +1984,71 @@ namespace Catch { #endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER namespace Catch { -// Import begin/ end from std here -using std::begin; -using std::end; + // Import begin/ end from std here + using std::begin; + using std::end; + + namespace detail { + template + struct void_type { + using type = void; + }; -namespace detail { -template -struct void_type { - using type = void; -}; + template + struct is_range_impl : std::false_type { + }; -template -struct is_range_impl : std::false_type { -}; - -template -struct is_range_impl()))>::type> : std::true_type { -}; -} // namespace detail + template + struct is_range_impl()))>::type> : std::true_type { + }; + } // namespace detail -template -struct is_range : detail::is_range_impl { -}; + template + struct is_range : detail::is_range_impl { + }; #if defined(_MANAGED) // Managed types are never ranges -template + template struct is_range { static const bool value = false; }; #endif -template -std::string rangeToString( Range const& range ) { - return ::Catch::Detail::rangeToString( begin( range ), end( range ) ); -} - -// Handle vector specially -template -std::string rangeToString( std::vector const& v ) { - ReusableStringStream rss; - rss << "{ "; - bool first = true; - for( bool b : v ) { - if( first ) - first = false; - else - rss << ", "; - rss << ::Catch::Detail::stringify( b ); + template + std::string rangeToString( Range const& range ) { + return ::Catch::Detail::rangeToString( begin( range ), end( range ) ); } - rss << " }"; - return rss.str(); -} -template -struct StringMaker::value && !::Catch::Detail::IsStreamInsertable::value>::type> { - static std::string convert( R const& range ) { - return rangeToString( range ); + // Handle vector specially + template + std::string rangeToString( std::vector const& v ) { + ReusableStringStream rss; + rss << "{ "; + bool first = true; + for( bool b : v ) { + if( first ) + first = false; + else + rss << ", "; + rss << ::Catch::Detail::stringify( b ); + } + rss << " }"; + return rss.str(); } -}; -template -struct StringMaker { - static std::string convert(T const(&arr)[SZ]) { - return rangeToString(arr); - } -}; + template + struct StringMaker::value && !::Catch::Detail::IsStreamInsertable::value>::type> { + static std::string convert( R const& range ) { + return rangeToString( range ); + } + }; + + template + struct StringMaker { + static std::string convert(T const(&arr)[SZ]) { + return rangeToString(arr); + } + }; } // namespace Catch @@ -2097,75 +2097,75 @@ struct ratio_string { static std::string symbol(); }; -//////////// -// std::chrono::duration specializations -template -struct StringMaker> { - static std::string convert(std::chrono::duration const& duration) { - ReusableStringStream rss; - rss << duration.count() << ' ' << ratio_string::symbol() << 's'; - return rss.str(); - } -}; -template -struct StringMaker>> { - static std::string convert(std::chrono::duration> const& duration) { - ReusableStringStream rss; - rss << duration.count() << " s"; - return rss.str(); - } -}; -template -struct StringMaker>> { - static std::string convert(std::chrono::duration> const& duration) { - ReusableStringStream rss; - rss << duration.count() << " m"; - return rss.str(); - } -}; -template -struct StringMaker>> { - static std::string convert(std::chrono::duration> const& duration) { - ReusableStringStream rss; - rss << duration.count() << " h"; - return rss.str(); - } -}; + //////////// + // std::chrono::duration specializations + template + struct StringMaker> { + static std::string convert(std::chrono::duration const& duration) { + ReusableStringStream rss; + rss << duration.count() << ' ' << ratio_string::symbol() << 's'; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " s"; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " m"; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " h"; + return rss.str(); + } + }; -//////////// -// std::chrono::time_point specialization -// Generic time_point cannot be specialized, only std::chrono::time_point -template -struct StringMaker> { - static std::string convert(std::chrono::time_point const& time_point) { - return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch"; - } -}; -// std::chrono::time_point specialization -template -struct StringMaker> { - static std::string convert(std::chrono::time_point const& time_point) { - auto converted = std::chrono::system_clock::to_time_t(time_point); + //////////// + // std::chrono::time_point specialization + // Generic time_point cannot be specialized, only std::chrono::time_point + template + struct StringMaker> { + static std::string convert(std::chrono::time_point const& time_point) { + return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch"; + } + }; + // std::chrono::time_point specialization + template + struct StringMaker> { + static std::string convert(std::chrono::time_point const& time_point) { + auto converted = std::chrono::system_clock::to_time_t(time_point); #ifdef _MSC_VER - std::tm timeInfo = {}; + std::tm timeInfo = {}; gmtime_s(&timeInfo, &converted); #else - std::tm* timeInfo = std::gmtime(&converted); + std::tm* timeInfo = std::gmtime(&converted); #endif - auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); - char timeStamp[timeStampSize]; - const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; #ifdef _MSC_VER - std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); #else - std::strftime(timeStamp, timeStampSize, fmt, timeInfo); + std::strftime(timeStamp, timeStampSize, fmt, timeInfo); #endif - return std::string(timeStamp); - } -}; + return std::string(timeStamp); + } + }; } #endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER @@ -2199,228 +2199,228 @@ namespace Catch { \ namespace Catch { -struct ITransientExpression { - auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } - auto getResult() const -> bool { return m_result; } - virtual void streamReconstructedExpression( std::ostream &os ) const = 0; - - ITransientExpression( bool isBinaryExpression, bool result ) - : m_isBinaryExpression( isBinaryExpression ), - m_result( result ) - {} + struct ITransientExpression { + auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } + auto getResult() const -> bool { return m_result; } + virtual void streamReconstructedExpression( std::ostream &os ) const = 0; - // We don't actually need a virtual destructor, but many static analysers - // complain if it's not here :-( - virtual ~ITransientExpression(); + ITransientExpression( bool isBinaryExpression, bool result ) + : m_isBinaryExpression( isBinaryExpression ), + m_result( result ) + {} - bool m_isBinaryExpression; - bool m_result; + // We don't actually need a virtual destructor, but many static analysers + // complain if it's not here :-( + virtual ~ITransientExpression(); -}; + bool m_isBinaryExpression; + bool m_result; -void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); + }; -template -class BinaryExpr : public ITransientExpression { - LhsT m_lhs; - StringRef m_op; - RhsT m_rhs; + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); - void streamReconstructedExpression( std::ostream &os ) const override { - formatReconstructedExpression - ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) ); - } + template + class BinaryExpr : public ITransientExpression { + LhsT m_lhs; + StringRef m_op; + RhsT m_rhs; -public: - BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs ) - : ITransientExpression{ true, comparisonResult }, - m_lhs( lhs ), - m_op( op ), - m_rhs( rhs ) - {} + void streamReconstructedExpression( std::ostream &os ) const override { + formatReconstructedExpression + ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) ); + } - template - auto operator && ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + public: + BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs ) + : ITransientExpression{ true, comparisonResult }, + m_lhs( lhs ), + m_op( op ), + m_rhs( rhs ) + {} - template - auto operator || ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator && ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } - template - auto operator == ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator || ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } - template - auto operator != ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator == ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } - template - auto operator > ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator != ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } - template - auto operator < ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator > ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } - template - auto operator >= ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator < ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } - template - auto operator <= ( T ) const -> BinaryExpr const { - static_assert(always_false::value, - "chained comparisons are not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } -}; + template + auto operator >= ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } -template -class UnaryExpr : public ITransientExpression { - LhsT m_lhs; + template + auto operator <= ( T ) const -> BinaryExpr const { + static_assert(always_false::value, + "chained comparisons are not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } + }; - void streamReconstructedExpression( std::ostream &os ) const override { - os << Catch::Detail::stringify( m_lhs ); - } + template + class UnaryExpr : public ITransientExpression { + LhsT m_lhs; -public: - explicit UnaryExpr( LhsT lhs ) - : ITransientExpression{ false, static_cast(lhs) }, - m_lhs( lhs ) - {} -}; + void streamReconstructedExpression( std::ostream &os ) const override { + os << Catch::Detail::stringify( m_lhs ); + } -// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) -template -auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast(lhs == rhs); } -template -auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } -template -auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } -template -auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } -template -auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } + public: + explicit UnaryExpr( LhsT lhs ) + : ITransientExpression{ false, static_cast(lhs) }, + m_lhs( lhs ) + {} + }; -template -auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast(lhs != rhs); } -template -auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } -template -auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } -template -auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } -template -auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } + // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) + template + auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast(lhs == rhs); } + template + auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } + template + auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } + template + auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } + template + auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } -template -class ExprLhs { - LhsT m_lhs; -public: - explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} + template + auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast(lhs != rhs); } + template + auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } + template + auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } + template + auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } + template + auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } - template - auto operator == ( RhsT const& rhs ) -> BinaryExpr const { - return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs }; - } - auto operator == ( bool rhs ) -> BinaryExpr const { - return { m_lhs == rhs, m_lhs, "==", rhs }; - } + template + class ExprLhs { + LhsT m_lhs; + public: + explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} - template - auto operator != ( RhsT const& rhs ) -> BinaryExpr const { - return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs }; - } - auto operator != ( bool rhs ) -> BinaryExpr const { - return { m_lhs != rhs, m_lhs, "!=", rhs }; - } + template + auto operator == ( RhsT const& rhs ) -> BinaryExpr const { + return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs }; + } + auto operator == ( bool rhs ) -> BinaryExpr const { + return { m_lhs == rhs, m_lhs, "==", rhs }; + } - template - auto operator > ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs > rhs), m_lhs, ">", rhs }; - } - template - auto operator < ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs < rhs), m_lhs, "<", rhs }; - } - template - auto operator >= ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs >= rhs), m_lhs, ">=", rhs }; - } - template - auto operator <= ( RhsT const& rhs ) -> BinaryExpr const { - return { static_cast(m_lhs <= rhs), m_lhs, "<=", rhs }; - } - template - auto operator | (RhsT const& rhs) -> BinaryExpr const { - return { static_cast(m_lhs | rhs), m_lhs, "|", rhs }; - } - template - auto operator & (RhsT const& rhs) -> BinaryExpr const { - return { static_cast(m_lhs & rhs), m_lhs, "&", rhs }; - } - template - auto operator ^ (RhsT const& rhs) -> BinaryExpr const { - return { static_cast(m_lhs ^ rhs), m_lhs, "^", rhs }; - } + template + auto operator != ( RhsT const& rhs ) -> BinaryExpr const { + return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs }; + } + auto operator != ( bool rhs ) -> BinaryExpr const { + return { m_lhs != rhs, m_lhs, "!=", rhs }; + } - template - auto operator && ( RhsT const& ) -> BinaryExpr const { - static_assert(always_false::value, - "operator&& is not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator > ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs > rhs), m_lhs, ">", rhs }; + } + template + auto operator < ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs < rhs), m_lhs, "<", rhs }; + } + template + auto operator >= ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs >= rhs), m_lhs, ">=", rhs }; + } + template + auto operator <= ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs <= rhs), m_lhs, "<=", rhs }; + } + template + auto operator | (RhsT const& rhs) -> BinaryExpr const { + return { static_cast(m_lhs | rhs), m_lhs, "|", rhs }; + } + template + auto operator & (RhsT const& rhs) -> BinaryExpr const { + return { static_cast(m_lhs & rhs), m_lhs, "&", rhs }; + } + template + auto operator ^ (RhsT const& rhs) -> BinaryExpr const { + return { static_cast(m_lhs ^ rhs), m_lhs, "^", rhs }; + } - template - auto operator || ( RhsT const& ) -> BinaryExpr const { - static_assert(always_false::value, - "operator|| is not supported inside assertions, " - "wrap the expression inside parentheses, or decompose it"); - } + template + auto operator && ( RhsT const& ) -> BinaryExpr const { + static_assert(always_false::value, + "operator&& is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } - auto makeUnaryExpr() const -> UnaryExpr { - return UnaryExpr{ m_lhs }; - } -}; + template + auto operator || ( RhsT const& ) -> BinaryExpr const { + static_assert(always_false::value, + "operator|| is not supported inside assertions, " + "wrap the expression inside parentheses, or decompose it"); + } -void handleExpression( ITransientExpression const& expr ); + auto makeUnaryExpr() const -> UnaryExpr { + return UnaryExpr{ m_lhs }; + } + }; -template -void handleExpression( ExprLhs const& expr ) { - handleExpression( expr.makeUnaryExpr() ); -} + void handleExpression( ITransientExpression const& expr ); -struct Decomposer { template - auto operator <= ( T const& lhs ) -> ExprLhs { - return ExprLhs{ lhs }; + void handleExpression( ExprLhs const& expr ) { + handleExpression( expr.makeUnaryExpr() ); } - auto operator <=( bool value ) -> ExprLhs { - return ExprLhs{ value }; - } -}; + struct Decomposer { + template + auto operator <= ( T const& lhs ) -> ExprLhs { + return ExprLhs{ lhs }; + } + + auto operator <=( bool value ) -> ExprLhs { + return ExprLhs{ value }; + } + }; } // end namespace Catch @@ -2436,155 +2436,155 @@ struct Decomposer { namespace Catch { -class AssertionResult; -struct AssertionInfo; -struct SectionInfo; -struct SectionEndInfo; -struct MessageInfo; -struct MessageBuilder; -struct Counts; -struct AssertionReaction; -struct SourceLineInfo; + class AssertionResult; + struct AssertionInfo; + struct SectionInfo; + struct SectionEndInfo; + struct MessageInfo; + struct MessageBuilder; + struct Counts; + struct AssertionReaction; + struct SourceLineInfo; -struct ITransientExpression; -struct IGeneratorTracker; + struct ITransientExpression; + struct IGeneratorTracker; #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) -struct BenchmarkInfo; + struct BenchmarkInfo; template > struct BenchmarkStats; #endif // CATCH_CONFIG_ENABLE_BENCHMARKING -struct IResultCapture { + struct IResultCapture { - virtual ~IResultCapture(); + virtual ~IResultCapture(); - virtual bool sectionStarted( SectionInfo const& sectionInfo, - Counts& assertions ) = 0; - virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; - virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; + virtual bool sectionStarted( SectionInfo const& sectionInfo, + Counts& assertions ) = 0; + virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; + virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; - virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; + virtual auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) - virtual void benchmarkPreparing( std::string const& name ) = 0; + virtual void benchmarkPreparing( std::string const& name ) = 0; virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; virtual void benchmarkEnded( BenchmarkStats<> const& stats ) = 0; virtual void benchmarkFailed( std::string const& error ) = 0; #endif // CATCH_CONFIG_ENABLE_BENCHMARKING - virtual void pushScopedMessage( MessageInfo const& message ) = 0; - virtual void popScopedMessage( MessageInfo const& message ) = 0; - - virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0; - - virtual void handleFatalErrorCondition( StringRef message ) = 0; - - virtual void handleExpr - ( AssertionInfo const& info, - ITransientExpression const& expr, - AssertionReaction& reaction ) = 0; - virtual void handleMessage - ( AssertionInfo const& info, - ResultWas::OfType resultType, - StringRef const& message, - AssertionReaction& reaction ) = 0; - virtual void handleUnexpectedExceptionNotThrown - ( AssertionInfo const& info, - AssertionReaction& reaction ) = 0; - virtual void handleUnexpectedInflightException - ( AssertionInfo const& info, - std::string const& message, - AssertionReaction& reaction ) = 0; - virtual void handleIncomplete - ( AssertionInfo const& info ) = 0; - virtual void handleNonExpr - ( AssertionInfo const &info, - ResultWas::OfType resultType, - AssertionReaction &reaction ) = 0; - - virtual bool lastAssertionPassed() = 0; - virtual void assertionPassed() = 0; - - // Deprecated, do not use: - virtual std::string getCurrentTestName() const = 0; - virtual const AssertionResult* getLastResult() const = 0; - virtual void exceptionEarlyReported() = 0; -}; + virtual void pushScopedMessage( MessageInfo const& message ) = 0; + virtual void popScopedMessage( MessageInfo const& message ) = 0; + + virtual void emplaceUnscopedMessage( MessageBuilder const& builder ) = 0; + + virtual void handleFatalErrorCondition( StringRef message ) = 0; + + virtual void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) = 0; + virtual void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) = 0; + virtual void handleIncomplete + ( AssertionInfo const& info ) = 0; + virtual void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) = 0; + + virtual bool lastAssertionPassed() = 0; + virtual void assertionPassed() = 0; + + // Deprecated, do not use: + virtual std::string getCurrentTestName() const = 0; + virtual const AssertionResult* getLastResult() const = 0; + virtual void exceptionEarlyReported() = 0; + }; -IResultCapture& getResultCapture(); + IResultCapture& getResultCapture(); } // end catch_interfaces_capture.h namespace Catch { -struct TestFailureException{}; -struct AssertionResultData; -struct IResultCapture; -class RunContext; + struct TestFailureException{}; + struct AssertionResultData; + struct IResultCapture; + class RunContext; -class LazyExpression { - friend class AssertionHandler; - friend struct AssertionStats; - friend class RunContext; + class LazyExpression { + friend class AssertionHandler; + friend struct AssertionStats; + friend class RunContext; - ITransientExpression const* m_transientExpression = nullptr; - bool m_isNegated; -public: - LazyExpression( bool isNegated ); - LazyExpression( LazyExpression const& other ); - LazyExpression& operator = ( LazyExpression const& ) = delete; + ITransientExpression const* m_transientExpression = nullptr; + bool m_isNegated; + public: + LazyExpression( bool isNegated ); + LazyExpression( LazyExpression const& other ); + LazyExpression& operator = ( LazyExpression const& ) = delete; - explicit operator bool() const; + explicit operator bool() const; - friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; -}; + friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; + }; -struct AssertionReaction { - bool shouldDebugBreak = false; - bool shouldThrow = false; -}; + struct AssertionReaction { + bool shouldDebugBreak = false; + bool shouldThrow = false; + }; -class AssertionHandler { - AssertionInfo m_assertionInfo; - AssertionReaction m_reaction; - bool m_completed = false; - IResultCapture& m_resultCapture; + class AssertionHandler { + AssertionInfo m_assertionInfo; + AssertionReaction m_reaction; + bool m_completed = false; + IResultCapture& m_resultCapture; -public: - AssertionHandler + public: + AssertionHandler ( StringRef const& macroName, SourceLineInfo const& lineInfo, StringRef capturedExpression, ResultDisposition::Flags resultDisposition ); - ~AssertionHandler() { - if ( !m_completed ) { - m_resultCapture.handleIncomplete( m_assertionInfo ); + ~AssertionHandler() { + if ( !m_completed ) { + m_resultCapture.handleIncomplete( m_assertionInfo ); + } } - } - template - void handleExpr( ExprLhs const& expr ) { - handleExpr( expr.makeUnaryExpr() ); - } - void handleExpr( ITransientExpression const& expr ); + template + void handleExpr( ExprLhs const& expr ) { + handleExpr( expr.makeUnaryExpr() ); + } + void handleExpr( ITransientExpression const& expr ); - void handleMessage(ResultWas::OfType resultType, StringRef const& message); + void handleMessage(ResultWas::OfType resultType, StringRef const& message); - void handleExceptionThrownAsExpected(); - void handleUnexpectedExceptionNotThrown(); - void handleExceptionNotThrownAsExpected(); - void handleThrowingCallSkipped(); - void handleUnexpectedInflightException(); + void handleExceptionThrownAsExpected(); + void handleUnexpectedExceptionNotThrown(); + void handleExceptionNotThrownAsExpected(); + void handleThrowingCallSkipped(); + void handleUnexpectedInflightException(); - void complete(); - void setCompleted(); + void complete(); + void setCompleted(); - // query - auto allowThrows() const -> bool; -}; + // query + auto allowThrows() const -> bool; + }; -void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ); } // namespace Catch @@ -2596,80 +2596,80 @@ void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str namespace Catch { -struct MessageInfo { - MessageInfo( StringRef const& _macroName, - SourceLineInfo const& _lineInfo, - ResultWas::OfType _type ); + struct MessageInfo { + MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); - StringRef macroName; - std::string message; - SourceLineInfo lineInfo; - ResultWas::OfType type; - unsigned int sequence; + StringRef macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; - bool operator == ( MessageInfo const& other ) const; - bool operator < ( MessageInfo const& other ) const; -private: - static unsigned int globalCount; -}; + bool operator == ( MessageInfo const& other ) const; + bool operator < ( MessageInfo const& other ) const; + private: + static unsigned int globalCount; + }; -struct MessageStream { + struct MessageStream { - template - MessageStream& operator << ( T const& value ) { - m_stream << value; - return *this; - } + template + MessageStream& operator << ( T const& value ) { + m_stream << value; + return *this; + } - ReusableStringStream m_stream; -}; + ReusableStringStream m_stream; + }; -struct MessageBuilder : MessageStream { - MessageBuilder( StringRef const& macroName, - SourceLineInfo const& lineInfo, - ResultWas::OfType type ); + struct MessageBuilder : MessageStream { + MessageBuilder( StringRef const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ); - template - MessageBuilder& operator << ( T const& value ) { - m_stream << value; - return *this; - } + template + MessageBuilder& operator << ( T const& value ) { + m_stream << value; + return *this; + } - MessageInfo m_info; -}; + MessageInfo m_info; + }; -class ScopedMessage { -public: - explicit ScopedMessage( MessageBuilder const& builder ); - ScopedMessage( ScopedMessage& duplicate ) = delete; - ScopedMessage( ScopedMessage&& old ); - ~ScopedMessage(); + class ScopedMessage { + public: + explicit ScopedMessage( MessageBuilder const& builder ); + ScopedMessage( ScopedMessage& duplicate ) = delete; + ScopedMessage( ScopedMessage&& old ); + ~ScopedMessage(); - MessageInfo m_info; - bool m_moved; -}; + MessageInfo m_info; + bool m_moved; + }; -class Capturer { - std::vector m_messages; - IResultCapture& m_resultCapture = getResultCapture(); - size_t m_captured = 0; -public: - Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); - ~Capturer(); + class Capturer { + std::vector m_messages; + IResultCapture& m_resultCapture = getResultCapture(); + size_t m_captured = 0; + public: + Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); + ~Capturer(); - void captureValue( size_t index, std::string const& value ); + void captureValue( size_t index, std::string const& value ); - template - void captureValues( size_t index, T const& value ) { - captureValue( index, Catch::Detail::stringify( value ) ); - } + template + void captureValues( size_t index, T const& value ) { + captureValue( index, Catch::Detail::stringify( value ) ); + } - template - void captureValues( size_t index, T const& value, Ts const&... values ) { - captureValue( index, Catch::Detail::stringify(value) ); - captureValues( index+1, values... ); - } -}; + template + void captureValues( size_t index, T const& value, Ts const&... values ) { + captureValue( index, Catch::Detail::stringify(value) ); + captureValues( index+1, values... ); + } + }; } // end namespace Catch @@ -2677,9 +2677,9 @@ class Capturer { #if !defined(CATCH_CONFIG_DISABLE) #if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) -#define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ + #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ #else -#define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" + #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" #endif #if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) @@ -2826,30 +2826,30 @@ class Capturer { namespace Catch { -struct Counts { - Counts operator - ( Counts const& other ) const; - Counts& operator += ( Counts const& other ); + struct Counts { + Counts operator - ( Counts const& other ) const; + Counts& operator += ( Counts const& other ); - std::size_t total() const; - bool allPassed() const; - bool allOk() const; + std::size_t total() const; + bool allPassed() const; + bool allOk() const; - std::size_t passed = 0; - std::size_t failed = 0; - std::size_t failedButOk = 0; -}; + std::size_t passed = 0; + std::size_t failed = 0; + std::size_t failedButOk = 0; + }; -struct Totals { + struct Totals { - Totals operator - ( Totals const& other ) const; - Totals& operator += ( Totals const& other ); + Totals operator - ( Totals const& other ) const; + Totals& operator += ( Totals const& other ); - Totals delta( Totals const& prevTotals ) const; + Totals delta( Totals const& prevTotals ) const; - int error = 0; - Counts assertions; - Counts testCases; -}; + int error = 0; + Counts assertions; + Counts testCases; + }; } // end catch_totals.h @@ -2857,27 +2857,27 @@ struct Totals { namespace Catch { -struct SectionInfo { - SectionInfo + struct SectionInfo { + SectionInfo ( SourceLineInfo const& _lineInfo, std::string const& _name ); - // Deprecated - SectionInfo + // Deprecated + SectionInfo ( SourceLineInfo const& _lineInfo, std::string const& _name, std::string const& ) : SectionInfo( _lineInfo, _name ) {} - std::string name; - std::string description; // !Deprecated: this will always be empty - SourceLineInfo lineInfo; -}; + std::string name; + std::string description; // !Deprecated: this will always be empty + SourceLineInfo lineInfo; + }; -struct SectionEndInfo { - SectionInfo sectionInfo; - Counts prevAssertions; - double durationInSeconds; -}; + struct SectionEndInfo { + SectionInfo sectionInfo; + Counts prevAssertions; + double durationInSeconds; + }; } // end namespace Catch @@ -2888,18 +2888,18 @@ struct SectionEndInfo { namespace Catch { -auto getCurrentNanosecondsSinceEpoch() -> uint64_t; -auto getEstimatedClockResolution() -> uint64_t; + auto getCurrentNanosecondsSinceEpoch() -> uint64_t; + auto getEstimatedClockResolution() -> uint64_t; -class Timer { - uint64_t m_nanoseconds = 0; -public: - void start(); - auto getElapsedNanoseconds() const -> uint64_t; - auto getElapsedMicroseconds() const -> uint64_t; - auto getElapsedMilliseconds() const -> unsigned int; - auto getElapsedSeconds() const -> double; -}; + class Timer { + uint64_t m_nanoseconds = 0; + public: + void start(); + auto getElapsedNanoseconds() const -> uint64_t; + auto getElapsedMicroseconds() const -> uint64_t; + auto getElapsedMilliseconds() const -> unsigned int; + auto getElapsedSeconds() const -> double; + }; } // namespace Catch @@ -2908,22 +2908,22 @@ class Timer { namespace Catch { -class Section : NonCopyable { -public: - Section( SectionInfo const& info ); - ~Section(); + class Section : NonCopyable { + public: + Section( SectionInfo const& info ); + ~Section(); - // This indicates whether the section should be executed or not - explicit operator bool() const; + // This indicates whether the section should be executed or not + explicit operator bool() const; -private: - SectionInfo m_info; + private: + SectionInfo m_info; - std::string m_name; - Counts m_assertions; - bool m_sectionIncluded; - Timer m_timer; -}; + std::string m_name; + Counts m_assertions; + bool m_sectionIncluded; + Timer m_timer; + }; } // end namespace Catch @@ -2949,51 +2949,51 @@ class Section : NonCopyable { namespace Catch { -class TestCase; -struct ITestCaseRegistry; -struct IExceptionTranslatorRegistry; -struct IExceptionTranslator; -struct IReporterRegistry; -struct IReporterFactory; -struct ITagAliasRegistry; -struct IMutableEnumValuesRegistry; + class TestCase; + struct ITestCaseRegistry; + struct IExceptionTranslatorRegistry; + struct IExceptionTranslator; + struct IReporterRegistry; + struct IReporterFactory; + struct ITagAliasRegistry; + struct IMutableEnumValuesRegistry; -class StartupExceptionRegistry; + class StartupExceptionRegistry; -using IReporterFactoryPtr = std::shared_ptr; + using IReporterFactoryPtr = std::shared_ptr; -struct IRegistryHub { - virtual ~IRegistryHub(); + struct IRegistryHub { + virtual ~IRegistryHub(); - virtual IReporterRegistry const& getReporterRegistry() const = 0; - virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; - virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; - virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0; + virtual IReporterRegistry const& getReporterRegistry() const = 0; + virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; + virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; + virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0; - virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; -}; + virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; + }; -struct IMutableRegistryHub { - virtual ~IMutableRegistryHub(); - virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; - virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; - virtual void registerTest( TestCase const& testInfo ) = 0; - virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; - virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; - virtual void registerStartupException() noexcept = 0; - virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0; -}; + struct IMutableRegistryHub { + virtual ~IMutableRegistryHub(); + virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; + virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; + virtual void registerTest( TestCase const& testInfo ) = 0; + virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; + virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; + virtual void registerStartupException() noexcept = 0; + virtual IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() = 0; + }; -IRegistryHub const& getRegistryHub(); -IMutableRegistryHub& getMutableRegistryHub(); -void cleanUp(); -std::string translateActiveException(); + IRegistryHub const& getRegistryHub(); + IMutableRegistryHub& getMutableRegistryHub(); + void cleanUp(); + std::string translateActiveException(); } // end catch_interfaces_registry_hub.h #if defined(CATCH_CONFIG_DISABLE) -#define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ + #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ static std::string translatorName( signature ) #endif @@ -3002,58 +3002,58 @@ std::string translateActiveException(); #include namespace Catch { -using exceptionTranslateFunction = std::string(*)(); + using exceptionTranslateFunction = std::string(*)(); -struct IExceptionTranslator; -using ExceptionTranslators = std::vector>; + struct IExceptionTranslator; + using ExceptionTranslators = std::vector>; -struct IExceptionTranslator { - virtual ~IExceptionTranslator(); - virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; -}; + struct IExceptionTranslator { + virtual ~IExceptionTranslator(); + virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; + }; -struct IExceptionTranslatorRegistry { - virtual ~IExceptionTranslatorRegistry(); + struct IExceptionTranslatorRegistry { + virtual ~IExceptionTranslatorRegistry(); - virtual std::string translateActiveException() const = 0; -}; + virtual std::string translateActiveException() const = 0; + }; -class ExceptionTranslatorRegistrar { - template - class ExceptionTranslator : public IExceptionTranslator { - public: + class ExceptionTranslatorRegistrar { + template + class ExceptionTranslator : public IExceptionTranslator { + public: - ExceptionTranslator( std::string(*translateFunction)( T& ) ) - : m_translateFunction( translateFunction ) - {} + ExceptionTranslator( std::string(*translateFunction)( T& ) ) + : m_translateFunction( translateFunction ) + {} - std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { + std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - return ""; + return ""; #else - try { - if( it == itEnd ) - std::rethrow_exception(std::current_exception()); - else - return (*it)->translate( it+1, itEnd ); - } - catch( T& ex ) { - return m_translateFunction( ex ); - } + try { + if( it == itEnd ) + std::rethrow_exception(std::current_exception()); + else + return (*it)->translate( it+1, itEnd ); + } + catch( T& ex ) { + return m_translateFunction( ex ); + } #endif - } + } - protected: - std::string(*m_translateFunction)( T& ); - }; + protected: + std::string(*m_translateFunction)( T& ); + }; -public: - template - ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { - getMutableRegistryHub().registerTranslator + public: + template + ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { + getMutableRegistryHub().registerTranslator ( new ExceptionTranslator( translateFunction ) ); - } -}; + } + }; } /////////////////////////////////////////////////////////////////////////////// @@ -3075,110 +3075,110 @@ class ExceptionTranslatorRegistrar { namespace Catch { namespace Detail { -class Approx { -private: - bool equalityComparisonImpl(double other) const; - // Validates the new margin (margin >= 0) - // out-of-line to avoid including stdexcept in the header - void setMargin(double margin); - // Validates the new epsilon (0 < epsilon < 1) - // out-of-line to avoid including stdexcept in the header - void setEpsilon(double epsilon); + class Approx { + private: + bool equalityComparisonImpl(double other) const; + // Validates the new margin (margin >= 0) + // out-of-line to avoid including stdexcept in the header + void setMargin(double margin); + // Validates the new epsilon (0 < epsilon < 1) + // out-of-line to avoid including stdexcept in the header + void setEpsilon(double epsilon); -public: - explicit Approx ( double value ); + public: + explicit Approx ( double value ); - static Approx custom(); + static Approx custom(); - Approx operator-() const; + Approx operator-() const; - template ::value>::type> - Approx operator()( T const& value ) const { - Approx approx( static_cast(value) ); - approx.m_epsilon = m_epsilon; - approx.m_margin = m_margin; - approx.m_scale = m_scale; - return approx; - } + template ::value>::type> + Approx operator()( T const& value ) const { + Approx approx( static_cast(value) ); + approx.m_epsilon = m_epsilon; + approx.m_margin = m_margin; + approx.m_scale = m_scale; + return approx; + } - template ::value>::type> - explicit Approx( T const& value ): Approx(static_cast(value)) - {} + template ::value>::type> + explicit Approx( T const& value ): Approx(static_cast(value)) + {} - template ::value>::type> - friend bool operator == ( const T& lhs, Approx const& rhs ) { - auto lhs_v = static_cast(lhs); - return rhs.equalityComparisonImpl(lhs_v); - } + template ::value>::type> + friend bool operator == ( const T& lhs, Approx const& rhs ) { + auto lhs_v = static_cast(lhs); + return rhs.equalityComparisonImpl(lhs_v); + } - template ::value>::type> - friend bool operator == ( Approx const& lhs, const T& rhs ) { - return operator==( rhs, lhs ); - } + template ::value>::type> + friend bool operator == ( Approx const& lhs, const T& rhs ) { + return operator==( rhs, lhs ); + } - template ::value>::type> - friend bool operator != ( T const& lhs, Approx const& rhs ) { - return !operator==( lhs, rhs ); - } + template ::value>::type> + friend bool operator != ( T const& lhs, Approx const& rhs ) { + return !operator==( lhs, rhs ); + } - template ::value>::type> - friend bool operator != ( Approx const& lhs, T const& rhs ) { - return !operator==( rhs, lhs ); - } + template ::value>::type> + friend bool operator != ( Approx const& lhs, T const& rhs ) { + return !operator==( rhs, lhs ); + } - template ::value>::type> - friend bool operator <= ( T const& lhs, Approx const& rhs ) { - return static_cast(lhs) < rhs.m_value || lhs == rhs; - } + template ::value>::type> + friend bool operator <= ( T const& lhs, Approx const& rhs ) { + return static_cast(lhs) < rhs.m_value || lhs == rhs; + } - template ::value>::type> - friend bool operator <= ( Approx const& lhs, T const& rhs ) { - return lhs.m_value < static_cast(rhs) || lhs == rhs; - } + template ::value>::type> + friend bool operator <= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value < static_cast(rhs) || lhs == rhs; + } - template ::value>::type> - friend bool operator >= ( T const& lhs, Approx const& rhs ) { - return static_cast(lhs) > rhs.m_value || lhs == rhs; - } + template ::value>::type> + friend bool operator >= ( T const& lhs, Approx const& rhs ) { + return static_cast(lhs) > rhs.m_value || lhs == rhs; + } - template ::value>::type> - friend bool operator >= ( Approx const& lhs, T const& rhs ) { - return lhs.m_value > static_cast(rhs) || lhs == rhs; - } + template ::value>::type> + friend bool operator >= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value > static_cast(rhs) || lhs == rhs; + } - template ::value>::type> - Approx& epsilon( T const& newEpsilon ) { - double epsilonAsDouble = static_cast(newEpsilon); - setEpsilon(epsilonAsDouble); - return *this; - } + template ::value>::type> + Approx& epsilon( T const& newEpsilon ) { + double epsilonAsDouble = static_cast(newEpsilon); + setEpsilon(epsilonAsDouble); + return *this; + } - template ::value>::type> - Approx& margin( T const& newMargin ) { - double marginAsDouble = static_cast(newMargin); - setMargin(marginAsDouble); - return *this; - } + template ::value>::type> + Approx& margin( T const& newMargin ) { + double marginAsDouble = static_cast(newMargin); + setMargin(marginAsDouble); + return *this; + } - template ::value>::type> - Approx& scale( T const& newScale ) { - m_scale = static_cast(newScale); - return *this; - } + template ::value>::type> + Approx& scale( T const& newScale ) { + m_scale = static_cast(newScale); + return *this; + } - std::string toString() const; + std::string toString() const; -private: - double m_epsilon; - double m_margin; - double m_scale; - double m_value; -}; + private: + double m_epsilon; + double m_margin; + double m_scale; + double m_value; + }; } // end namespace Detail namespace literals { -Detail::Approx operator "" _a(long double val); -Detail::Approx operator "" _a(unsigned long long val); + Detail::Approx operator "" _a(long double val); + Detail::Approx operator "" _a(unsigned long long val); } // end namespace literals template<> @@ -3197,30 +3197,30 @@ struct StringMaker { namespace Catch { -bool startsWith( std::string const& s, std::string const& prefix ); -bool startsWith( std::string const& s, char prefix ); -bool endsWith( std::string const& s, std::string const& suffix ); -bool endsWith( std::string const& s, char suffix ); -bool contains( std::string const& s, std::string const& infix ); -void toLowerInPlace( std::string& s ); -std::string toLower( std::string const& s ); -//! Returns a new string without whitespace at the start/end -std::string trim( std::string const& str ); -//! Returns a substring of the original ref without whitespace. Beware lifetimes! -StringRef trim(StringRef ref); - -// !!! Be aware, returns refs into original string - make sure original string outlives them -std::vector splitStringRef( StringRef str, char delimiter ); -bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); - -struct pluralise { - pluralise( std::size_t count, std::string const& label ); - - friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); - - std::size_t m_count; - std::string m_label; -}; + bool startsWith( std::string const& s, std::string const& prefix ); + bool startsWith( std::string const& s, char prefix ); + bool endsWith( std::string const& s, std::string const& suffix ); + bool endsWith( std::string const& s, char suffix ); + bool contains( std::string const& s, std::string const& infix ); + void toLowerInPlace( std::string& s ); + std::string toLower( std::string const& s ); + //! Returns a new string without whitespace at the start/end + std::string trim( std::string const& str ); + //! Returns a substring of the original ref without whitespace. Beware lifetimes! + StringRef trim(StringRef ref); + + // !!! Be aware, returns refs into original string - make sure original string outlives them + std::vector splitStringRef( StringRef str, char delimiter ); + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); + + struct pluralise { + pluralise( std::size_t count, std::string const& label ); + + friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); + + std::size_t m_count; + std::string m_label; + }; } // end catch_string_manip.h @@ -3234,37 +3234,37 @@ struct pluralise { namespace Catch { namespace Matchers { -namespace Impl { + namespace Impl { -template struct MatchAllOf; -template struct MatchAnyOf; -template struct MatchNotOf; + template struct MatchAllOf; + template struct MatchAnyOf; + template struct MatchNotOf; -class MatcherUntypedBase { -public: - MatcherUntypedBase() = default; - MatcherUntypedBase ( MatcherUntypedBase const& ) = default; - MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete; - std::string toString() const; - -protected: - virtual ~MatcherUntypedBase(); - virtual std::string describe() const = 0; - mutable std::string m_cachedToString; -}; + class MatcherUntypedBase { + public: + MatcherUntypedBase() = default; + MatcherUntypedBase ( MatcherUntypedBase const& ) = default; + MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete; + std::string toString() const; + + protected: + virtual ~MatcherUntypedBase(); + virtual std::string describe() const = 0; + mutable std::string m_cachedToString; + }; #ifdef __clang__ # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wnon-virtual-dtor" #endif -template -struct MatcherMethod { - virtual bool match( ObjectT const& arg ) const = 0; -}; + template + struct MatcherMethod { + virtual bool match( ObjectT const& arg ) const = 0; + }; #if defined(__OBJC__) -// Hack to fix Catch GH issue #1661. Could use id for generic Object support. + // Hack to fix Catch GH issue #1661. Could use id for generic Object support. // use of const for Object pointers is very uncommon and under ARC it causes some kind of signature mismatch that breaks compilation template<> struct MatcherMethod { @@ -3276,111 +3276,111 @@ struct MatcherMethod { # pragma clang diagnostic pop #endif -template -struct MatcherBase : MatcherUntypedBase, MatcherMethod { + template + struct MatcherBase : MatcherUntypedBase, MatcherMethod { - MatchAllOf operator && ( MatcherBase const& other ) const; - MatchAnyOf operator || ( MatcherBase const& other ) const; - MatchNotOf operator ! () const; -}; + MatchAllOf operator && ( MatcherBase const& other ) const; + MatchAnyOf operator || ( MatcherBase const& other ) const; + MatchNotOf operator ! () const; + }; -template -struct MatchAllOf : MatcherBase { - bool match( ArgT const& arg ) const override { - for( auto matcher : m_matchers ) { - if (!matcher->match(arg)) - return false; - } - return true; - } - std::string describe() const override { - std::string description; - description.reserve( 4 + m_matchers.size()*32 ); - description += "( "; - bool first = true; - for( auto matcher : m_matchers ) { - if( first ) - first = false; - else - description += " and "; - description += matcher->toString(); - } - description += " )"; - return description; - } + template + struct MatchAllOf : MatcherBase { + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (!matcher->match(arg)) + return false; + } + return true; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " and "; + description += matcher->toString(); + } + description += " )"; + return description; + } - MatchAllOf operator && ( MatcherBase const& other ) { - auto copy(*this); - copy.m_matchers.push_back( &other ); - return copy; - } + MatchAllOf operator && ( MatcherBase const& other ) { + auto copy(*this); + copy.m_matchers.push_back( &other ); + return copy; + } - std::vector const*> m_matchers; -}; -template -struct MatchAnyOf : MatcherBase { + std::vector const*> m_matchers; + }; + template + struct MatchAnyOf : MatcherBase { - bool match( ArgT const& arg ) const override { - for( auto matcher : m_matchers ) { - if (matcher->match(arg)) - return true; - } - return false; - } - std::string describe() const override { - std::string description; - description.reserve( 4 + m_matchers.size()*32 ); - description += "( "; - bool first = true; - for( auto matcher : m_matchers ) { - if( first ) - first = false; - else - description += " or "; - description += matcher->toString(); - } - description += " )"; - return description; - } + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (matcher->match(arg)) + return true; + } + return false; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " or "; + description += matcher->toString(); + } + description += " )"; + return description; + } - MatchAnyOf operator || ( MatcherBase const& other ) { - auto copy(*this); - copy.m_matchers.push_back( &other ); - return copy; - } + MatchAnyOf operator || ( MatcherBase const& other ) { + auto copy(*this); + copy.m_matchers.push_back( &other ); + return copy; + } - std::vector const*> m_matchers; -}; + std::vector const*> m_matchers; + }; -template -struct MatchNotOf : MatcherBase { + template + struct MatchNotOf : MatcherBase { - MatchNotOf( MatcherBase const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} + MatchNotOf( MatcherBase const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} - bool match( ArgT const& arg ) const override { - return !m_underlyingMatcher.match( arg ); - } + bool match( ArgT const& arg ) const override { + return !m_underlyingMatcher.match( arg ); + } - std::string describe() const override { - return "not " + m_underlyingMatcher.toString(); - } - MatcherBase const& m_underlyingMatcher; -}; + std::string describe() const override { + return "not " + m_underlyingMatcher.toString(); + } + MatcherBase const& m_underlyingMatcher; + }; -template -MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const { - return MatchAllOf() && *this && other; -} -template -MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const { - return MatchAnyOf() || *this || other; -} -template -MatchNotOf MatcherBase::operator ! () const { - return MatchNotOf( *this ); -} + template + MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const { + return MatchAllOf() && *this && other; + } + template + MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const { + return MatchAnyOf() || *this || other; + } + template + MatchNotOf MatcherBase::operator ! () const { + return MatchNotOf( *this ); + } -} // namespace Impl + } // namespace Impl } // namespace Matchers @@ -3401,7 +3401,7 @@ class ExceptionMessageMatcher : public MatcherBase { public: ExceptionMessageMatcher(std::string const& message): - m_message(message) + m_message(message) {} bool match(std::exception const& ex) const override; @@ -3422,57 +3422,57 @@ Exception::ExceptionMessageMatcher Message(std::string const& message); namespace Catch { namespace Matchers { -namespace Floating { + namespace Floating { -enum class FloatingPointKind : uint8_t; + enum class FloatingPointKind : uint8_t; -struct WithinAbsMatcher : MatcherBase { - WithinAbsMatcher(double target, double margin); - bool match(double const& matchee) const override; - std::string describe() const override; -private: - double m_target; - double m_margin; -}; + struct WithinAbsMatcher : MatcherBase { + WithinAbsMatcher(double target, double margin); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + double m_margin; + }; -struct WithinUlpsMatcher : MatcherBase { - WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType); - bool match(double const& matchee) const override; - std::string describe() const override; -private: - double m_target; - uint64_t m_ulps; - FloatingPointKind m_type; -}; + struct WithinUlpsMatcher : MatcherBase { + WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + uint64_t m_ulps; + FloatingPointKind m_type; + }; -// Given IEEE-754 format for floats and doubles, we can assume -// that float -> double promotion is lossless. Given this, we can -// assume that if we do the standard relative comparison of -// |lhs - rhs| <= epsilon * max(fabs(lhs), fabs(rhs)), then we get -// the same result if we do this for floats, as if we do this for -// doubles that were promoted from floats. -struct WithinRelMatcher : MatcherBase { - WithinRelMatcher(double target, double epsilon); - bool match(double const& matchee) const override; - std::string describe() const override; -private: - double m_target; - double m_epsilon; -}; + // Given IEEE-754 format for floats and doubles, we can assume + // that float -> double promotion is lossless. Given this, we can + // assume that if we do the standard relative comparison of + // |lhs - rhs| <= epsilon * max(fabs(lhs), fabs(rhs)), then we get + // the same result if we do this for floats, as if we do this for + // doubles that were promoted from floats. + struct WithinRelMatcher : MatcherBase { + WithinRelMatcher(double target, double epsilon); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + double m_epsilon; + }; -} // namespace Floating + } // namespace Floating -// The following functions create the actual matcher objects. -// This allows the types to be inferred -Floating::WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); -Floating::WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); -Floating::WithinAbsMatcher WithinAbs(double target, double margin); -Floating::WithinRelMatcher WithinRel(double target, double eps); -// defaults epsilon to 100*numeric_limits::epsilon() -Floating::WithinRelMatcher WithinRel(double target); -Floating::WithinRelMatcher WithinRel(float target, float eps); -// defaults epsilon to 100*numeric_limits::epsilon() -Floating::WithinRelMatcher WithinRel(float target); + // The following functions create the actual matcher objects. + // This allows the types to be inferred + Floating::WithinUlpsMatcher WithinULP(double target, uint64_t maxUlpDiff); + Floating::WithinUlpsMatcher WithinULP(float target, uint64_t maxUlpDiff); + Floating::WithinAbsMatcher WithinAbs(double target, double margin); + Floating::WithinRelMatcher WithinRel(double target, double eps); + // defaults epsilon to 100*numeric_limits::epsilon() + Floating::WithinRelMatcher WithinRel(double target); + Floating::WithinRelMatcher WithinRel(float target, float eps); + // defaults epsilon to 100*numeric_limits::epsilon() + Floating::WithinRelMatcher WithinRel(float target); } // namespace Matchers } // namespace Catch @@ -3488,7 +3488,7 @@ namespace Matchers { namespace Generic { namespace Detail { -std::string finalizeDescription(const std::string& desc); + std::string finalizeDescription(const std::string& desc); } template @@ -3498,8 +3498,8 @@ class PredicateMatcher : public MatcherBase { public: PredicateMatcher(std::function const& elem, std::string const& descr) - :m_predicate(std::move(elem)), - m_description(Detail::finalizeDescription(descr)) + :m_predicate(std::move(elem)), + m_description(Detail::finalizeDescription(descr)) {} bool match( T const& item ) const override { @@ -3513,14 +3513,14 @@ class PredicateMatcher : public MatcherBase { } // namespace Generic -// The following functions create the actual matcher objects. -// The user has to explicitly specify type to the function, because -// inferring std::function is hard (but possible) and -// requires a lot of TMP. -template -Generic::PredicateMatcher Predicate(std::function const& predicate, std::string const& description = "") { - return Generic::PredicateMatcher(predicate, description); -} + // The following functions create the actual matcher objects. + // The user has to explicitly specify type to the function, because + // inferring std::function is hard (but possible) and + // requires a lot of TMP. + template + Generic::PredicateMatcher Predicate(std::function const& predicate, std::string const& description = "") { + return Generic::PredicateMatcher(predicate, description); + } } // namespace Matchers } // namespace Catch @@ -3533,63 +3533,63 @@ Generic::PredicateMatcher Predicate(std::function const& pred namespace Catch { namespace Matchers { -namespace StdString { + namespace StdString { -struct CasedString -{ - CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ); - std::string adjustString( std::string const& str ) const; - std::string caseSensitivitySuffix() const; + struct CasedString + { + CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ); + std::string adjustString( std::string const& str ) const; + std::string caseSensitivitySuffix() const; - CaseSensitive::Choice m_caseSensitivity; - std::string m_str; -}; + CaseSensitive::Choice m_caseSensitivity; + std::string m_str; + }; -struct StringMatcherBase : MatcherBase { - StringMatcherBase( std::string const& operation, CasedString const& comparator ); - std::string describe() const override; + struct StringMatcherBase : MatcherBase { + StringMatcherBase( std::string const& operation, CasedString const& comparator ); + std::string describe() const override; - CasedString m_comparator; - std::string m_operation; -}; + CasedString m_comparator; + std::string m_operation; + }; -struct EqualsMatcher : StringMatcherBase { - EqualsMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; -}; -struct ContainsMatcher : StringMatcherBase { - ContainsMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; -}; -struct StartsWithMatcher : StringMatcherBase { - StartsWithMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; -}; -struct EndsWithMatcher : StringMatcherBase { - EndsWithMatcher( CasedString const& comparator ); - bool match( std::string const& source ) const override; -}; + struct EqualsMatcher : StringMatcherBase { + EqualsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct ContainsMatcher : StringMatcherBase { + ContainsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StartsWithMatcher : StringMatcherBase { + StartsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct EndsWithMatcher : StringMatcherBase { + EndsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; -struct RegexMatcher : MatcherBase { - RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity ); - bool match( std::string const& matchee ) const override; - std::string describe() const override; + struct RegexMatcher : MatcherBase { + RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity ); + bool match( std::string const& matchee ) const override; + std::string describe() const override; -private: - std::string m_regex; - CaseSensitive::Choice m_caseSensitivity; -}; + private: + std::string m_regex; + CaseSensitive::Choice m_caseSensitivity; + }; -} // namespace StdString + } // namespace StdString -// The following functions create the actual matcher objects. -// This allows the types to be inferred + // The following functions create the actual matcher objects. + // This allows the types to be inferred -StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); -StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); -StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); -StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); -StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); } // namespace Matchers } // namespace Catch @@ -3602,163 +3602,163 @@ StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice namespace Catch { namespace Matchers { -namespace Vector { -template -struct ContainsElementMatcher : MatcherBase> { + namespace Vector { + template + struct ContainsElementMatcher : MatcherBase> { + + ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} + + bool match(std::vector const &v) const override { + for (auto const& el : v) { + if (el == m_comparator) { + return true; + } + } + return false; + } + + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } + + T const& m_comparator; + }; + + template + struct ContainsMatcher : MatcherBase> { - ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} + ContainsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} - bool match(std::vector const &v) const override { - for (auto const& el : v) { - if (el == m_comparator) { + bool match(std::vector const &v) const override { + // !TBD: see note in EqualsMatcher + if (m_comparator.size() > v.size()) + return false; + for (auto const& comparator : m_comparator) { + auto present = false; + for (const auto& el : v) { + if (el == comparator) { + present = true; + break; + } + } + if (!present) { + return false; + } + } return true; } - } - return false; - } + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } - std::string describe() const override { - return "Contains: " + ::Catch::Detail::stringify( m_comparator ); - } + std::vector const& m_comparator; + }; - T const& m_comparator; -}; + template + struct EqualsMatcher : MatcherBase> { + + EqualsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} + + bool match(std::vector const &v) const override { + // !TBD: This currently works if all elements can be compared using != + // - a more general approach would be via a compare template that defaults + // to using !=. but could be specialised for, e.g. std::vector etc + // - then just call that directly + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != v[i]) + return false; + return true; + } + std::string describe() const override { + return "Equals: " + ::Catch::Detail::stringify( m_comparator ); + } + std::vector const& m_comparator; + }; -template -struct ContainsMatcher : MatcherBase> { + template + struct ApproxMatcher : MatcherBase> { - ContainsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} + ApproxMatcher(std::vector const& comparator) : m_comparator( comparator ) {} - bool match(std::vector const &v) const override { - // !TBD: see note in EqualsMatcher - if (m_comparator.size() > v.size()) - return false; - for (auto const& comparator : m_comparator) { - auto present = false; - for (const auto& el : v) { - if (el == comparator) { - present = true; - break; + bool match(std::vector const &v) const override { + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != approx(v[i])) + return false; + return true; + } + std::string describe() const override { + return "is approx: " + ::Catch::Detail::stringify( m_comparator ); + } + template ::value>::type> + ApproxMatcher& epsilon( T const& newEpsilon ) { + approx.epsilon(newEpsilon); + return *this; + } + template ::value>::type> + ApproxMatcher& margin( T const& newMargin ) { + approx.margin(newMargin); + return *this; + } + template ::value>::type> + ApproxMatcher& scale( T const& newScale ) { + approx.scale(newScale); + return *this; + } + + std::vector const& m_comparator; + mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom(); + }; + + template + struct UnorderedEqualsMatcher : MatcherBase> { + UnorderedEqualsMatcher(std::vector const& target) : m_target(target) {} + bool match(std::vector const& vec) const override { + if (m_target.size() != vec.size()) { + return false; } + return std::is_permutation(m_target.begin(), m_target.end(), vec.begin()); } - if (!present) { - return false; + + std::string describe() const override { + return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); } - } - return true; - } - std::string describe() const override { - return "Contains: " + ::Catch::Detail::stringify( m_comparator ); - } + private: + std::vector const& m_target; + }; - std::vector const& m_comparator; -}; + } // namespace Vector -template -struct EqualsMatcher : MatcherBase> { + // The following functions create the actual matcher objects. + // This allows the types to be inferred - EqualsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} + template, typename AllocMatch = AllocComp> + Vector::ContainsMatcher Contains( std::vector const& comparator ) { + return Vector::ContainsMatcher( comparator ); + } - bool match(std::vector const &v) const override { - // !TBD: This currently works if all elements can be compared using != - // - a more general approach would be via a compare template that defaults - // to using !=. but could be specialised for, e.g. std::vector etc - // - then just call that directly - if (m_comparator.size() != v.size()) - return false; - for (std::size_t i = 0; i < v.size(); ++i) - if (m_comparator[i] != v[i]) - return false; - return true; + template> + Vector::ContainsElementMatcher VectorContains( T const& comparator ) { + return Vector::ContainsElementMatcher( comparator ); } - std::string describe() const override { - return "Equals: " + ::Catch::Detail::stringify( m_comparator ); + + template, typename AllocMatch = AllocComp> + Vector::EqualsMatcher Equals( std::vector const& comparator ) { + return Vector::EqualsMatcher( comparator ); } - std::vector const& m_comparator; -}; -template -struct ApproxMatcher : MatcherBase> { + template, typename AllocMatch = AllocComp> + Vector::ApproxMatcher Approx( std::vector const& comparator ) { + return Vector::ApproxMatcher( comparator ); + } - ApproxMatcher(std::vector const& comparator) : m_comparator( comparator ) {} - - bool match(std::vector const &v) const override { - if (m_comparator.size() != v.size()) - return false; - for (std::size_t i = 0; i < v.size(); ++i) - if (m_comparator[i] != approx(v[i])) - return false; - return true; - } - std::string describe() const override { - return "is approx: " + ::Catch::Detail::stringify( m_comparator ); - } - template ::value>::type> - ApproxMatcher& epsilon( T const& newEpsilon ) { - approx.epsilon(newEpsilon); - return *this; - } - template ::value>::type> - ApproxMatcher& margin( T const& newMargin ) { - approx.margin(newMargin); - return *this; - } - template ::value>::type> - ApproxMatcher& scale( T const& newScale ) { - approx.scale(newScale); - return *this; - } - - std::vector const& m_comparator; - mutable Catch::Detail::Approx approx = Catch::Detail::Approx::custom(); -}; - -template -struct UnorderedEqualsMatcher : MatcherBase> { - UnorderedEqualsMatcher(std::vector const& target) : m_target(target) {} - bool match(std::vector const& vec) const override { - if (m_target.size() != vec.size()) { - return false; - } - return std::is_permutation(m_target.begin(), m_target.end(), vec.begin()); - } - - std::string describe() const override { - return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); - } -private: - std::vector const& m_target; -}; - -} // namespace Vector - -// The following functions create the actual matcher objects. -// This allows the types to be inferred - -template, typename AllocMatch = AllocComp> -Vector::ContainsMatcher Contains( std::vector const& comparator ) { - return Vector::ContainsMatcher( comparator ); -} - -template> -Vector::ContainsElementMatcher VectorContains( T const& comparator ) { - return Vector::ContainsElementMatcher( comparator ); -} - -template, typename AllocMatch = AllocComp> -Vector::EqualsMatcher Equals( std::vector const& comparator ) { - return Vector::EqualsMatcher( comparator ); -} - -template, typename AllocMatch = AllocComp> -Vector::ApproxMatcher Approx( std::vector const& comparator ) { - return Vector::ApproxMatcher( comparator ); -} - -template, typename AllocMatch = AllocComp> -Vector::UnorderedEqualsMatcher UnorderedEquals(std::vector const& target) { - return Vector::UnorderedEqualsMatcher( target ); -} + template, typename AllocMatch = AllocComp> + Vector::UnorderedEqualsMatcher UnorderedEquals(std::vector const& target) { + return Vector::UnorderedEqualsMatcher( target ); + } } // namespace Matchers } // namespace Catch @@ -3766,37 +3766,37 @@ Vector::UnorderedEqualsMatcher UnorderedEquals(std::ve // end catch_matchers_vector.h namespace Catch { -template -class MatchExpr : public ITransientExpression { - ArgT const& m_arg; - MatcherT m_matcher; - StringRef m_matcherString; -public: - MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) - : ITransientExpression{ true, matcher.match( arg ) }, - m_arg( arg ), - m_matcher( matcher ), - m_matcherString( matcherString ) - {} + template + class MatchExpr : public ITransientExpression { + ArgT const& m_arg; + MatcherT m_matcher; + StringRef m_matcherString; + public: + MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) + : ITransientExpression{ true, matcher.match( arg ) }, + m_arg( arg ), + m_matcher( matcher ), + m_matcherString( matcherString ) + {} - void streamReconstructedExpression( std::ostream &os ) const override { - auto matcherAsString = m_matcher.toString(); - os << Catch::Detail::stringify( m_arg ) << ' '; - if( matcherAsString == Detail::unprintableString ) - os << m_matcherString; - else - os << matcherAsString; - } -}; + void streamReconstructedExpression( std::ostream &os ) const override { + auto matcherAsString = m_matcher.toString(); + os << Catch::Detail::stringify( m_arg ) << ' '; + if( matcherAsString == Detail::unprintableString ) + os << m_matcherString; + else + os << matcherAsString; + } + }; -using StringMatcher = Matchers::Impl::MatcherBase; + using StringMatcher = Matchers::Impl::MatcherBase; -void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); -template -auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr { - return MatchExpr( arg, matcher, matcherString ); -} + template + auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr { + return MatchExpr( arg, matcher, matcherString ); + } } // namespace Catch @@ -3841,27 +3841,27 @@ auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& m namespace Catch { -namespace Generators { -class GeneratorUntypedBase { -public: - GeneratorUntypedBase() = default; - virtual ~GeneratorUntypedBase(); - // Attempts to move the generator to the next element - // - // Returns true iff the move succeeded (and a valid element - // can be retrieved). - virtual bool next() = 0; -}; -using GeneratorBasePtr = std::unique_ptr; + namespace Generators { + class GeneratorUntypedBase { + public: + GeneratorUntypedBase() = default; + virtual ~GeneratorUntypedBase(); + // Attempts to move the generator to the next element + // + // Returns true iff the move succeeded (and a valid element + // can be retrieved). + virtual bool next() = 0; + }; + using GeneratorBasePtr = std::unique_ptr; -} // namespace Generators + } // namespace Generators -struct IGeneratorTracker { - virtual ~IGeneratorTracker(); - virtual auto hasGenerator() const -> bool = 0; - virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; - virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; -}; + struct IGeneratorTracker { + virtual ~IGeneratorTracker(); + virtual auto hasGenerator() const -> bool = 0; + virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; + virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; + }; } // namespace Catch @@ -3872,22 +3872,22 @@ struct IGeneratorTracker { namespace Catch { #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -template -[[noreturn]] -void throw_exception(Ex const& e) { - throw e; -} + template + [[noreturn]] + void throw_exception(Ex const& e) { + throw e; + } #else // ^^ Exceptions are enabled // Exceptions are disabled vv -[[noreturn]] + [[noreturn]] void throw_exception(std::exception const& e); #endif -[[noreturn]] -void throw_logic_error(std::string const& msg); -[[noreturn]] -void throw_domain_error(std::string const& msg); -[[noreturn]] -void throw_runtime_error(std::string const& msg); + [[noreturn]] + void throw_logic_error(std::string const& msg); + [[noreturn]] + void throw_domain_error(std::string const& msg); + [[noreturn]] + void throw_runtime_error(std::string const& msg); } // namespace Catch; @@ -3921,7 +3921,7 @@ class GeneratorException : public std::exception { public: GeneratorException(const char* msg): - m_msg(msg) + m_msg(msg) {} const char* what() const noexcept override final; @@ -3929,171 +3929,171 @@ class GeneratorException : public std::exception { namespace Generators { -// !TBD move this into its own location? -namespace pf{ -template -std::unique_ptr make_unique( Args&&... args ) { - return std::unique_ptr(new T(std::forward(args)...)); -} -} + // !TBD move this into its own location? + namespace pf{ + template + std::unique_ptr make_unique( Args&&... args ) { + return std::unique_ptr(new T(std::forward(args)...)); + } + } -template -struct IGenerator : GeneratorUntypedBase { - virtual ~IGenerator() = default; + template + struct IGenerator : GeneratorUntypedBase { + virtual ~IGenerator() = default; - // Returns the current element of the generator - // - // \Precondition The generator is either freshly constructed, - // or the last call to `next()` returned true - virtual T const& get() const = 0; - using type = T; -}; + // Returns the current element of the generator + // + // \Precondition The generator is either freshly constructed, + // or the last call to `next()` returned true + virtual T const& get() const = 0; + using type = T; + }; -template -class SingleValueGenerator final : public IGenerator { - T m_value; -public: - SingleValueGenerator(T&& value) : m_value(std::move(value)) {} + template + class SingleValueGenerator final : public IGenerator { + T m_value; + public: + SingleValueGenerator(T&& value) : m_value(std::move(value)) {} - T const& get() const override { - return m_value; - } - bool next() override { - return false; - } -}; + T const& get() const override { + return m_value; + } + bool next() override { + return false; + } + }; -template -class FixedValuesGenerator final : public IGenerator { - static_assert(!std::is_same::value, - "FixedValuesGenerator does not support bools because of std::vector" - "specialization, use SingleValue Generator instead."); - std::vector m_values; - size_t m_idx = 0; -public: - FixedValuesGenerator( std::initializer_list values ) : m_values( values ) {} + template + class FixedValuesGenerator final : public IGenerator { + static_assert(!std::is_same::value, + "FixedValuesGenerator does not support bools because of std::vector" + "specialization, use SingleValue Generator instead."); + std::vector m_values; + size_t m_idx = 0; + public: + FixedValuesGenerator( std::initializer_list values ) : m_values( values ) {} - T const& get() const override { - return m_values[m_idx]; - } - bool next() override { - ++m_idx; - return m_idx < m_values.size(); - } -}; + T const& get() const override { + return m_values[m_idx]; + } + bool next() override { + ++m_idx; + return m_idx < m_values.size(); + } + }; -template -class GeneratorWrapper final { - std::unique_ptr> m_generator; -public: - GeneratorWrapper(std::unique_ptr> generator): + template + class GeneratorWrapper final { + std::unique_ptr> m_generator; + public: + GeneratorWrapper(std::unique_ptr> generator): m_generator(std::move(generator)) - {} - T const& get() const { - return m_generator->get(); - } - bool next() { - return m_generator->next(); - } -}; - -template -GeneratorWrapper value(T&& value) { - return GeneratorWrapper(pf::make_unique>(std::forward(value))); -} -template -GeneratorWrapper values(std::initializer_list values) { - return GeneratorWrapper(pf::make_unique>(values)); -} - -template -class Generators : public IGenerator { - std::vector> m_generators; - size_t m_current = 0; + {} + T const& get() const { + return m_generator->get(); + } + bool next() { + return m_generator->next(); + } + }; - void populate(GeneratorWrapper&& generator) { - m_generators.emplace_back(std::move(generator)); - } - void populate(T&& val) { - m_generators.emplace_back(value(std::forward(val))); - } - template - void populate(U&& val) { - populate(T(std::forward(val))); + template + GeneratorWrapper value(T&& value) { + return GeneratorWrapper(pf::make_unique>(std::forward(value))); } - template - void populate(U&& valueOrGenerator, Gs &&... moreGenerators) { - populate(std::forward(valueOrGenerator)); - populate(std::forward(moreGenerators)...); + template + GeneratorWrapper values(std::initializer_list values) { + return GeneratorWrapper(pf::make_unique>(values)); } -public: - template - Generators(Gs &&... moreGenerators) { - m_generators.reserve(sizeof...(Gs)); - populate(std::forward(moreGenerators)...); - } + template + class Generators : public IGenerator { + std::vector> m_generators; + size_t m_current = 0; - T const& get() const override { - return m_generators[m_current].get(); - } + void populate(GeneratorWrapper&& generator) { + m_generators.emplace_back(std::move(generator)); + } + void populate(T&& val) { + m_generators.emplace_back(value(std::forward(val))); + } + template + void populate(U&& val) { + populate(T(std::forward(val))); + } + template + void populate(U&& valueOrGenerator, Gs &&... moreGenerators) { + populate(std::forward(valueOrGenerator)); + populate(std::forward(moreGenerators)...); + } - bool next() override { - if (m_current >= m_generators.size()) { - return false; + public: + template + Generators(Gs &&... moreGenerators) { + m_generators.reserve(sizeof...(Gs)); + populate(std::forward(moreGenerators)...); } - const bool current_status = m_generators[m_current].next(); - if (!current_status) { - ++m_current; + + T const& get() const override { + return m_generators[m_current].get(); + } + + bool next() override { + if (m_current >= m_generators.size()) { + return false; + } + const bool current_status = m_generators[m_current].next(); + if (!current_status) { + ++m_current; + } + return m_current < m_generators.size(); } - return m_current < m_generators.size(); + }; + + template + GeneratorWrapper> table( std::initializer_list::type...>> tuples ) { + return values>( tuples ); } -}; -template -GeneratorWrapper> table( std::initializer_list::type...>> tuples ) { - return values>( tuples ); -} + // Tag type to signal that a generator sequence should convert arguments to a specific type + template + struct as {}; -// Tag type to signal that a generator sequence should convert arguments to a specific type -template -struct as {}; + template + auto makeGenerators( GeneratorWrapper&& generator, Gs &&... moreGenerators ) -> Generators { + return Generators(std::move(generator), std::forward(moreGenerators)...); + } + template + auto makeGenerators( GeneratorWrapper&& generator ) -> Generators { + return Generators(std::move(generator)); + } + template + auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators { + return makeGenerators( value( std::forward( val ) ), std::forward( moreGenerators )... ); + } + template + auto makeGenerators( as, U&& val, Gs &&... moreGenerators ) -> Generators { + return makeGenerators( value( T( std::forward( val ) ) ), std::forward( moreGenerators )... ); + } -template -auto makeGenerators( GeneratorWrapper&& generator, Gs &&... moreGenerators ) -> Generators { - return Generators(std::move(generator), std::forward(moreGenerators)...); -} -template -auto makeGenerators( GeneratorWrapper&& generator ) -> Generators { - return Generators(std::move(generator)); -} -template -auto makeGenerators( T&& val, Gs &&... moreGenerators ) -> Generators { - return makeGenerators( value( std::forward( val ) ), std::forward( moreGenerators )... ); -} -template -auto makeGenerators( as, U&& val, Gs &&... moreGenerators ) -> Generators { - return makeGenerators( value( T( std::forward( val ) ) ), std::forward( moreGenerators )... ); -} + auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; -auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; + template + // Note: The type after -> is weird, because VS2015 cannot parse + // the expression used in the typedef inside, when it is in + // return type. Yeah. + auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval().get()) { + using UnderlyingType = typename decltype(generatorExpression())::type; -template -// Note: The type after -> is weird, because VS2015 cannot parse -// the expression used in the typedef inside, when it is in -// return type. Yeah. -auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval().get()) { - using UnderlyingType = typename decltype(generatorExpression())::type; + IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo ); + if (!tracker.hasGenerator()) { + tracker.setGenerator(pf::make_unique>(generatorExpression())); + } - IGeneratorTracker& tracker = acquireGeneratorTracker( generatorName, lineInfo ); - if (!tracker.hasGenerator()) { - tracker.setGenerator(pf::make_unique>(generatorExpression())); + auto const& generator = static_cast const&>( *tracker.getGenerator() ); + return generator.get(); } - auto const& generator = static_cast const&>( *tracker.getGenerator() ); - return generator.get(); -} - } // namespace Generators } // namespace Catch @@ -4116,225 +4116,225 @@ auto generate( StringRef generatorName, SourceLineInfo const& lineInfo, L const& namespace Catch { namespace Generators { -template -class TakeGenerator : public IGenerator { - GeneratorWrapper m_generator; - size_t m_returned = 0; - size_t m_target; -public: - TakeGenerator(size_t target, GeneratorWrapper&& generator): + template + class TakeGenerator : public IGenerator { + GeneratorWrapper m_generator; + size_t m_returned = 0; + size_t m_target; + public: + TakeGenerator(size_t target, GeneratorWrapper&& generator): m_generator(std::move(generator)), m_target(target) - { - assert(target != 0 && "Empty generators are not allowed"); - } - T const& get() const override { - return m_generator.get(); - } - bool next() override { - ++m_returned; - if (m_returned >= m_target) { - return false; + { + assert(target != 0 && "Empty generators are not allowed"); } + T const& get() const override { + return m_generator.get(); + } + bool next() override { + ++m_returned; + if (m_returned >= m_target) { + return false; + } - const auto success = m_generator.next(); - // If the underlying generator does not contain enough values - // then we cut short as well - if (!success) { - m_returned = m_target; + const auto success = m_generator.next(); + // If the underlying generator does not contain enough values + // then we cut short as well + if (!success) { + m_returned = m_target; + } + return success; } - return success; - } -}; + }; -template -GeneratorWrapper take(size_t target, GeneratorWrapper&& generator) { - return GeneratorWrapper(pf::make_unique>(target, std::move(generator))); -} + template + GeneratorWrapper take(size_t target, GeneratorWrapper&& generator) { + return GeneratorWrapper(pf::make_unique>(target, std::move(generator))); + } -template -class FilterGenerator : public IGenerator { - GeneratorWrapper m_generator; - Predicate m_predicate; -public: - template - FilterGenerator(P&& pred, GeneratorWrapper&& generator): + template + class FilterGenerator : public IGenerator { + GeneratorWrapper m_generator; + Predicate m_predicate; + public: + template + FilterGenerator(P&& pred, GeneratorWrapper&& generator): m_generator(std::move(generator)), m_predicate(std::forward

(pred)) - { - if (!m_predicate(m_generator.get())) { - // It might happen that there are no values that pass the - // filter. In that case we throw an exception. - auto has_initial_value = nextImpl(); - if (!has_initial_value) { - Catch::throw_exception(GeneratorException("No valid value found in filtered generator")); + { + if (!m_predicate(m_generator.get())) { + // It might happen that there are no values that pass the + // filter. In that case we throw an exception. + auto has_initial_value = nextImpl(); + if (!has_initial_value) { + Catch::throw_exception(GeneratorException("No valid value found in filtered generator")); + } } } - } - T const& get() const override { - return m_generator.get(); - } - - bool next() override { - return nextImpl(); - } + T const& get() const override { + return m_generator.get(); + } -private: - bool nextImpl() { - bool success = m_generator.next(); - if (!success) { - return false; + bool next() override { + return nextImpl(); } - while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true); - return success; - } -}; -template -GeneratorWrapper filter(Predicate&& pred, GeneratorWrapper&& generator) { - return GeneratorWrapper(std::unique_ptr>(pf::make_unique>(std::forward(pred), std::move(generator)))); -} + private: + bool nextImpl() { + bool success = m_generator.next(); + if (!success) { + return false; + } + while (!m_predicate(m_generator.get()) && (success = m_generator.next()) == true); + return success; + } + }; -template -class RepeatGenerator : public IGenerator { - static_assert(!std::is_same::value, - "RepeatGenerator currently does not support bools" - "because of std::vector specialization"); - GeneratorWrapper m_generator; - mutable std::vector m_returned; - size_t m_target_repeats; - size_t m_current_repeat = 0; - size_t m_repeat_index = 0; -public: - RepeatGenerator(size_t repeats, GeneratorWrapper&& generator): + template + GeneratorWrapper filter(Predicate&& pred, GeneratorWrapper&& generator) { + return GeneratorWrapper(std::unique_ptr>(pf::make_unique>(std::forward(pred), std::move(generator)))); + } + + template + class RepeatGenerator : public IGenerator { + static_assert(!std::is_same::value, + "RepeatGenerator currently does not support bools" + "because of std::vector specialization"); + GeneratorWrapper m_generator; + mutable std::vector m_returned; + size_t m_target_repeats; + size_t m_current_repeat = 0; + size_t m_repeat_index = 0; + public: + RepeatGenerator(size_t repeats, GeneratorWrapper&& generator): m_generator(std::move(generator)), m_target_repeats(repeats) - { - assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); - } + { + assert(m_target_repeats > 0 && "Repeat generator must repeat at least once"); + } - T const& get() const override { - if (m_current_repeat == 0) { - m_returned.push_back(m_generator.get()); - return m_returned.back(); + T const& get() const override { + if (m_current_repeat == 0) { + m_returned.push_back(m_generator.get()); + return m_returned.back(); + } + return m_returned[m_repeat_index]; } - return m_returned[m_repeat_index]; - } - bool next() override { - // There are 2 basic cases: - // 1) We are still reading the generator - // 2) We are reading our own cache + bool next() override { + // There are 2 basic cases: + // 1) We are still reading the generator + // 2) We are reading our own cache + + // In the first case, we need to poke the underlying generator. + // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache + if (m_current_repeat == 0) { + const auto success = m_generator.next(); + if (!success) { + ++m_current_repeat; + } + return m_current_repeat < m_target_repeats; + } - // In the first case, we need to poke the underlying generator. - // If it happily moves, we are left in that state, otherwise it is time to start reading from our cache - if (m_current_repeat == 0) { - const auto success = m_generator.next(); - if (!success) { + // In the second case, we need to move indices forward and check that we haven't run up against the end + ++m_repeat_index; + if (m_repeat_index == m_returned.size()) { + m_repeat_index = 0; ++m_current_repeat; } return m_current_repeat < m_target_repeats; } + }; - // In the second case, we need to move indices forward and check that we haven't run up against the end - ++m_repeat_index; - if (m_repeat_index == m_returned.size()) { - m_repeat_index = 0; - ++m_current_repeat; - } - return m_current_repeat < m_target_repeats; + template + GeneratorWrapper repeat(size_t repeats, GeneratorWrapper&& generator) { + return GeneratorWrapper(pf::make_unique>(repeats, std::move(generator))); } -}; -template -GeneratorWrapper repeat(size_t repeats, GeneratorWrapper&& generator) { - return GeneratorWrapper(pf::make_unique>(repeats, std::move(generator))); -} - -template -class MapGenerator : public IGenerator { - // TBD: provide static assert for mapping function, for friendly error message - GeneratorWrapper m_generator; - Func m_function; - // To avoid returning dangling reference, we have to save the values - T m_cache; -public: - template - MapGenerator(F2&& function, GeneratorWrapper&& generator) : + template + class MapGenerator : public IGenerator { + // TBD: provide static assert for mapping function, for friendly error message + GeneratorWrapper m_generator; + Func m_function; + // To avoid returning dangling reference, we have to save the values + T m_cache; + public: + template + MapGenerator(F2&& function, GeneratorWrapper&& generator) : m_generator(std::move(generator)), m_function(std::forward(function)), m_cache(m_function(m_generator.get())) - {} + {} - T const& get() const override { - return m_cache; - } - bool next() override { - const auto success = m_generator.next(); - if (success) { - m_cache = m_function(m_generator.get()); + T const& get() const override { + return m_cache; } - return success; - } -}; + bool next() override { + const auto success = m_generator.next(); + if (success) { + m_cache = m_function(m_generator.get()); + } + return success; + } + }; -template > -GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { - return GeneratorWrapper( + template > + GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { + return GeneratorWrapper( pf::make_unique>(std::forward(function), std::move(generator)) - ); -} + ); + } -template -GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { - return GeneratorWrapper( + template + GeneratorWrapper map(Func&& function, GeneratorWrapper&& generator) { + return GeneratorWrapper( pf::make_unique>(std::forward(function), std::move(generator)) - ); -} + ); + } -template -class ChunkGenerator final : public IGenerator> { - std::vector m_chunk; - size_t m_chunk_size; - GeneratorWrapper m_generator; - bool m_used_up = false; -public: - ChunkGenerator(size_t size, GeneratorWrapper generator) : + template + class ChunkGenerator final : public IGenerator> { + std::vector m_chunk; + size_t m_chunk_size; + GeneratorWrapper m_generator; + bool m_used_up = false; + public: + ChunkGenerator(size_t size, GeneratorWrapper generator) : m_chunk_size(size), m_generator(std::move(generator)) - { - m_chunk.reserve(m_chunk_size); - if (m_chunk_size != 0) { - m_chunk.push_back(m_generator.get()); - for (size_t i = 1; i < m_chunk_size; ++i) { + { + m_chunk.reserve(m_chunk_size); + if (m_chunk_size != 0) { + m_chunk.push_back(m_generator.get()); + for (size_t i = 1; i < m_chunk_size; ++i) { + if (!m_generator.next()) { + Catch::throw_exception(GeneratorException("Not enough values to initialize the first chunk")); + } + m_chunk.push_back(m_generator.get()); + } + } + } + std::vector const& get() const override { + return m_chunk; + } + bool next() override { + m_chunk.clear(); + for (size_t idx = 0; idx < m_chunk_size; ++idx) { if (!m_generator.next()) { - Catch::throw_exception(GeneratorException("Not enough values to initialize the first chunk")); + return false; } m_chunk.push_back(m_generator.get()); } + return true; } + }; + + template + GeneratorWrapper> chunk(size_t size, GeneratorWrapper&& generator) { + return GeneratorWrapper>( + pf::make_unique>(size, std::move(generator)) + ); } - std::vector const& get() const override { - return m_chunk; - } - bool next() override { - m_chunk.clear(); - for (size_t idx = 0; idx < m_chunk_size; ++idx) { - if (!m_generator.next()) { - return false; - } - m_chunk.push_back(m_generator.get()); - } - return true; - } -}; - -template -GeneratorWrapper> chunk(size_t size, GeneratorWrapper&& generator) { - return GeneratorWrapper>( - pf::make_unique>(size, std::move(generator)) - ); -} } // namespace Generators } // namespace Catch @@ -4348,53 +4348,53 @@ GeneratorWrapper> chunk(size_t size, GeneratorWrapper&& genera namespace Catch { -struct IResultCapture; -struct IRunner; -struct IConfig; -struct IMutableContext; + struct IResultCapture; + struct IRunner; + struct IConfig; + struct IMutableContext; -using IConfigPtr = std::shared_ptr; + using IConfigPtr = std::shared_ptr; -struct IContext -{ - virtual ~IContext(); + struct IContext + { + virtual ~IContext(); - virtual IResultCapture* getResultCapture() = 0; - virtual IRunner* getRunner() = 0; - virtual IConfigPtr const& getConfig() const = 0; -}; + virtual IResultCapture* getResultCapture() = 0; + virtual IRunner* getRunner() = 0; + virtual IConfigPtr const& getConfig() const = 0; + }; -struct IMutableContext : IContext -{ - virtual ~IMutableContext(); - virtual void setResultCapture( IResultCapture* resultCapture ) = 0; - virtual void setRunner( IRunner* runner ) = 0; - virtual void setConfig( IConfigPtr const& config ) = 0; + struct IMutableContext : IContext + { + virtual ~IMutableContext(); + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setRunner( IRunner* runner ) = 0; + virtual void setConfig( IConfigPtr const& config ) = 0; -private: - static IMutableContext *currentContext; - friend IMutableContext& getCurrentMutableContext(); - friend void cleanUpContext(); - static void createContext(); -}; + private: + static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); + }; -inline IMutableContext& getCurrentMutableContext() -{ - if( !IMutableContext::currentContext ) - IMutableContext::createContext(); - // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) - return *IMutableContext::currentContext; -} + inline IMutableContext& getCurrentMutableContext() + { + if( !IMutableContext::currentContext ) + IMutableContext::createContext(); + // NOLINTNEXTLINE(clang-analyzer-core.uninitialized.UndefReturn) + return *IMutableContext::currentContext; + } -inline IContext& getCurrentContext() -{ - return getCurrentMutableContext(); -} + inline IContext& getCurrentContext() + { + return getCurrentMutableContext(); + } -void cleanUpContext(); + void cleanUpContext(); -class SimplePcg32; -SimplePcg32& rng(); + class SimplePcg32; + SimplePcg32& rng(); } // end catch_context.h @@ -4404,63 +4404,63 @@ SimplePcg32& rng(); namespace Catch { -// An optional type -template -class Option { -public: - Option() : nullableValue( nullptr ) {} - Option( T const& _value ) - : nullableValue( new( storage ) T( _value ) ) - {} - Option( Option const& _other ) - : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) - {} + // An optional type + template + class Option { + public: + Option() : nullableValue( nullptr ) {} + Option( T const& _value ) + : nullableValue( new( storage ) T( _value ) ) + {} + Option( Option const& _other ) + : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) + {} - ~Option() { - reset(); - } + ~Option() { + reset(); + } - Option& operator= ( Option const& _other ) { - if( &_other != this ) { + Option& operator= ( Option const& _other ) { + if( &_other != this ) { + reset(); + if( _other ) + nullableValue = new( storage ) T( *_other ); + } + return *this; + } + Option& operator = ( T const& _value ) { reset(); - if( _other ) - nullableValue = new( storage ) T( *_other ); + nullableValue = new( storage ) T( _value ); + return *this; } - return *this; - } - Option& operator = ( T const& _value ) { - reset(); - nullableValue = new( storage ) T( _value ); - return *this; - } - void reset() { - if( nullableValue ) - nullableValue->~T(); - nullableValue = nullptr; - } + void reset() { + if( nullableValue ) + nullableValue->~T(); + nullableValue = nullptr; + } - T& operator*() { return *nullableValue; } - T const& operator*() const { return *nullableValue; } - T* operator->() { return nullableValue; } - const T* operator->() const { return nullableValue; } + T& operator*() { return *nullableValue; } + T const& operator*() const { return *nullableValue; } + T* operator->() { return nullableValue; } + const T* operator->() const { return nullableValue; } - T valueOr( T const& defaultValue ) const { - return nullableValue ? *nullableValue : defaultValue; - } + T valueOr( T const& defaultValue ) const { + return nullableValue ? *nullableValue : defaultValue; + } - bool some() const { return nullableValue != nullptr; } - bool none() const { return nullableValue == nullptr; } + bool some() const { return nullableValue != nullptr; } + bool none() const { return nullableValue == nullptr; } - bool operator !() const { return nullableValue == nullptr; } - explicit operator bool() const { - return some(); - } + bool operator !() const { return nullableValue == nullptr; } + explicit operator bool() const { + return some(); + } -private: - T *nullableValue; - alignas(alignof(T)) char storage[sizeof(T)]; -}; + private: + T *nullableValue; + alignas(alignof(T)) char storage[sizeof(T)]; + }; } // end namespace Catch @@ -4473,74 +4473,74 @@ class Option { namespace Catch { -enum class Verbosity { - Quiet = 0, - Normal, - High -}; + enum class Verbosity { + Quiet = 0, + Normal, + High + }; -struct WarnAbout { enum What { + struct WarnAbout { enum What { Nothing = 0x00, NoAssertions = 0x01, NoTests = 0x02 }; }; -struct ShowDurations { enum OrNot { + struct ShowDurations { enum OrNot { DefaultForReporter, Always, Never }; }; -struct RunTests { enum InWhatOrder { + struct RunTests { enum InWhatOrder { InDeclarationOrder, InLexicographicalOrder, InRandomOrder }; }; -struct UseColour { enum YesOrNo { + struct UseColour { enum YesOrNo { Auto, Yes, No }; }; -struct WaitForKeypress { enum When { + struct WaitForKeypress { enum When { Never, BeforeStart = 1, BeforeExit = 2, BeforeStartAndExit = BeforeStart | BeforeExit }; }; -class TestSpec; - -struct IConfig : NonCopyable { - - virtual ~IConfig(); - - virtual bool allowThrows() const = 0; - virtual std::ostream& stream() const = 0; - virtual std::string name() const = 0; - virtual bool includeSuccessfulResults() const = 0; - virtual bool shouldDebugBreak() const = 0; - virtual bool warnAboutMissingAssertions() const = 0; - virtual bool warnAboutNoTests() const = 0; - virtual int abortAfter() const = 0; - virtual bool showInvisibles() const = 0; - virtual ShowDurations::OrNot showDurations() const = 0; - virtual double minDuration() const = 0; - virtual TestSpec const& testSpec() const = 0; - virtual bool hasTestFilters() const = 0; - virtual std::vector const& getTestsOrTags() const = 0; - virtual RunTests::InWhatOrder runOrder() const = 0; - virtual unsigned int rngSeed() const = 0; - virtual UseColour::YesOrNo useColour() const = 0; - virtual std::vector const& getSectionsToRun() const = 0; - virtual Verbosity verbosity() const = 0; - - virtual bool benchmarkNoAnalysis() const = 0; - virtual int benchmarkSamples() const = 0; - virtual double benchmarkConfidenceInterval() const = 0; - virtual unsigned int benchmarkResamples() const = 0; - virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0; -}; + class TestSpec; + + struct IConfig : NonCopyable { + + virtual ~IConfig(); + + virtual bool allowThrows() const = 0; + virtual std::ostream& stream() const = 0; + virtual std::string name() const = 0; + virtual bool includeSuccessfulResults() const = 0; + virtual bool shouldDebugBreak() const = 0; + virtual bool warnAboutMissingAssertions() const = 0; + virtual bool warnAboutNoTests() const = 0; + virtual int abortAfter() const = 0; + virtual bool showInvisibles() const = 0; + virtual ShowDurations::OrNot showDurations() const = 0; + virtual double minDuration() const = 0; + virtual TestSpec const& testSpec() const = 0; + virtual bool hasTestFilters() const = 0; + virtual std::vector const& getTestsOrTags() const = 0; + virtual RunTests::InWhatOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; + virtual UseColour::YesOrNo useColour() const = 0; + virtual std::vector const& getSectionsToRun() const = 0; + virtual Verbosity verbosity() const = 0; + + virtual bool benchmarkNoAnalysis() const = 0; + virtual int benchmarkSamples() const = 0; + virtual double benchmarkConfidenceInterval() const = 0; + virtual unsigned int benchmarkResamples() const = 0; + virtual std::chrono::milliseconds benchmarkWarmupTime() const = 0; + }; -using IConfigPtr = std::shared_ptr; + using IConfigPtr = std::shared_ptr; } // end catch_interfaces_config.h @@ -4550,46 +4550,46 @@ using IConfigPtr = std::shared_ptr; namespace Catch { -// This is a simple implementation of C++11 Uniform Random Number -// Generator. It does not provide all operators, because Catch2 -// does not use it, but it should behave as expected inside stdlib's -// distributions. -// The implementation is based on the PCG family (http://pcg-random.org) -class SimplePcg32 { - using state_type = std::uint64_t; -public: - using result_type = std::uint32_t; - static constexpr result_type (min)() { - return 0; - } - static constexpr result_type (max)() { - return static_cast(-1); - } + // This is a simple implementation of C++11 Uniform Random Number + // Generator. It does not provide all operators, because Catch2 + // does not use it, but it should behave as expected inside stdlib's + // distributions. + // The implementation is based on the PCG family (http://pcg-random.org) + class SimplePcg32 { + using state_type = std::uint64_t; + public: + using result_type = std::uint32_t; + static constexpr result_type (min)() { + return 0; + } + static constexpr result_type (max)() { + return static_cast(-1); + } - // Provide some default initial state for the default constructor - SimplePcg32():SimplePcg32(0xed743cc4U) {} + // Provide some default initial state for the default constructor + SimplePcg32():SimplePcg32(0xed743cc4U) {} - explicit SimplePcg32(result_type seed_); + explicit SimplePcg32(result_type seed_); - void seed(result_type seed_); - void discard(uint64_t skip); + void seed(result_type seed_); + void discard(uint64_t skip); - result_type operator()(); + result_type operator()(); -private: - friend bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs); - friend bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs); - - // In theory we also need operator<< and operator>> - // In practice we do not use them, so we will skip them for now - - std::uint64_t m_state; - // This part of the state determines which "stream" of the numbers - // is chosen -- we take it as a constant for Catch2, so we only - // need to deal with seeding the main state. - // Picked by reading 8 bytes from `/dev/random` :-) - static const std::uint64_t s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL; -}; + private: + friend bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs); + friend bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs); + + // In theory we also need operator<< and operator>> + // In practice we do not use them, so we will skip them for now + + std::uint64_t m_state; + // This part of the state determines which "stream" of the numbers + // is chosen -- we take it as a constant for Catch2, so we only + // need to deal with seeding the main state. + // Picked by reading 8 bytes from `/dev/random` :-) + static const std::uint64_t s_inc = (0x13ed0cc53f939476ULL << 1ULL) | 1ULL; + }; } // end namespace Catch @@ -4607,8 +4607,8 @@ class RandomFloatingGenerator final : public IGenerator { public: RandomFloatingGenerator(Float a, Float b): - m_rng(rng()), - m_dist(a, b) { + m_rng(rng()), + m_dist(a, b) { static_cast(next()); } @@ -4629,8 +4629,8 @@ class RandomIntegerGenerator final : public IGenerator { public: RandomIntegerGenerator(Integer a, Integer b): - m_rng(rng()), - m_dist(a, b) { + m_rng(rng()), + m_dist(a, b) { static_cast(next()); } @@ -4647,19 +4647,19 @@ class RandomIntegerGenerator final : public IGenerator { // but I don't expect users to run into that in practice. template typename std::enable_if::value && !std::is_same::value, - GeneratorWrapper>::type +GeneratorWrapper>::type random(T a, T b) { return GeneratorWrapper( - pf::make_unique>(a, b) + pf::make_unique>(a, b) ); } template typename std::enable_if::value, - GeneratorWrapper>::type +GeneratorWrapper>::type random(T a, T b) { return GeneratorWrapper( - pf::make_unique>(a, b) + pf::make_unique>(a, b) ); } @@ -4672,10 +4672,10 @@ class RangeGenerator final : public IGenerator { public: RangeGenerator(T const& start, T const& end, T const& step): - m_current(start), - m_end(end), - m_step(step), - m_positive(m_step > T(0)) + m_current(start), + m_end(end), + m_step(step), + m_positive(m_step > T(0)) { assert(m_current != m_end && "Range start and end cannot be equal"); assert(m_step != T(0) && "Step size cannot be zero"); @@ -4683,7 +4683,7 @@ class RangeGenerator final : public IGenerator { } RangeGenerator(T const& start, T const& end): - RangeGenerator(start, end, (start < end) ? T(1) : T(-1)) + RangeGenerator(start, end, (start < end) ? T(1) : T(-1)) {} T const& get() const override { @@ -4711,8 +4711,8 @@ GeneratorWrapper range(T const& start, T const& end) { template class IteratorGenerator final : public IGenerator { static_assert(!std::is_same::value, - "IteratorGenerator currently does not support bools" - "because of std::vector specialization"); + "IteratorGenerator currently does not support bools" + "because of std::vector specialization"); std::vector m_elems; size_t m_current = 0; @@ -4735,14 +4735,14 @@ class IteratorGenerator final : public IGenerator { }; template ::value_type> + typename InputSentinel, + typename ResultType = typename std::iterator_traits::value_type> GeneratorWrapper from_range(InputIterator from, InputSentinel to) { return GeneratorWrapper(pf::make_unique>(from, to)); } template + typename ResultType = typename Container::value_type> GeneratorWrapper from_range(Container const& cnt) { return GeneratorWrapper(pf::make_unique>(cnt.begin(), cnt.end())); } @@ -4767,65 +4767,65 @@ GeneratorWrapper from_range(Container const& cnt) { namespace Catch { -struct ITestInvoker; - -struct TestCaseInfo { - enum SpecialProperties{ - None = 0, - IsHidden = 1 << 1, - ShouldFail = 1 << 2, - MayFail = 1 << 3, - Throws = 1 << 4, - NonPortable = 1 << 5, - Benchmark = 1 << 6 - }; + struct ITestInvoker; + + struct TestCaseInfo { + enum SpecialProperties{ + None = 0, + IsHidden = 1 << 1, + ShouldFail = 1 << 2, + MayFail = 1 << 3, + Throws = 1 << 4, + NonPortable = 1 << 5, + Benchmark = 1 << 6 + }; - TestCaseInfo( std::string const& _name, - std::string const& _className, - std::string const& _description, - std::vector const& _tags, - SourceLineInfo const& _lineInfo ); + TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector const& _tags, + SourceLineInfo const& _lineInfo ); - friend void setTags( TestCaseInfo& testCaseInfo, std::vector tags ); + friend void setTags( TestCaseInfo& testCaseInfo, std::vector tags ); - bool isHidden() const; - bool throws() const; - bool okToFail() const; - bool expectedToFail() const; + bool isHidden() const; + bool throws() const; + bool okToFail() const; + bool expectedToFail() const; - std::string tagsAsString() const; + std::string tagsAsString() const; - std::string name; - std::string className; - std::string description; - std::vector tags; - std::vector lcaseTags; - SourceLineInfo lineInfo; - SpecialProperties properties; -}; + std::string name; + std::string className; + std::string description; + std::vector tags; + std::vector lcaseTags; + SourceLineInfo lineInfo; + SpecialProperties properties; + }; -class TestCase : public TestCaseInfo { -public: + class TestCase : public TestCaseInfo { + public: - TestCase( ITestInvoker* testCase, TestCaseInfo&& info ); + TestCase( ITestInvoker* testCase, TestCaseInfo&& info ); - TestCase withName( std::string const& _newName ) const; + TestCase withName( std::string const& _newName ) const; - void invoke() const; + void invoke() const; - TestCaseInfo const& getTestCaseInfo() const; + TestCaseInfo const& getTestCaseInfo() const; - bool operator == ( TestCase const& other ) const; - bool operator < ( TestCase const& other ) const; + bool operator == ( TestCase const& other ) const; + bool operator < ( TestCase const& other ) const; -private: - std::shared_ptr test; -}; + private: + std::shared_ptr test; + }; -TestCase makeTestCase( ITestInvoker* testCase, - std::string const& className, - NameAndTags const& nameAndTags, - SourceLineInfo const& lineInfo ); + TestCase makeTestCase( ITestInvoker* testCase, + std::string const& className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); } #ifdef __clang__ @@ -4837,10 +4837,10 @@ TestCase makeTestCase( ITestInvoker* testCase, namespace Catch { -struct IRunner { - virtual ~IRunner(); - virtual bool aborting() const = 0; -}; + struct IRunner { + virtual ~IRunner(); + virtual bool aborting() const = 0; + }; } // end catch_interfaces_runner.h @@ -5077,26 +5077,26 @@ return @ desc; \ namespace Catch { -class WildcardPattern { - enum WildcardPosition { - NoWildcard = 0, - WildcardAtStart = 1, - WildcardAtEnd = 2, - WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd - }; + class WildcardPattern { + enum WildcardPosition { + NoWildcard = 0, + WildcardAtStart = 1, + WildcardAtEnd = 2, + WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd + }; -public: + public: - WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); - virtual ~WildcardPattern() = default; - virtual bool matches( std::string const& str ) const; + WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); + virtual ~WildcardPattern() = default; + virtual bool matches( std::string const& str ) const; -private: - std::string normaliseString( std::string const& str ) const; - CaseSensitive::Choice m_caseSensitivity; - WildcardPosition m_wildcard = NoWildcard; - std::string m_pattern; -}; + private: + std::string normaliseString( std::string const& str ) const; + CaseSensitive::Choice m_caseSensitivity; + WildcardPosition m_wildcard = NoWildcard; + std::string m_pattern; + }; } // end catch_wildcard_pattern.h @@ -5106,69 +5106,69 @@ class WildcardPattern { namespace Catch { -struct IConfig; + struct IConfig; -class TestSpec { - class Pattern { - public: - explicit Pattern( std::string const& name ); - virtual ~Pattern(); - virtual bool matches( TestCaseInfo const& testCase ) const = 0; - std::string const& name() const; - private: - std::string const m_name; - }; - using PatternPtr = std::shared_ptr; + class TestSpec { + class Pattern { + public: + explicit Pattern( std::string const& name ); + virtual ~Pattern(); + virtual bool matches( TestCaseInfo const& testCase ) const = 0; + std::string const& name() const; + private: + std::string const m_name; + }; + using PatternPtr = std::shared_ptr; - class NamePattern : public Pattern { - public: - explicit NamePattern( std::string const& name, std::string const& filterString ); - bool matches( TestCaseInfo const& testCase ) const override; - private: - WildcardPattern m_wildcardPattern; - }; + class NamePattern : public Pattern { + public: + explicit NamePattern( std::string const& name, std::string const& filterString ); + bool matches( TestCaseInfo const& testCase ) const override; + private: + WildcardPattern m_wildcardPattern; + }; - class TagPattern : public Pattern { - public: - explicit TagPattern( std::string const& tag, std::string const& filterString ); - bool matches( TestCaseInfo const& testCase ) const override; - private: - std::string m_tag; - }; + class TagPattern : public Pattern { + public: + explicit TagPattern( std::string const& tag, std::string const& filterString ); + bool matches( TestCaseInfo const& testCase ) const override; + private: + std::string m_tag; + }; - class ExcludedPattern : public Pattern { - public: - explicit ExcludedPattern( PatternPtr const& underlyingPattern ); - bool matches( TestCaseInfo const& testCase ) const override; - private: - PatternPtr m_underlyingPattern; - }; + class ExcludedPattern : public Pattern { + public: + explicit ExcludedPattern( PatternPtr const& underlyingPattern ); + bool matches( TestCaseInfo const& testCase ) const override; + private: + PatternPtr m_underlyingPattern; + }; - struct Filter { - std::vector m_patterns; + struct Filter { + std::vector m_patterns; - bool matches( TestCaseInfo const& testCase ) const; - std::string name() const; - }; + bool matches( TestCaseInfo const& testCase ) const; + std::string name() const; + }; -public: - struct FilterMatch { - std::string name; - std::vector tests; - }; - using Matches = std::vector; - using vectorStrings = std::vector; + public: + struct FilterMatch { + std::string name; + std::vector tests; + }; + using Matches = std::vector; + using vectorStrings = std::vector; - bool hasFilters() const; - bool matches( TestCaseInfo const& testCase ) const; - Matches matchesByFilter( std::vector const& testCases, IConfig const& config ) const; - const vectorStrings & getInvalidArgs() const; + bool hasFilters() const; + bool matches( TestCaseInfo const& testCase ) const; + Matches matchesByFilter( std::vector const& testCases, IConfig const& config ) const; + const vectorStrings & getInvalidArgs() const; -private: - std::vector m_filters; - std::vector m_invalidArgs; - friend class TestSpecParser; -}; + private: + std::vector m_filters; + std::vector m_invalidArgs; + friend class TestSpecParser; + }; } #ifdef __clang__ @@ -5182,72 +5182,72 @@ class TestSpec { namespace Catch { -struct TagAlias; + struct TagAlias; -struct ITagAliasRegistry { - virtual ~ITagAliasRegistry(); - // Nullptr if not present - virtual TagAlias const* find( std::string const& alias ) const = 0; - virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; + struct ITagAliasRegistry { + virtual ~ITagAliasRegistry(); + // Nullptr if not present + virtual TagAlias const* find( std::string const& alias ) const = 0; + virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; - static ITagAliasRegistry const& get(); -}; + static ITagAliasRegistry const& get(); + }; } // end namespace Catch // end catch_interfaces_tag_alias_registry.h namespace Catch { -class TestSpecParser { - enum Mode{ None, Name, QuotedName, Tag, EscapedName }; - Mode m_mode = None; - Mode lastMode = None; - bool m_exclusion = false; - std::size_t m_pos = 0; - std::size_t m_realPatternPos = 0; - std::string m_arg; - std::string m_substring; - std::string m_patternName; - std::vector m_escapeChars; - TestSpec::Filter m_currentFilter; - TestSpec m_testSpec; - ITagAliasRegistry const* m_tagAliases = nullptr; + class TestSpecParser { + enum Mode{ None, Name, QuotedName, Tag, EscapedName }; + Mode m_mode = None; + Mode lastMode = None; + bool m_exclusion = false; + std::size_t m_pos = 0; + std::size_t m_realPatternPos = 0; + std::string m_arg; + std::string m_substring; + std::string m_patternName; + std::vector m_escapeChars; + TestSpec::Filter m_currentFilter; + TestSpec m_testSpec; + ITagAliasRegistry const* m_tagAliases = nullptr; -public: - TestSpecParser( ITagAliasRegistry const& tagAliases ); + public: + TestSpecParser( ITagAliasRegistry const& tagAliases ); - TestSpecParser& parse( std::string const& arg ); - TestSpec testSpec(); + TestSpecParser& parse( std::string const& arg ); + TestSpec testSpec(); -private: - bool visitChar( char c ); - void startNewMode( Mode mode ); - bool processNoneChar( char c ); - void processNameChar( char c ); - bool processOtherChar( char c ); - void endMode(); - void escape(); - bool isControlChar( char c ) const; - void saveLastMode(); - void revertBackToLastMode(); - void addFilter(); - bool separate(); - - // Handles common preprocessing of the pattern for name/tag patterns - std::string preprocessPattern(); - // Adds the current pattern as a test name - void addNamePattern(); - // Adds the current pattern as a tag - void addTagPattern(); - - inline void addCharToPattern(char c) { - m_substring += c; - m_patternName += c; - m_realPatternPos++; - } + private: + bool visitChar( char c ); + void startNewMode( Mode mode ); + bool processNoneChar( char c ); + void processNameChar( char c ); + bool processOtherChar( char c ); + void endMode(); + void escape(); + bool isControlChar( char c ) const; + void saveLastMode(); + void revertBackToLastMode(); + void addFilter(); + bool separate(); + + // Handles common preprocessing of the pattern for name/tag patterns + std::string preprocessPattern(); + // Adds the current pattern as a test name + void addNamePattern(); + // Adds the current pattern as a tag + void addTagPattern(); + + inline void addCharToPattern(char c) { + m_substring += c; + m_patternName += c; + m_realPatternPos++; + } -}; -TestSpec parseTestSpec( std::string const& arg ); + }; + TestSpec parseTestSpec( std::string const& arg ); } // namespace Catch @@ -5268,108 +5268,108 @@ TestSpec parseTestSpec( std::string const& arg ); namespace Catch { -struct IStream; - -struct ConfigData { - bool listTests = false; - bool listTags = false; - bool listReporters = false; - bool listTestNamesOnly = false; - - bool showSuccessfulTests = false; - bool shouldDebugBreak = false; - bool noThrow = false; - bool showHelp = false; - bool showInvisibles = false; - bool filenamesAsTags = false; - bool libIdentify = false; - - int abortAfter = -1; - unsigned int rngSeed = 0; - - bool benchmarkNoAnalysis = false; - unsigned int benchmarkSamples = 100; - double benchmarkConfidenceInterval = 0.95; - unsigned int benchmarkResamples = 100000; - std::chrono::milliseconds::rep benchmarkWarmupTime = 100; - - Verbosity verbosity = Verbosity::Normal; - WarnAbout::What warnings = WarnAbout::Nothing; - ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter; - double minDuration = -1; - RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder; - UseColour::YesOrNo useColour = UseColour::Auto; - WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; - - std::string outputFilename; - std::string name; - std::string processName; + struct IStream; + + struct ConfigData { + bool listTests = false; + bool listTags = false; + bool listReporters = false; + bool listTestNamesOnly = false; + + bool showSuccessfulTests = false; + bool shouldDebugBreak = false; + bool noThrow = false; + bool showHelp = false; + bool showInvisibles = false; + bool filenamesAsTags = false; + bool libIdentify = false; + + int abortAfter = -1; + unsigned int rngSeed = 0; + + bool benchmarkNoAnalysis = false; + unsigned int benchmarkSamples = 100; + double benchmarkConfidenceInterval = 0.95; + unsigned int benchmarkResamples = 100000; + std::chrono::milliseconds::rep benchmarkWarmupTime = 100; + + Verbosity verbosity = Verbosity::Normal; + WarnAbout::What warnings = WarnAbout::Nothing; + ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter; + double minDuration = -1; + RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder; + UseColour::YesOrNo useColour = UseColour::Auto; + WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; + + std::string outputFilename; + std::string name; + std::string processName; #ifndef CATCH_CONFIG_DEFAULT_REPORTER #define CATCH_CONFIG_DEFAULT_REPORTER "console" #endif - std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; + std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; #undef CATCH_CONFIG_DEFAULT_REPORTER - std::vector testsOrTags; - std::vector sectionsToRun; -}; - -class Config : public IConfig { -public: - - Config() = default; - Config( ConfigData const& data ); - virtual ~Config() = default; - - std::string const& getFilename() const; - - bool listTests() const; - bool listTestNamesOnly() const; - bool listTags() const; - bool listReporters() const; - - std::string getProcessName() const; - std::string const& getReporterName() const; - - std::vector const& getTestsOrTags() const override; - std::vector const& getSectionsToRun() const override; - - TestSpec const& testSpec() const override; - bool hasTestFilters() const override; + std::vector testsOrTags; + std::vector sectionsToRun; + }; - bool showHelp() const; + class Config : public IConfig { + public: - // IConfig interface - bool allowThrows() const override; - std::ostream& stream() const override; - std::string name() const override; - bool includeSuccessfulResults() const override; - bool warnAboutMissingAssertions() const override; - bool warnAboutNoTests() const override; - ShowDurations::OrNot showDurations() const override; - double minDuration() const override; - RunTests::InWhatOrder runOrder() const override; - unsigned int rngSeed() const override; - UseColour::YesOrNo useColour() const override; - bool shouldDebugBreak() const override; - int abortAfter() const override; - bool showInvisibles() const override; - Verbosity verbosity() const override; - bool benchmarkNoAnalysis() const override; - int benchmarkSamples() const override; - double benchmarkConfidenceInterval() const override; - unsigned int benchmarkResamples() const override; - std::chrono::milliseconds benchmarkWarmupTime() const override; + Config() = default; + Config( ConfigData const& data ); + virtual ~Config() = default; + + std::string const& getFilename() const; + + bool listTests() const; + bool listTestNamesOnly() const; + bool listTags() const; + bool listReporters() const; + + std::string getProcessName() const; + std::string const& getReporterName() const; + + std::vector const& getTestsOrTags() const override; + std::vector const& getSectionsToRun() const override; + + TestSpec const& testSpec() const override; + bool hasTestFilters() const override; + + bool showHelp() const; + + // IConfig interface + bool allowThrows() const override; + std::ostream& stream() const override; + std::string name() const override; + bool includeSuccessfulResults() const override; + bool warnAboutMissingAssertions() const override; + bool warnAboutNoTests() const override; + ShowDurations::OrNot showDurations() const override; + double minDuration() const override; + RunTests::InWhatOrder runOrder() const override; + unsigned int rngSeed() const override; + UseColour::YesOrNo useColour() const override; + bool shouldDebugBreak() const override; + int abortAfter() const override; + bool showInvisibles() const override; + Verbosity verbosity() const override; + bool benchmarkNoAnalysis() const override; + int benchmarkSamples() const override; + double benchmarkConfidenceInterval() const override; + unsigned int benchmarkResamples() const override; + std::chrono::milliseconds benchmarkWarmupTime() const override; -private: + private: - IStream const* openStream(); - ConfigData m_data; + IStream const* openStream(); + ConfigData m_data; - std::unique_ptr m_stream; - TestSpec m_testSpec; - bool m_hasTestFilters = false; -}; + std::unique_ptr m_stream; + TestSpec m_testSpec; + bool m_hasTestFilters = false; + }; } // end namespace Catch @@ -5380,42 +5380,42 @@ class Config : public IConfig { namespace Catch { -struct AssertionResultData -{ - AssertionResultData() = delete; + struct AssertionResultData + { + AssertionResultData() = delete; - AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); + AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); - std::string message; - mutable std::string reconstructedExpression; - LazyExpression lazyExpression; - ResultWas::OfType resultType; + std::string message; + mutable std::string reconstructedExpression; + LazyExpression lazyExpression; + ResultWas::OfType resultType; - std::string reconstructExpression() const; -}; + std::string reconstructExpression() const; + }; -class AssertionResult { -public: - AssertionResult() = delete; - AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); - - bool isOk() const; - bool succeeded() const; - ResultWas::OfType getResultType() const; - bool hasExpression() const; - bool hasMessage() const; - std::string getExpression() const; - std::string getExpressionInMacro() const; - bool hasExpandedExpression() const; - std::string getExpandedExpression() const; - std::string getMessage() const; - SourceLineInfo getSourceInfo() const; - StringRef getTestMacroName() const; + class AssertionResult { + public: + AssertionResult() = delete; + AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); + + bool isOk() const; + bool succeeded() const; + ResultWas::OfType getResultType() const; + bool hasExpression() const; + bool hasMessage() const; + std::string getExpression() const; + std::string getExpressionInMacro() const; + bool hasExpandedExpression() const; + std::string getExpandedExpression() const; + std::string getMessage() const; + SourceLineInfo getSourceInfo() const; + StringRef getTestMacroName() const; //protected: - AssertionInfo m_info; - AssertionResultData m_resultData; -}; + AssertionInfo m_info; + AssertionResultData m_resultData; + }; } // end namespace Catch @@ -5478,140 +5478,140 @@ namespace Catch { namespace Catch { -struct ReporterConfig { - explicit ReporterConfig( IConfigPtr const& _fullConfig ); + struct ReporterConfig { + explicit ReporterConfig( IConfigPtr const& _fullConfig ); - ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ); + ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ); - std::ostream& stream() const; - IConfigPtr fullConfig() const; + std::ostream& stream() const; + IConfigPtr fullConfig() const; -private: - std::ostream* m_stream; - IConfigPtr m_fullConfig; -}; + private: + std::ostream* m_stream; + IConfigPtr m_fullConfig; + }; -struct ReporterPreferences { - bool shouldRedirectStdOut = false; - bool shouldReportAllAssertions = false; -}; + struct ReporterPreferences { + bool shouldRedirectStdOut = false; + bool shouldReportAllAssertions = false; + }; -template -struct LazyStat : Option { - LazyStat& operator=( T const& _value ) { - Option::operator=( _value ); - used = false; - return *this; - } - void reset() { - Option::reset(); - used = false; - } - bool used = false; -}; + template + struct LazyStat : Option { + LazyStat& operator=( T const& _value ) { + Option::operator=( _value ); + used = false; + return *this; + } + void reset() { + Option::reset(); + used = false; + } + bool used = false; + }; -struct TestRunInfo { - TestRunInfo( std::string const& _name ); - std::string name; -}; -struct GroupInfo { - GroupInfo( std::string const& _name, - std::size_t _groupIndex, - std::size_t _groupsCount ); + struct TestRunInfo { + TestRunInfo( std::string const& _name ); + std::string name; + }; + struct GroupInfo { + GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ); - std::string name; - std::size_t groupIndex; - std::size_t groupsCounts; -}; + std::string name; + std::size_t groupIndex; + std::size_t groupsCounts; + }; -struct AssertionStats { - AssertionStats( AssertionResult const& _assertionResult, - std::vector const& _infoMessages, - Totals const& _totals ); + struct AssertionStats { + AssertionStats( AssertionResult const& _assertionResult, + std::vector const& _infoMessages, + Totals const& _totals ); - AssertionStats( AssertionStats const& ) = default; - AssertionStats( AssertionStats && ) = default; - AssertionStats& operator = ( AssertionStats const& ) = delete; - AssertionStats& operator = ( AssertionStats && ) = delete; - virtual ~AssertionStats(); + AssertionStats( AssertionStats const& ) = default; + AssertionStats( AssertionStats && ) = default; + AssertionStats& operator = ( AssertionStats const& ) = delete; + AssertionStats& operator = ( AssertionStats && ) = delete; + virtual ~AssertionStats(); - AssertionResult assertionResult; - std::vector infoMessages; - Totals totals; -}; + AssertionResult assertionResult; + std::vector infoMessages; + Totals totals; + }; -struct SectionStats { - SectionStats( SectionInfo const& _sectionInfo, - Counts const& _assertions, - double _durationInSeconds, - bool _missingAssertions ); - SectionStats( SectionStats const& ) = default; - SectionStats( SectionStats && ) = default; - SectionStats& operator = ( SectionStats const& ) = default; - SectionStats& operator = ( SectionStats && ) = default; - virtual ~SectionStats(); - - SectionInfo sectionInfo; - Counts assertions; - double durationInSeconds; - bool missingAssertions; -}; + struct SectionStats { + SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ); + SectionStats( SectionStats const& ) = default; + SectionStats( SectionStats && ) = default; + SectionStats& operator = ( SectionStats const& ) = default; + SectionStats& operator = ( SectionStats && ) = default; + virtual ~SectionStats(); + + SectionInfo sectionInfo; + Counts assertions; + double durationInSeconds; + bool missingAssertions; + }; -struct TestCaseStats { - TestCaseStats( TestCaseInfo const& _testInfo, - Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, - bool _aborting ); - - TestCaseStats( TestCaseStats const& ) = default; - TestCaseStats( TestCaseStats && ) = default; - TestCaseStats& operator = ( TestCaseStats const& ) = default; - TestCaseStats& operator = ( TestCaseStats && ) = default; - virtual ~TestCaseStats(); - - TestCaseInfo testInfo; - Totals totals; - std::string stdOut; - std::string stdErr; - bool aborting; -}; + struct TestCaseStats { + TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ); -struct TestGroupStats { - TestGroupStats( GroupInfo const& _groupInfo, - Totals const& _totals, - bool _aborting ); - TestGroupStats( GroupInfo const& _groupInfo ); - - TestGroupStats( TestGroupStats const& ) = default; - TestGroupStats( TestGroupStats && ) = default; - TestGroupStats& operator = ( TestGroupStats const& ) = default; - TestGroupStats& operator = ( TestGroupStats && ) = default; - virtual ~TestGroupStats(); - - GroupInfo groupInfo; - Totals totals; - bool aborting; -}; + TestCaseStats( TestCaseStats const& ) = default; + TestCaseStats( TestCaseStats && ) = default; + TestCaseStats& operator = ( TestCaseStats const& ) = default; + TestCaseStats& operator = ( TestCaseStats && ) = default; + virtual ~TestCaseStats(); -struct TestRunStats { - TestRunStats( TestRunInfo const& _runInfo, - Totals const& _totals, - bool _aborting ); + TestCaseInfo testInfo; + Totals totals; + std::string stdOut; + std::string stdErr; + bool aborting; + }; - TestRunStats( TestRunStats const& ) = default; - TestRunStats( TestRunStats && ) = default; - TestRunStats& operator = ( TestRunStats const& ) = default; - TestRunStats& operator = ( TestRunStats && ) = default; - virtual ~TestRunStats(); + struct TestGroupStats { + TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ); + TestGroupStats( GroupInfo const& _groupInfo ); - TestRunInfo runInfo; - Totals totals; - bool aborting; -}; + TestGroupStats( TestGroupStats const& ) = default; + TestGroupStats( TestGroupStats && ) = default; + TestGroupStats& operator = ( TestGroupStats const& ) = default; + TestGroupStats& operator = ( TestGroupStats && ) = default; + virtual ~TestGroupStats(); + + GroupInfo groupInfo; + Totals totals; + bool aborting; + }; + + struct TestRunStats { + TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ); + + TestRunStats( TestRunStats const& ) = default; + TestRunStats( TestRunStats && ) = default; + TestRunStats& operator = ( TestRunStats const& ) = default; + TestRunStats& operator = ( TestRunStats && ) = default; + virtual ~TestRunStats(); + + TestRunInfo runInfo; + Totals totals; + bool aborting; + }; #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) -struct BenchmarkInfo { + struct BenchmarkInfo { std::string name; double estimatedDuration; int iterations; @@ -5648,67 +5648,67 @@ struct BenchmarkInfo { }; #endif // CATCH_CONFIG_ENABLE_BENCHMARKING -struct IStreamingReporter { - virtual ~IStreamingReporter() = default; + struct IStreamingReporter { + virtual ~IStreamingReporter() = default; - // Implementing class must also provide the following static methods: - // static std::string getDescription(); - // static std::set getSupportedVerbosities() + // Implementing class must also provide the following static methods: + // static std::string getDescription(); + // static std::set getSupportedVerbosities() - virtual ReporterPreferences getPreferences() const = 0; + virtual ReporterPreferences getPreferences() const = 0; - virtual void noMatchingTestCases( std::string const& spec ) = 0; + virtual void noMatchingTestCases( std::string const& spec ) = 0; - virtual void reportInvalidArguments(std::string const&) {} + virtual void reportInvalidArguments(std::string const&) {} - virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; - virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; + virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; + virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; - virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; - virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; + virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; + virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) - virtual void benchmarkPreparing( std::string const& ) {} + virtual void benchmarkPreparing( std::string const& ) {} virtual void benchmarkStarting( BenchmarkInfo const& ) {} virtual void benchmarkEnded( BenchmarkStats<> const& ) {} virtual void benchmarkFailed( std::string const& ) {} #endif // CATCH_CONFIG_ENABLE_BENCHMARKING - virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; + virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; - // The return value indicates if the messages buffer should be cleared: - virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; + // The return value indicates if the messages buffer should be cleared: + virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; - virtual void sectionEnded( SectionStats const& sectionStats ) = 0; - virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; - virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; - virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + virtual void sectionEnded( SectionStats const& sectionStats ) = 0; + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; + virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; - virtual void skipTest( TestCaseInfo const& testInfo ) = 0; + virtual void skipTest( TestCaseInfo const& testInfo ) = 0; - // Default empty implementation provided - virtual void fatalErrorEncountered( StringRef name ); + // Default empty implementation provided + virtual void fatalErrorEncountered( StringRef name ); - virtual bool isMulti() const; -}; -using IStreamingReporterPtr = std::unique_ptr; + virtual bool isMulti() const; + }; + using IStreamingReporterPtr = std::unique_ptr; -struct IReporterFactory { - virtual ~IReporterFactory(); - virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0; - virtual std::string getDescription() const = 0; -}; -using IReporterFactoryPtr = std::shared_ptr; + struct IReporterFactory { + virtual ~IReporterFactory(); + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0; + virtual std::string getDescription() const = 0; + }; + using IReporterFactoryPtr = std::shared_ptr; -struct IReporterRegistry { - using FactoryMap = std::map; - using Listeners = std::vector; + struct IReporterRegistry { + using FactoryMap = std::map; + using Listeners = std::vector; - virtual ~IReporterRegistry(); - virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0; - virtual FactoryMap const& getFactories() const = 0; - virtual Listeners const& getListeners() const = 0; -}; + virtual ~IReporterRegistry(); + virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0; + virtual FactoryMap const& getFactories() const = 0; + virtual Listeners const& getListeners() const = 0; + }; } // end namespace Catch @@ -5722,263 +5722,263 @@ struct IReporterRegistry { #include namespace Catch { -void prepareExpandedExpression(AssertionResult& result); + void prepareExpandedExpression(AssertionResult& result); -// Returns double formatted as %.3f (format expected on output) -std::string getFormattedDuration( double duration ); + // Returns double formatted as %.3f (format expected on output) + std::string getFormattedDuration( double duration ); -//! Should the reporter show -bool shouldShowDuration( IConfig const& config, double duration ); + //! Should the reporter show + bool shouldShowDuration( IConfig const& config, double duration ); -std::string serializeFilters( std::vector const& container ); + std::string serializeFilters( std::vector const& container ); -template -struct StreamingReporterBase : IStreamingReporter { + template + struct StreamingReporterBase : IStreamingReporter { - StreamingReporterBase( ReporterConfig const& _config ) - : m_config( _config.fullConfig() ), - stream( _config.stream() ) - { - m_reporterPrefs.shouldRedirectStdOut = false; - if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) - CATCH_ERROR( "Verbosity level not supported by this reporter" ); - } + StreamingReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + CATCH_ERROR( "Verbosity level not supported by this reporter" ); + } - ReporterPreferences getPreferences() const override { - return m_reporterPrefs; - } + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } - static std::set getSupportedVerbosities() { - return { Verbosity::Normal }; - } + static std::set getSupportedVerbosities() { + return { Verbosity::Normal }; + } - ~StreamingReporterBase() override = default; + ~StreamingReporterBase() override = default; - void noMatchingTestCases(std::string const&) override {} + void noMatchingTestCases(std::string const&) override {} - void reportInvalidArguments(std::string const&) override {} + void reportInvalidArguments(std::string const&) override {} - void testRunStarting(TestRunInfo const& _testRunInfo) override { - currentTestRunInfo = _testRunInfo; - } + void testRunStarting(TestRunInfo const& _testRunInfo) override { + currentTestRunInfo = _testRunInfo; + } - void testGroupStarting(GroupInfo const& _groupInfo) override { - currentGroupInfo = _groupInfo; - } + void testGroupStarting(GroupInfo const& _groupInfo) override { + currentGroupInfo = _groupInfo; + } - void testCaseStarting(TestCaseInfo const& _testInfo) override { - currentTestCaseInfo = _testInfo; - } - void sectionStarting(SectionInfo const& _sectionInfo) override { - m_sectionStack.push_back(_sectionInfo); - } + void testCaseStarting(TestCaseInfo const& _testInfo) override { + currentTestCaseInfo = _testInfo; + } + void sectionStarting(SectionInfo const& _sectionInfo) override { + m_sectionStack.push_back(_sectionInfo); + } - void sectionEnded(SectionStats const& /* _sectionStats */) override { - m_sectionStack.pop_back(); - } - void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { - currentTestCaseInfo.reset(); - } - void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override { - currentGroupInfo.reset(); - } - void testRunEnded(TestRunStats const& /* _testRunStats */) override { - currentTestCaseInfo.reset(); - currentGroupInfo.reset(); - currentTestRunInfo.reset(); - } + void sectionEnded(SectionStats const& /* _sectionStats */) override { + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { + currentTestCaseInfo.reset(); + } + void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override { + currentGroupInfo.reset(); + } + void testRunEnded(TestRunStats const& /* _testRunStats */) override { + currentTestCaseInfo.reset(); + currentGroupInfo.reset(); + currentTestRunInfo.reset(); + } - void skipTest(TestCaseInfo const&) override { - // Don't do anything with this by default. - // It can optionally be overridden in the derived class. - } + void skipTest(TestCaseInfo const&) override { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } - IConfigPtr m_config; - std::ostream& stream; + IConfigPtr m_config; + std::ostream& stream; - LazyStat currentTestRunInfo; - LazyStat currentGroupInfo; - LazyStat currentTestCaseInfo; + LazyStat currentTestRunInfo; + LazyStat currentGroupInfo; + LazyStat currentTestCaseInfo; - std::vector m_sectionStack; - ReporterPreferences m_reporterPrefs; -}; + std::vector m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; -template -struct CumulativeReporterBase : IStreamingReporter { - template - struct Node { - explicit Node( T const& _value ) : value( _value ) {} - virtual ~Node() {} + template + struct CumulativeReporterBase : IStreamingReporter { + template + struct Node { + explicit Node( T const& _value ) : value( _value ) {} + virtual ~Node() {} - using ChildNodes = std::vector>; - T value; - ChildNodes children; - }; - struct SectionNode { - explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} - virtual ~SectionNode() = default; + using ChildNodes = std::vector>; + T value; + ChildNodes children; + }; + struct SectionNode { + explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} + virtual ~SectionNode() = default; - bool operator == (SectionNode const& other) const { - return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; - } - bool operator == (std::shared_ptr const& other) const { - return operator==(*other); - } + bool operator == (SectionNode const& other) const { + return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; + } + bool operator == (std::shared_ptr const& other) const { + return operator==(*other); + } - SectionStats stats; - using ChildSections = std::vector>; - using Assertions = std::vector; - ChildSections childSections; - Assertions assertions; - std::string stdOut; - std::string stdErr; - }; + SectionStats stats; + using ChildSections = std::vector>; + using Assertions = std::vector; + ChildSections childSections; + Assertions assertions; + std::string stdOut; + std::string stdErr; + }; - struct BySectionInfo { - BySectionInfo( SectionInfo const& other ) : m_other( other ) {} - BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {} - bool operator() (std::shared_ptr const& node) const { - return ((node->stats.sectionInfo.name == m_other.name) && - (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); - } - void operator=(BySectionInfo const&) = delete; + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ) : m_other( other ) {} + BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {} + bool operator() (std::shared_ptr const& node) const { + return ((node->stats.sectionInfo.name == m_other.name) && + (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); + } + void operator=(BySectionInfo const&) = delete; - private: - SectionInfo const& m_other; - }; + private: + SectionInfo const& m_other; + }; - using TestCaseNode = Node; - using TestGroupNode = Node; - using TestRunNode = Node; + using TestCaseNode = Node; + using TestGroupNode = Node; + using TestRunNode = Node; - CumulativeReporterBase( ReporterConfig const& _config ) - : m_config( _config.fullConfig() ), - stream( _config.stream() ) - { - m_reporterPrefs.shouldRedirectStdOut = false; - if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) - CATCH_ERROR( "Verbosity level not supported by this reporter" ); - } - ~CumulativeReporterBase() override = default; + CumulativeReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + CATCH_ERROR( "Verbosity level not supported by this reporter" ); + } + ~CumulativeReporterBase() override = default; - ReporterPreferences getPreferences() const override { - return m_reporterPrefs; - } + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } - static std::set getSupportedVerbosities() { - return { Verbosity::Normal }; - } + static std::set getSupportedVerbosities() { + return { Verbosity::Normal }; + } - void testRunStarting( TestRunInfo const& ) override {} - void testGroupStarting( GroupInfo const& ) override {} + void testRunStarting( TestRunInfo const& ) override {} + void testGroupStarting( GroupInfo const& ) override {} - void testCaseStarting( TestCaseInfo const& ) override {} + void testCaseStarting( TestCaseInfo const& ) override {} - void sectionStarting( SectionInfo const& sectionInfo ) override { - SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); - std::shared_ptr node; - if( m_sectionStack.empty() ) { - if( !m_rootSection ) - m_rootSection = std::make_shared( incompleteStats ); - node = m_rootSection; - } - else { - SectionNode& parentNode = *m_sectionStack.back(); - auto it = + void sectionStarting( SectionInfo const& sectionInfo ) override { + SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); + std::shared_ptr node; + if( m_sectionStack.empty() ) { + if( !m_rootSection ) + m_rootSection = std::make_shared( incompleteStats ); + node = m_rootSection; + } + else { + SectionNode& parentNode = *m_sectionStack.back(); + auto it = std::find_if( parentNode.childSections.begin(), parentNode.childSections.end(), BySectionInfo( sectionInfo ) ); - if( it == parentNode.childSections.end() ) { - node = std::make_shared( incompleteStats ); - parentNode.childSections.push_back( node ); + if( it == parentNode.childSections.end() ) { + node = std::make_shared( incompleteStats ); + parentNode.childSections.push_back( node ); + } + else + node = *it; } - else - node = *it; + m_sectionStack.push_back( node ); + m_deepestSection = std::move(node); } - m_sectionStack.push_back( node ); - m_deepestSection = std::move(node); - } - - void assertionStarting(AssertionInfo const&) override {} - - bool assertionEnded(AssertionStats const& assertionStats) override { - assert(!m_sectionStack.empty()); - // AssertionResult holds a pointer to a temporary DecomposedExpression, - // which getExpandedExpression() calls to build the expression string. - // Our section stack copy of the assertionResult will likely outlive the - // temporary, so it must be expanded or discarded now to avoid calling - // a destroyed object later. - prepareExpandedExpression(const_cast( assertionStats.assertionResult ) ); - SectionNode& sectionNode = *m_sectionStack.back(); - sectionNode.assertions.push_back(assertionStats); - return true; - } - void sectionEnded(SectionStats const& sectionStats) override { - assert(!m_sectionStack.empty()); - SectionNode& node = *m_sectionStack.back(); - node.stats = sectionStats; - m_sectionStack.pop_back(); - } - void testCaseEnded(TestCaseStats const& testCaseStats) override { - auto node = std::make_shared(testCaseStats); - assert(m_sectionStack.size() == 0); - node->children.push_back(m_rootSection); - m_testCases.push_back(node); - m_rootSection.reset(); - assert(m_deepestSection); - m_deepestSection->stdOut = testCaseStats.stdOut; - m_deepestSection->stdErr = testCaseStats.stdErr; - } - void testGroupEnded(TestGroupStats const& testGroupStats) override { - auto node = std::make_shared(testGroupStats); - node->children.swap(m_testCases); - m_testGroups.push_back(node); - } - void testRunEnded(TestRunStats const& testRunStats) override { - auto node = std::make_shared(testRunStats); - node->children.swap(m_testGroups); - m_testRuns.push_back(node); - testRunEndedCumulative(); - } - virtual void testRunEndedCumulative() = 0; + void assertionStarting(AssertionInfo const&) override {} + + bool assertionEnded(AssertionStats const& assertionStats) override { + assert(!m_sectionStack.empty()); + // AssertionResult holds a pointer to a temporary DecomposedExpression, + // which getExpandedExpression() calls to build the expression string. + // Our section stack copy of the assertionResult will likely outlive the + // temporary, so it must be expanded or discarded now to avoid calling + // a destroyed object later. + prepareExpandedExpression(const_cast( assertionStats.assertionResult ) ); + SectionNode& sectionNode = *m_sectionStack.back(); + sectionNode.assertions.push_back(assertionStats); + return true; + } + void sectionEnded(SectionStats const& sectionStats) override { + assert(!m_sectionStack.empty()); + SectionNode& node = *m_sectionStack.back(); + node.stats = sectionStats; + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& testCaseStats) override { + auto node = std::make_shared(testCaseStats); + assert(m_sectionStack.size() == 0); + node->children.push_back(m_rootSection); + m_testCases.push_back(node); + m_rootSection.reset(); + + assert(m_deepestSection); + m_deepestSection->stdOut = testCaseStats.stdOut; + m_deepestSection->stdErr = testCaseStats.stdErr; + } + void testGroupEnded(TestGroupStats const& testGroupStats) override { + auto node = std::make_shared(testGroupStats); + node->children.swap(m_testCases); + m_testGroups.push_back(node); + } + void testRunEnded(TestRunStats const& testRunStats) override { + auto node = std::make_shared(testRunStats); + node->children.swap(m_testGroups); + m_testRuns.push_back(node); + testRunEndedCumulative(); + } + virtual void testRunEndedCumulative() = 0; - void skipTest(TestCaseInfo const&) override {} + void skipTest(TestCaseInfo const&) override {} - IConfigPtr m_config; - std::ostream& stream; - std::vector m_assertions; - std::vector>> m_sections; - std::vector> m_testCases; - std::vector> m_testGroups; + IConfigPtr m_config; + std::ostream& stream; + std::vector m_assertions; + std::vector>> m_sections; + std::vector> m_testCases; + std::vector> m_testGroups; - std::vector> m_testRuns; + std::vector> m_testRuns; - std::shared_ptr m_rootSection; - std::shared_ptr m_deepestSection; - std::vector> m_sectionStack; - ReporterPreferences m_reporterPrefs; -}; + std::shared_ptr m_rootSection; + std::shared_ptr m_deepestSection; + std::vector> m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; -template -char const* getLineOfChars() { - static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; - if( !*line ) { - std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); - line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; + template + char const* getLineOfChars() { + static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; + if( !*line ) { + std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); + line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; + } + return line; } - return line; -} -struct TestEventListenerBase : StreamingReporterBase { - TestEventListenerBase( ReporterConfig const& _config ); + struct TestEventListenerBase : StreamingReporterBase { + TestEventListenerBase( ReporterConfig const& _config ); - static std::set getSupportedVerbosities(); + static std::set getSupportedVerbosities(); - void assertionStarting(AssertionInfo const&) override; - bool assertionEnded(AssertionStats const&) override; -}; + void assertionStarting(AssertionInfo const&) override; + bool assertionEnded(AssertionStats const&) override; + }; } // end namespace Catch @@ -5987,57 +5987,57 @@ struct TestEventListenerBase : StreamingReporterBase { namespace Catch { -struct Colour { - enum Code { - None = 0, - - White, - Red, - Green, - Blue, - Cyan, - Yellow, - Grey, - - Bright = 0x10, - - BrightRed = Bright | Red, - BrightGreen = Bright | Green, - LightGrey = Bright | Grey, - BrightWhite = Bright | White, - BrightYellow = Bright | Yellow, - - // By intention - FileName = LightGrey, - Warning = BrightYellow, - ResultError = BrightRed, - ResultSuccess = BrightGreen, - ResultExpectedFailure = Warning, - - Error = BrightRed, - Success = Green, - - OriginalExpression = Cyan, - ReconstructedExpression = BrightYellow, - - SecondaryText = LightGrey, - Headers = White - }; + struct Colour { + enum Code { + None = 0, + + White, + Red, + Green, + Blue, + Cyan, + Yellow, + Grey, + + Bright = 0x10, + + BrightRed = Bright | Red, + BrightGreen = Bright | Green, + LightGrey = Bright | Grey, + BrightWhite = Bright | White, + BrightYellow = Bright | Yellow, + + // By intention + FileName = LightGrey, + Warning = BrightYellow, + ResultError = BrightRed, + ResultSuccess = BrightGreen, + ResultExpectedFailure = Warning, + + Error = BrightRed, + Success = Green, + + OriginalExpression = Cyan, + ReconstructedExpression = BrightYellow, + + SecondaryText = LightGrey, + Headers = White + }; - // Use constructed object for RAII guard - Colour( Code _colourCode ); - Colour( Colour&& other ) noexcept; - Colour& operator=( Colour&& other ) noexcept; - ~Colour(); + // Use constructed object for RAII guard + Colour( Code _colourCode ); + Colour( Colour&& other ) noexcept; + Colour& operator=( Colour&& other ) noexcept; + ~Colour(); - // Use static method for one-shot changes - static void use( Code _colourCode ); + // Use static method for one-shot changes + static void use( Code _colourCode ); -private: - bool m_moved = false; -}; + private: + bool m_moved = false; + }; -std::ostream& operator << ( std::ostream& os, Colour const& ); + std::ostream& operator << ( std::ostream& os, Colour const& ); } // end namespace Catch @@ -6047,46 +6047,46 @@ std::ostream& operator << ( std::ostream& os, Colour const& ); namespace Catch { -template -class ReporterRegistrar { + template + class ReporterRegistrar { - class ReporterFactory : public IReporterFactory { + class ReporterFactory : public IReporterFactory { - IStreamingReporterPtr create( ReporterConfig const& config ) const override { - return std::unique_ptr( new T( config ) ); - } + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr( new T( config ) ); + } + + std::string getDescription() const override { + return T::getDescription(); + } + }; - std::string getDescription() const override { - return T::getDescription(); + public: + + explicit ReporterRegistrar( std::string const& name ) { + getMutableRegistryHub().registerReporter( name, std::make_shared() ); } }; -public: + template + class ListenerRegistrar { - explicit ReporterRegistrar( std::string const& name ) { - getMutableRegistryHub().registerReporter( name, std::make_shared() ); - } -}; + class ListenerFactory : public IReporterFactory { -template -class ListenerRegistrar { + IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr( new T( config ) ); + } + std::string getDescription() const override { + return std::string(); + } + }; - class ListenerFactory : public IReporterFactory { + public: - IStreamingReporterPtr create( ReporterConfig const& config ) const override { - return std::unique_ptr( new T( config ) ); - } - std::string getDescription() const override { - return std::string(); + ListenerRegistrar() { + getMutableRegistryHub().registerListener( std::make_shared() ); } }; - -public: - - ListenerRegistrar() { - getMutableRegistryHub().registerListener( std::make_shared() ); - } -}; } #if !defined(CATCH_CONFIG_DISABLE) @@ -6115,25 +6115,25 @@ class ListenerRegistrar { namespace Catch { -struct CompactReporter : StreamingReporterBase { + struct CompactReporter : StreamingReporterBase { - using StreamingReporterBase::StreamingReporterBase; + using StreamingReporterBase::StreamingReporterBase; - ~CompactReporter() override; + ~CompactReporter() override; - static std::string getDescription(); + static std::string getDescription(); - void noMatchingTestCases(std::string const& spec) override; + void noMatchingTestCases(std::string const& spec) override; - void assertionStarting(AssertionInfo const&) override; + void assertionStarting(AssertionInfo const&) override; - bool assertionEnded(AssertionStats const& _assertionStats) override; + bool assertionEnded(AssertionStats const& _assertionStats) override; - void sectionEnded(SectionStats const& _sectionStats) override; + void sectionEnded(SectionStats const& _sectionStats) override; - void testRunEnded(TestRunStats const& _testRunStats) override; + void testRunEnded(TestRunStats const& _testRunStats) override; -}; + }; } // end namespace Catch @@ -6148,65 +6148,65 @@ struct CompactReporter : StreamingReporterBase { #endif namespace Catch { -// Fwd decls -struct SummaryColumn; -class TablePrinter; + // Fwd decls + struct SummaryColumn; + class TablePrinter; -struct ConsoleReporter : StreamingReporterBase { - std::unique_ptr m_tablePrinter; + struct ConsoleReporter : StreamingReporterBase { + std::unique_ptr m_tablePrinter; - ConsoleReporter(ReporterConfig const& config); - ~ConsoleReporter() override; - static std::string getDescription(); + ConsoleReporter(ReporterConfig const& config); + ~ConsoleReporter() override; + static std::string getDescription(); - void noMatchingTestCases(std::string const& spec) override; + void noMatchingTestCases(std::string const& spec) override; - void reportInvalidArguments(std::string const&arg) override; + void reportInvalidArguments(std::string const&arg) override; - void assertionStarting(AssertionInfo const&) override; + void assertionStarting(AssertionInfo const&) override; - bool assertionEnded(AssertionStats const& _assertionStats) override; + bool assertionEnded(AssertionStats const& _assertionStats) override; - void sectionStarting(SectionInfo const& _sectionInfo) override; - void sectionEnded(SectionStats const& _sectionStats) override; + void sectionStarting(SectionInfo const& _sectionInfo) override; + void sectionEnded(SectionStats const& _sectionStats) override; #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) - void benchmarkPreparing(std::string const& name) override; + void benchmarkPreparing(std::string const& name) override; void benchmarkStarting(BenchmarkInfo const& info) override; void benchmarkEnded(BenchmarkStats<> const& stats) override; void benchmarkFailed(std::string const& error) override; #endif // CATCH_CONFIG_ENABLE_BENCHMARKING - void testCaseEnded(TestCaseStats const& _testCaseStats) override; - void testGroupEnded(TestGroupStats const& _testGroupStats) override; - void testRunEnded(TestRunStats const& _testRunStats) override; - void testRunStarting(TestRunInfo const& _testRunInfo) override; -private: + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + void testGroupEnded(TestGroupStats const& _testGroupStats) override; + void testRunEnded(TestRunStats const& _testRunStats) override; + void testRunStarting(TestRunInfo const& _testRunInfo) override; + private: - void lazyPrint(); + void lazyPrint(); - void lazyPrintWithoutClosingBenchmarkTable(); - void lazyPrintRunInfo(); - void lazyPrintGroupInfo(); - void printTestCaseAndSectionHeader(); + void lazyPrintWithoutClosingBenchmarkTable(); + void lazyPrintRunInfo(); + void lazyPrintGroupInfo(); + void printTestCaseAndSectionHeader(); - void printClosedHeader(std::string const& _name); - void printOpenHeader(std::string const& _name); + void printClosedHeader(std::string const& _name); + void printOpenHeader(std::string const& _name); - // if string has a : in first line will set indent to follow it on - // subsequent lines - void printHeaderString(std::string const& _string, std::size_t indent = 0); + // if string has a : in first line will set indent to follow it on + // subsequent lines + void printHeaderString(std::string const& _string, std::size_t indent = 0); - void printTotals(Totals const& totals); - void printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row); + void printTotals(Totals const& totals); + void printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row); - void printTotalsDivider(Totals const& totals); - void printSummaryDivider(); - void printTestFilters(); + void printTotalsDivider(Totals const& totals); + void printSummaryDivider(); + void printTestFilters(); -private: - bool m_headerPrinted = false; -}; + private: + bool m_headerPrinted = false; + }; } // end namespace Catch @@ -6222,150 +6222,150 @@ struct ConsoleReporter : StreamingReporterBase { #include namespace Catch { -enum class XmlFormatting { - None = 0x00, - Indent = 0x01, - Newline = 0x02, -}; - -XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs); -XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs); + enum class XmlFormatting { + None = 0x00, + Indent = 0x01, + Newline = 0x02, + }; -class XmlEncode { -public: - enum ForWhat { ForTextNodes, ForAttributes }; + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs); + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs); - XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ); + class XmlEncode { + public: + enum ForWhat { ForTextNodes, ForAttributes }; - void encodeTo( std::ostream& os ) const; + XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ); - friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ); + void encodeTo( std::ostream& os ) const; -private: - std::string m_str; - ForWhat m_forWhat; -}; + friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ); -class XmlWriter { -public: + private: + std::string m_str; + ForWhat m_forWhat; + }; - class ScopedElement { + class XmlWriter { public: - ScopedElement( XmlWriter* writer, XmlFormatting fmt ); - ScopedElement( ScopedElement&& other ) noexcept; - ScopedElement& operator=( ScopedElement&& other ) noexcept; + class ScopedElement { + public: + ScopedElement( XmlWriter* writer, XmlFormatting fmt ); - ~ScopedElement(); + ScopedElement( ScopedElement&& other ) noexcept; + ScopedElement& operator=( ScopedElement&& other ) noexcept; - ScopedElement& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent ); + ~ScopedElement(); - template - ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { - m_writer->writeAttribute( name, attribute ); - return *this; - } + ScopedElement& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent ); - private: - mutable XmlWriter* m_writer = nullptr; - XmlFormatting m_fmt; - }; + template + ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { + m_writer->writeAttribute( name, attribute ); + return *this; + } - XmlWriter( std::ostream& os = Catch::cout() ); - ~XmlWriter(); + private: + mutable XmlWriter* m_writer = nullptr; + XmlFormatting m_fmt; + }; - XmlWriter( XmlWriter const& ) = delete; - XmlWriter& operator=( XmlWriter const& ) = delete; + XmlWriter( std::ostream& os = Catch::cout() ); + ~XmlWriter(); - XmlWriter& startElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + XmlWriter( XmlWriter const& ) = delete; + XmlWriter& operator=( XmlWriter const& ) = delete; - ScopedElement scopedElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + XmlWriter& startElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + ScopedElement scopedElement( std::string const& name, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ); + XmlWriter& endElement(XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - XmlWriter& writeAttribute( std::string const& name, bool attribute ); + XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ); - template - XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { - ReusableStringStream rss; - rss << attribute; - return writeAttribute( name, rss.str() ); - } + XmlWriter& writeAttribute( std::string const& name, bool attribute ); + + template + XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { + ReusableStringStream rss; + rss << attribute; + return writeAttribute( name, rss.str() ); + } - XmlWriter& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + XmlWriter& writeText( std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - XmlWriter& writeComment(std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); + XmlWriter& writeComment(std::string const& text, XmlFormatting fmt = XmlFormatting::Newline | XmlFormatting::Indent); - void writeStylesheetRef( std::string const& url ); + void writeStylesheetRef( std::string const& url ); - XmlWriter& writeBlankLine(); + XmlWriter& writeBlankLine(); - void ensureTagClosed(); + void ensureTagClosed(); -private: + private: - void applyFormatting(XmlFormatting fmt); + void applyFormatting(XmlFormatting fmt); - void writeDeclaration(); + void writeDeclaration(); - void newlineIfNecessary(); + void newlineIfNecessary(); - bool m_tagIsOpen = false; - bool m_needsNewline = false; - std::vector m_tags; - std::string m_indent; - std::ostream& m_os; -}; + bool m_tagIsOpen = false; + bool m_needsNewline = false; + std::vector m_tags; + std::string m_indent; + std::ostream& m_os; + }; } // end catch_xmlwriter.h namespace Catch { -class JunitReporter : public CumulativeReporterBase { -public: - JunitReporter(ReporterConfig const& _config); + class JunitReporter : public CumulativeReporterBase { + public: + JunitReporter(ReporterConfig const& _config); - ~JunitReporter() override; + ~JunitReporter() override; - static std::string getDescription(); + static std::string getDescription(); - void noMatchingTestCases(std::string const& /*spec*/) override; + void noMatchingTestCases(std::string const& /*spec*/) override; - void testRunStarting(TestRunInfo const& runInfo) override; + void testRunStarting(TestRunInfo const& runInfo) override; - void testGroupStarting(GroupInfo const& groupInfo) override; + void testGroupStarting(GroupInfo const& groupInfo) override; - void testCaseStarting(TestCaseInfo const& testCaseInfo) override; - bool assertionEnded(AssertionStats const& assertionStats) override; + void testCaseStarting(TestCaseInfo const& testCaseInfo) override; + bool assertionEnded(AssertionStats const& assertionStats) override; - void testCaseEnded(TestCaseStats const& testCaseStats) override; + void testCaseEnded(TestCaseStats const& testCaseStats) override; - void testGroupEnded(TestGroupStats const& testGroupStats) override; + void testGroupEnded(TestGroupStats const& testGroupStats) override; - void testRunEndedCumulative() override; + void testRunEndedCumulative() override; - void writeGroup(TestGroupNode const& groupNode, double suiteTime); + void writeGroup(TestGroupNode const& groupNode, double suiteTime); - void writeTestCase(TestCaseNode const& testCaseNode); + void writeTestCase(TestCaseNode const& testCaseNode); - void writeSection( std::string const& className, - std::string const& rootName, - SectionNode const& sectionNode, - bool testOkToFail ); + void writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode, + bool testOkToFail ); - void writeAssertions(SectionNode const& sectionNode); - void writeAssertion(AssertionStats const& stats); + void writeAssertions(SectionNode const& sectionNode); + void writeAssertion(AssertionStats const& stats); - XmlWriter xml; - Timer suiteTimer; - std::string stdOutForSuite; - std::string stdErrForSuite; - unsigned int unexpectedExceptions = 0; - bool m_okToFail = false; -}; + XmlWriter xml; + Timer suiteTimer; + std::string stdOutForSuite; + std::string stdErrForSuite; + unsigned int unexpectedExceptions = 0; + bool m_okToFail = false; + }; } // end namespace Catch @@ -6373,54 +6373,54 @@ class JunitReporter : public CumulativeReporterBase { // start catch_reporter_xml.h namespace Catch { -class XmlReporter : public StreamingReporterBase { -public: - XmlReporter(ReporterConfig const& _config); + class XmlReporter : public StreamingReporterBase { + public: + XmlReporter(ReporterConfig const& _config); - ~XmlReporter() override; + ~XmlReporter() override; - static std::string getDescription(); + static std::string getDescription(); - virtual std::string getStylesheetRef() const; + virtual std::string getStylesheetRef() const; - void writeSourceInfo(SourceLineInfo const& sourceInfo); + void writeSourceInfo(SourceLineInfo const& sourceInfo); -public: // StreamingReporterBase + public: // StreamingReporterBase - void noMatchingTestCases(std::string const& s) override; + void noMatchingTestCases(std::string const& s) override; - void testRunStarting(TestRunInfo const& testInfo) override; + void testRunStarting(TestRunInfo const& testInfo) override; - void testGroupStarting(GroupInfo const& groupInfo) override; + void testGroupStarting(GroupInfo const& groupInfo) override; - void testCaseStarting(TestCaseInfo const& testInfo) override; + void testCaseStarting(TestCaseInfo const& testInfo) override; - void sectionStarting(SectionInfo const& sectionInfo) override; + void sectionStarting(SectionInfo const& sectionInfo) override; - void assertionStarting(AssertionInfo const&) override; + void assertionStarting(AssertionInfo const&) override; - bool assertionEnded(AssertionStats const& assertionStats) override; + bool assertionEnded(AssertionStats const& assertionStats) override; - void sectionEnded(SectionStats const& sectionStats) override; + void sectionEnded(SectionStats const& sectionStats) override; - void testCaseEnded(TestCaseStats const& testCaseStats) override; + void testCaseEnded(TestCaseStats const& testCaseStats) override; - void testGroupEnded(TestGroupStats const& testGroupStats) override; + void testGroupEnded(TestGroupStats const& testGroupStats) override; - void testRunEnded(TestRunStats const& testRunStats) override; + void testRunEnded(TestRunStats const& testRunStats) override; #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) - void benchmarkPreparing(std::string const& name) override; + void benchmarkPreparing(std::string const& name) override; void benchmarkStarting(BenchmarkInfo const&) override; void benchmarkEnded(BenchmarkStats<> const&) override; void benchmarkFailed(std::string const&) override; #endif // CATCH_CONFIG_ENABLE_BENCHMARKING -private: - Timer m_testCaseTimer; - XmlWriter m_xml; - int m_sectionDepth = 0; -}; + private: + Timer m_testCaseTimer; + XmlWriter m_xml; + int m_sectionDepth = 0; + }; } // end namespace Catch @@ -7475,154 +7475,154 @@ namespace Catch { namespace Catch { namespace TestCaseTracking { -struct NameAndLocation { - std::string name; - SourceLineInfo location; + struct NameAndLocation { + std::string name; + SourceLineInfo location; - NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); - friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) { - return lhs.name == rhs.name - && lhs.location == rhs.location; - } -}; + NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); + friend bool operator==(NameAndLocation const& lhs, NameAndLocation const& rhs) { + return lhs.name == rhs.name + && lhs.location == rhs.location; + } + }; -class ITracker; + class ITracker; -using ITrackerPtr = std::shared_ptr; + using ITrackerPtr = std::shared_ptr; -class ITracker { - NameAndLocation m_nameAndLocation; + class ITracker { + NameAndLocation m_nameAndLocation; -public: - ITracker(NameAndLocation const& nameAndLoc) : + public: + ITracker(NameAndLocation const& nameAndLoc) : m_nameAndLocation(nameAndLoc) - {} - - // static queries - NameAndLocation const& nameAndLocation() const { - return m_nameAndLocation; - } - - virtual ~ITracker(); + {} - // dynamic queries - virtual bool isComplete() const = 0; // Successfully completed or failed - virtual bool isSuccessfullyCompleted() const = 0; - virtual bool isOpen() const = 0; // Started but not complete - virtual bool hasChildren() const = 0; - virtual bool hasStarted() const = 0; + // static queries + NameAndLocation const& nameAndLocation() const { + return m_nameAndLocation; + } - virtual ITracker& parent() = 0; + virtual ~ITracker(); - // actions - virtual void close() = 0; // Successfully complete - virtual void fail() = 0; - virtual void markAsNeedingAnotherRun() = 0; + // dynamic queries + virtual bool isComplete() const = 0; // Successfully completed or failed + virtual bool isSuccessfullyCompleted() const = 0; + virtual bool isOpen() const = 0; // Started but not complete + virtual bool hasChildren() const = 0; + virtual bool hasStarted() const = 0; - virtual void addChild( ITrackerPtr const& child ) = 0; - virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0; - virtual void openChild() = 0; + virtual ITracker& parent() = 0; - // Debug/ checking - virtual bool isSectionTracker() const = 0; - virtual bool isGeneratorTracker() const = 0; -}; + // actions + virtual void close() = 0; // Successfully complete + virtual void fail() = 0; + virtual void markAsNeedingAnotherRun() = 0; -class TrackerContext { + virtual void addChild( ITrackerPtr const& child ) = 0; + virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0; + virtual void openChild() = 0; - enum RunState { - NotStarted, - Executing, - CompletedCycle + // Debug/ checking + virtual bool isSectionTracker() const = 0; + virtual bool isGeneratorTracker() const = 0; }; - ITrackerPtr m_rootTracker; - ITracker* m_currentTracker = nullptr; - RunState m_runState = NotStarted; + class TrackerContext { -public: + enum RunState { + NotStarted, + Executing, + CompletedCycle + }; + + ITrackerPtr m_rootTracker; + ITracker* m_currentTracker = nullptr; + RunState m_runState = NotStarted; - ITracker& startRun(); - void endRun(); + public: - void startCycle(); - void completeCycle(); + ITracker& startRun(); + void endRun(); - bool completedCycle() const; - ITracker& currentTracker(); - void setCurrentTracker( ITracker* tracker ); -}; + void startCycle(); + void completeCycle(); -class TrackerBase : public ITracker { -protected: - enum CycleState { - NotStarted, - Executing, - ExecutingChildren, - NeedsAnotherRun, - CompletedSuccessfully, - Failed + bool completedCycle() const; + ITracker& currentTracker(); + void setCurrentTracker( ITracker* tracker ); }; - using Children = std::vector; - TrackerContext& m_ctx; - ITracker* m_parent; - Children m_children; - CycleState m_runState = NotStarted; + class TrackerBase : public ITracker { + protected: + enum CycleState { + NotStarted, + Executing, + ExecutingChildren, + NeedsAnotherRun, + CompletedSuccessfully, + Failed + }; -public: - TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + using Children = std::vector; + TrackerContext& m_ctx; + ITracker* m_parent; + Children m_children; + CycleState m_runState = NotStarted; - bool isComplete() const override; - bool isSuccessfullyCompleted() const override; - bool isOpen() const override; - bool hasChildren() const override; - bool hasStarted() const override { - return m_runState != NotStarted; - } + public: + TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isComplete() const override; + bool isSuccessfullyCompleted() const override; + bool isOpen() const override; + bool hasChildren() const override; + bool hasStarted() const override { + return m_runState != NotStarted; + } - void addChild( ITrackerPtr const& child ) override; + void addChild( ITrackerPtr const& child ) override; - ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override; - ITracker& parent() override; + ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override; + ITracker& parent() override; - void openChild() override; + void openChild() override; - bool isSectionTracker() const override; - bool isGeneratorTracker() const override; + bool isSectionTracker() const override; + bool isGeneratorTracker() const override; - void open(); + void open(); - void close() override; - void fail() override; - void markAsNeedingAnotherRun() override; + void close() override; + void fail() override; + void markAsNeedingAnotherRun() override; -private: - void moveToParent(); - void moveToThis(); -}; + private: + void moveToParent(); + void moveToThis(); + }; -class SectionTracker : public TrackerBase { - std::vector m_filters; - std::string m_trimmed_name; -public: - SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + class SectionTracker : public TrackerBase { + std::vector m_filters; + std::string m_trimmed_name; + public: + SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); - bool isSectionTracker() const override; + bool isSectionTracker() const override; - bool isComplete() const override; + bool isComplete() const override; - static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); + static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); - void tryOpen(); + void tryOpen(); - void addInitialFilters( std::vector const& filters ); - void addNextFilters( std::vector const& filters ); - //! Returns filters active in this tracker - std::vector const& getFilters() const; - //! Returns whitespace-trimmed name of the tracked section - std::string const& trimmedName() const; -}; + void addInitialFilters( std::vector const& filters ); + void addNextFilters( std::vector const& filters ); + //! Returns filters active in this tracker + std::vector const& getFilters() const; + //! Returns whitespace-trimmed name of the tracked section + std::string const& trimmedName() const; + }; } // namespace TestCaseTracking @@ -7638,10 +7638,10 @@ using TestCaseTracking::SectionTracker; namespace Catch { -struct LeakDetector { - LeakDetector(); - ~LeakDetector(); -}; + struct LeakDetector { + LeakDetector(); + ~LeakDetector(); + }; } // end catch_leak_detector.h @@ -7875,59 +7875,59 @@ bool marginComparison(double lhs, double rhs, double margin) { namespace Catch { namespace Detail { -Approx::Approx ( double value ) - : m_epsilon( std::numeric_limits::epsilon()*100 ), - m_margin( 0.0 ), - m_scale( 0.0 ), - m_value( value ) -{} + Approx::Approx ( double value ) + : m_epsilon( std::numeric_limits::epsilon()*100 ), + m_margin( 0.0 ), + m_scale( 0.0 ), + m_value( value ) + {} -Approx Approx::custom() { - return Approx( 0 ); -} + Approx Approx::custom() { + return Approx( 0 ); + } -Approx Approx::operator-() const { - auto temp(*this); - temp.m_value = -temp.m_value; - return temp; -} + Approx Approx::operator-() const { + auto temp(*this); + temp.m_value = -temp.m_value; + return temp; + } -std::string Approx::toString() const { - ReusableStringStream rss; - rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )"; - return rss.str(); -} + std::string Approx::toString() const { + ReusableStringStream rss; + rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )"; + return rss.str(); + } -bool Approx::equalityComparisonImpl(const double other) const { - // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value - // Thanks to Richard Harris for his help refining the scaled margin value - return marginComparison(m_value, other, m_margin) - || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value))); -} + bool Approx::equalityComparisonImpl(const double other) const { + // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value + // Thanks to Richard Harris for his help refining the scaled margin value + return marginComparison(m_value, other, m_margin) + || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(std::isinf(m_value)? 0 : m_value))); + } -void Approx::setMargin(double newMargin) { - CATCH_ENFORCE(newMargin >= 0, - "Invalid Approx::margin: " << newMargin << '.' - << " Approx::Margin has to be non-negative."); - m_margin = newMargin; -} + void Approx::setMargin(double newMargin) { + CATCH_ENFORCE(newMargin >= 0, + "Invalid Approx::margin: " << newMargin << '.' + << " Approx::Margin has to be non-negative."); + m_margin = newMargin; + } -void Approx::setEpsilon(double newEpsilon) { - CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0, - "Invalid Approx::epsilon: " << newEpsilon << '.' - << " Approx::epsilon has to be in [0, 1]"); - m_epsilon = newEpsilon; -} + void Approx::setEpsilon(double newEpsilon) { + CATCH_ENFORCE(newEpsilon >= 0 && newEpsilon <= 1.0, + "Invalid Approx::epsilon: " << newEpsilon << '.' + << " Approx::epsilon has to be in [0, 1]"); + m_epsilon = newEpsilon; + } } // end namespace Detail namespace literals { -Detail::Approx operator "" _a(long double val) { - return Detail::Approx(val); -} -Detail::Approx operator "" _a(unsigned long long val) { - return Detail::Approx(val); -} + Detail::Approx operator "" _a(long double val) { + return Detail::Approx(val); + } + Detail::Approx operator "" _a(unsigned long long val) { + return Detail::Approx(val); + } } // end namespace literals std::string StringMaker::convert(Catch::Detail::Approx const& value) { @@ -7941,20 +7941,20 @@ std::string StringMaker::convert(Catch::Detail::Approx co // start catch_debugger.h namespace Catch { -bool isDebuggerActive(); + bool isDebuggerActive(); } #ifdef CATCH_PLATFORM_MAC -#if defined(__i386__) || defined(__x86_64__) -#define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ -#elif defined(__aarch64__) -#define CATCH_TRAP() __asm__(".inst 0xd4200000") -#endif + #if defined(__i386__) || defined(__x86_64__) + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + #elif defined(__aarch64__) + #define CATCH_TRAP() __asm__(".inst 0xd4200000") + #endif #elif defined(CATCH_PLATFORM_IPHONE) -// use inline assembler + // use inline assembler #if defined(__i386__) || defined(__x86_64__) #define CATCH_TRAP() __asm__("int $3") #elif defined(__aarch64__) @@ -7984,11 +7984,11 @@ bool isDebuggerActive(); #endif #ifndef CATCH_BREAK_INTO_DEBUGGER -#ifdef CATCH_TRAP -#define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() -#else -#define CATCH_BREAK_INTO_DEBUGGER() []{}() -#endif + #ifdef CATCH_TRAP + #define CATCH_BREAK_INTO_DEBUGGER() []{ if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } }() + #else + #define CATCH_BREAK_INTO_DEBUGGER() []{}() + #endif #endif // end catch_debugger.h @@ -8000,52 +8000,52 @@ bool isDebuggerActive(); namespace Catch { -// Wrapper for platform-specific fatal error (signals/SEH) handlers -// -// Tries to be cooperative with other handlers, and not step over -// other handlers. This means that unknown structured exceptions -// are passed on, previous signal handlers are called, and so on. -// -// Can only be instantiated once, and assumes that once a signal -// is caught, the binary will end up terminating. Thus, there -class FatalConditionHandler { - bool m_started = false; - - // Install/disengage implementation for specific platform. - // Should be if-defed to work on current platform, can assume - // engage-disengage 1:1 pairing. - void engage_platform(); - void disengage_platform(); -public: - // Should also have platform-specific implementations as needed - FatalConditionHandler(); - ~FatalConditionHandler(); - - void engage() { - assert(!m_started && "Handler cannot be installed twice."); - m_started = true; - engage_platform(); - } + // Wrapper for platform-specific fatal error (signals/SEH) handlers + // + // Tries to be cooperative with other handlers, and not step over + // other handlers. This means that unknown structured exceptions + // are passed on, previous signal handlers are called, and so on. + // + // Can only be instantiated once, and assumes that once a signal + // is caught, the binary will end up terminating. Thus, there + class FatalConditionHandler { + bool m_started = false; + + // Install/disengage implementation for specific platform. + // Should be if-defed to work on current platform, can assume + // engage-disengage 1:1 pairing. + void engage_platform(); + void disengage_platform(); + public: + // Should also have platform-specific implementations as needed + FatalConditionHandler(); + ~FatalConditionHandler(); + + void engage() { + assert(!m_started && "Handler cannot be installed twice."); + m_started = true; + engage_platform(); + } - void disengage() { - assert(m_started && "Handler cannot be uninstalled without being installed first"); - m_started = false; - disengage_platform(); - } -}; + void disengage() { + assert(m_started && "Handler cannot be uninstalled without being installed first"); + m_started = false; + disengage_platform(); + } + }; -//! Simple RAII guard for (dis)engaging the FatalConditionHandler -class FatalConditionHandlerGuard { - FatalConditionHandler* m_handler; -public: - FatalConditionHandlerGuard(FatalConditionHandler* handler): + //! Simple RAII guard for (dis)engaging the FatalConditionHandler + class FatalConditionHandlerGuard { + FatalConditionHandler* m_handler; + public: + FatalConditionHandlerGuard(FatalConditionHandler* handler): m_handler(handler) { - m_handler->engage(); - } - ~FatalConditionHandlerGuard() { - m_handler->disengage(); - } -}; + m_handler->engage(); + } + ~FatalConditionHandlerGuard() { + m_handler->disengage(); + } + }; } // end namespace Catch @@ -8054,334 +8054,334 @@ class FatalConditionHandlerGuard { namespace Catch { -struct IMutableContext; + struct IMutableContext; -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// -class RunContext : public IResultCapture, public IRunner { + class RunContext : public IResultCapture, public IRunner { -public: - RunContext( RunContext const& ) = delete; - RunContext& operator =( RunContext const& ) = delete; - - explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter ); - - ~RunContext() override; - - void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ); - void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ); - - Totals runTest(TestCase const& testCase); - - IConfigPtr config() const; - IStreamingReporter& reporter() const; - -public: // IResultCapture - - // Assertion handlers - void handleExpr - ( AssertionInfo const& info, - ITransientExpression const& expr, - AssertionReaction& reaction ) override; - void handleMessage - ( AssertionInfo const& info, - ResultWas::OfType resultType, - StringRef const& message, - AssertionReaction& reaction ) override; - void handleUnexpectedExceptionNotThrown - ( AssertionInfo const& info, - AssertionReaction& reaction ) override; - void handleUnexpectedInflightException - ( AssertionInfo const& info, - std::string const& message, - AssertionReaction& reaction ) override; - void handleIncomplete - ( AssertionInfo const& info ) override; - void handleNonExpr - ( AssertionInfo const &info, - ResultWas::OfType resultType, - AssertionReaction &reaction ) override; - - bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; - - void sectionEnded( SectionEndInfo const& endInfo ) override; - void sectionEndedEarly( SectionEndInfo const& endInfo ) override; - - auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; + public: + RunContext( RunContext const& ) = delete; + RunContext& operator =( RunContext const& ) = delete; + + explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter ); + + ~RunContext() override; + + void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ); + void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ); + + Totals runTest(TestCase const& testCase); + + IConfigPtr config() const; + IStreamingReporter& reporter() const; + + public: // IResultCapture + + // Assertion handlers + void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) override; + void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) override; + void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) override; + void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) override; + void handleIncomplete + ( AssertionInfo const& info ) override; + void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) override; + + bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; + + void sectionEnded( SectionEndInfo const& endInfo ) override; + void sectionEndedEarly( SectionEndInfo const& endInfo ) override; + + auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) - void benchmarkPreparing( std::string const& name ) override; + void benchmarkPreparing( std::string const& name ) override; void benchmarkStarting( BenchmarkInfo const& info ) override; void benchmarkEnded( BenchmarkStats<> const& stats ) override; void benchmarkFailed( std::string const& error ) override; #endif // CATCH_CONFIG_ENABLE_BENCHMARKING - void pushScopedMessage( MessageInfo const& message ) override; - void popScopedMessage( MessageInfo const& message ) override; + void pushScopedMessage( MessageInfo const& message ) override; + void popScopedMessage( MessageInfo const& message ) override; - void emplaceUnscopedMessage( MessageBuilder const& builder ) override; + void emplaceUnscopedMessage( MessageBuilder const& builder ) override; - std::string getCurrentTestName() const override; + std::string getCurrentTestName() const override; - const AssertionResult* getLastResult() const override; + const AssertionResult* getLastResult() const override; - void exceptionEarlyReported() override; + void exceptionEarlyReported() override; - void handleFatalErrorCondition( StringRef message ) override; + void handleFatalErrorCondition( StringRef message ) override; - bool lastAssertionPassed() override; + bool lastAssertionPassed() override; - void assertionPassed() override; + void assertionPassed() override; -public: - // !TBD We need to do this another way! - bool aborting() const final; + public: + // !TBD We need to do this another way! + bool aborting() const final; -private: + private: - void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ); - void invokeActiveTestCase(); + void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ); + void invokeActiveTestCase(); - void resetAssertionInfo(); - bool testForMissingAssertions( Counts& assertions ); + void resetAssertionInfo(); + bool testForMissingAssertions( Counts& assertions ); - void assertionEnded( AssertionResult const& result ); - void reportExpr - ( AssertionInfo const &info, - ResultWas::OfType resultType, - ITransientExpression const *expr, - bool negated ); + void assertionEnded( AssertionResult const& result ); + void reportExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ); - void populateReaction( AssertionReaction& reaction ); + void populateReaction( AssertionReaction& reaction ); -private: + private: - void handleUnfinishedSections(); - - TestRunInfo m_runInfo; - IMutableContext& m_context; - TestCase const* m_activeTestCase = nullptr; - ITracker* m_testCaseTracker = nullptr; - Option m_lastResult; - - IConfigPtr m_config; - Totals m_totals; - IStreamingReporterPtr m_reporter; - std::vector m_messages; - std::vector m_messageScopes; /* Keeps owners of so-called unscoped messages. */ - AssertionInfo m_lastAssertionInfo; - std::vector m_unfinishedSections; - std::vector m_activeSections; - TrackerContext m_trackerContext; - FatalConditionHandler m_fatalConditionhandler; - bool m_lastAssertionPassed = false; - bool m_shouldReportUnexpected = true; - bool m_includeSuccessfulResults; -}; + void handleUnfinishedSections(); + + TestRunInfo m_runInfo; + IMutableContext& m_context; + TestCase const* m_activeTestCase = nullptr; + ITracker* m_testCaseTracker = nullptr; + Option m_lastResult; + + IConfigPtr m_config; + Totals m_totals; + IStreamingReporterPtr m_reporter; + std::vector m_messages; + std::vector m_messageScopes; /* Keeps owners of so-called unscoped messages. */ + AssertionInfo m_lastAssertionInfo; + std::vector m_unfinishedSections; + std::vector m_activeSections; + TrackerContext m_trackerContext; + FatalConditionHandler m_fatalConditionhandler; + bool m_lastAssertionPassed = false; + bool m_shouldReportUnexpected = true; + bool m_includeSuccessfulResults; + }; -void seedRng(IConfig const& config); -unsigned int rngSeed(); + void seedRng(IConfig const& config); + unsigned int rngSeed(); } // end namespace Catch // end catch_run_context.h namespace Catch { -namespace { -auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { - expr.streamReconstructedExpression( os ); - return os; -} -} + namespace { + auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { + expr.streamReconstructedExpression( os ); + return os; + } + } -LazyExpression::LazyExpression( bool isNegated ) - : m_isNegated( isNegated ) -{} + LazyExpression::LazyExpression( bool isNegated ) + : m_isNegated( isNegated ) + {} -LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {} + LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {} -LazyExpression::operator bool() const { - return m_transientExpression != nullptr; -} + LazyExpression::operator bool() const { + return m_transientExpression != nullptr; + } -auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& { - if( lazyExpr.m_isNegated ) - os << "!"; + auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& { + if( lazyExpr.m_isNegated ) + os << "!"; - if( lazyExpr ) { - if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() ) - os << "(" << *lazyExpr.m_transientExpression << ")"; - else - os << *lazyExpr.m_transientExpression; - } - else { - os << "{** error - unchecked empty expression requested **}"; + if( lazyExpr ) { + if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() ) + os << "(" << *lazyExpr.m_transientExpression << ")"; + else + os << *lazyExpr.m_transientExpression; + } + else { + os << "{** error - unchecked empty expression requested **}"; + } + return os; } - return os; -} -AssertionHandler::AssertionHandler + AssertionHandler::AssertionHandler ( StringRef const& macroName, SourceLineInfo const& lineInfo, StringRef capturedExpression, ResultDisposition::Flags resultDisposition ) - : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition }, - m_resultCapture( getResultCapture() ) -{} + : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition }, + m_resultCapture( getResultCapture() ) + {} -void AssertionHandler::handleExpr( ITransientExpression const& expr ) { - m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); -} -void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) { - m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction ); -} + void AssertionHandler::handleExpr( ITransientExpression const& expr ) { + m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); + } + void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) { + m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction ); + } -auto AssertionHandler::allowThrows() const -> bool { - return getCurrentContext().getConfig()->allowThrows(); -} + auto AssertionHandler::allowThrows() const -> bool { + return getCurrentContext().getConfig()->allowThrows(); + } -void AssertionHandler::complete() { - setCompleted(); - if( m_reaction.shouldDebugBreak ) { + void AssertionHandler::complete() { + setCompleted(); + if( m_reaction.shouldDebugBreak ) { - // If you find your debugger stopping you here then go one level up on the - // call-stack for the code that caused it (typically a failed assertion) + // If you find your debugger stopping you here then go one level up on the + // call-stack for the code that caused it (typically a failed assertion) - // (To go back to the test and change execution, jump over the throw, next) - CATCH_BREAK_INTO_DEBUGGER(); - } - if (m_reaction.shouldThrow) { + // (To go back to the test and change execution, jump over the throw, next) + CATCH_BREAK_INTO_DEBUGGER(); + } + if (m_reaction.shouldThrow) { #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - throw Catch::TestFailureException(); + throw Catch::TestFailureException(); #else - CATCH_ERROR( "Test failure requires aborting test!" ); + CATCH_ERROR( "Test failure requires aborting test!" ); #endif + } + } + void AssertionHandler::setCompleted() { + m_completed = true; } -} -void AssertionHandler::setCompleted() { - m_completed = true; -} -void AssertionHandler::handleUnexpectedInflightException() { - m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction ); -} + void AssertionHandler::handleUnexpectedInflightException() { + m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction ); + } -void AssertionHandler::handleExceptionThrownAsExpected() { - m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); -} -void AssertionHandler::handleExceptionNotThrownAsExpected() { - m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); -} + void AssertionHandler::handleExceptionThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + void AssertionHandler::handleExceptionNotThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } -void AssertionHandler::handleUnexpectedExceptionNotThrown() { - m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction ); -} + void AssertionHandler::handleUnexpectedExceptionNotThrown() { + m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction ); + } -void AssertionHandler::handleThrowingCallSkipped() { - m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); -} + void AssertionHandler::handleThrowingCallSkipped() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } -// This is the overload that takes a string and infers the Equals matcher from it -// The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp -void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ) { - handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); -} + // This is the overload that takes a string and infers the Equals matcher from it + // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + } } // namespace Catch // end catch_assertionhandler.cpp // start catch_assertionresult.cpp namespace Catch { -AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression): + AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression): lazyExpression(_lazyExpression), resultType(_resultType) {} -std::string AssertionResultData::reconstructExpression() const { + std::string AssertionResultData::reconstructExpression() const { - if( reconstructedExpression.empty() ) { - if( lazyExpression ) { - ReusableStringStream rss; - rss << lazyExpression; - reconstructedExpression = rss.str(); + if( reconstructedExpression.empty() ) { + if( lazyExpression ) { + ReusableStringStream rss; + rss << lazyExpression; + reconstructedExpression = rss.str(); + } } + return reconstructedExpression; } - return reconstructedExpression; -} - -AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) - : m_info( info ), - m_resultData( data ) -{} - -// Result was a success -bool AssertionResult::succeeded() const { - return Catch::isOk( m_resultData.resultType ); -} -// Result was a success, or failure is suppressed -bool AssertionResult::isOk() const { - return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition ); -} + AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) + : m_info( info ), + m_resultData( data ) + {} -ResultWas::OfType AssertionResult::getResultType() const { - return m_resultData.resultType; -} + // Result was a success + bool AssertionResult::succeeded() const { + return Catch::isOk( m_resultData.resultType ); + } -bool AssertionResult::hasExpression() const { - return !m_info.capturedExpression.empty(); -} + // Result was a success, or failure is suppressed + bool AssertionResult::isOk() const { + return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition ); + } -bool AssertionResult::hasMessage() const { - return !m_resultData.message.empty(); -} + ResultWas::OfType AssertionResult::getResultType() const { + return m_resultData.resultType; + } -std::string AssertionResult::getExpression() const { - // Possibly overallocating by 3 characters should be basically free - std::string expr; expr.reserve(m_info.capturedExpression.size() + 3); - if (isFalseTest(m_info.resultDisposition)) { - expr += "!("; + bool AssertionResult::hasExpression() const { + return !m_info.capturedExpression.empty(); } - expr += m_info.capturedExpression; - if (isFalseTest(m_info.resultDisposition)) { - expr += ')'; + + bool AssertionResult::hasMessage() const { + return !m_resultData.message.empty(); } - return expr; -} -std::string AssertionResult::getExpressionInMacro() const { - std::string expr; - if( m_info.macroName.empty() ) - expr = static_cast(m_info.capturedExpression); - else { - expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); - expr += m_info.macroName; - expr += "( "; + std::string AssertionResult::getExpression() const { + // Possibly overallocating by 3 characters should be basically free + std::string expr; expr.reserve(m_info.capturedExpression.size() + 3); + if (isFalseTest(m_info.resultDisposition)) { + expr += "!("; + } expr += m_info.capturedExpression; - expr += " )"; + if (isFalseTest(m_info.resultDisposition)) { + expr += ')'; + } + return expr; } - return expr; -} -bool AssertionResult::hasExpandedExpression() const { - return hasExpression() && getExpandedExpression() != getExpression(); -} + std::string AssertionResult::getExpressionInMacro() const { + std::string expr; + if( m_info.macroName.empty() ) + expr = static_cast(m_info.capturedExpression); + else { + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + expr += " )"; + } + return expr; + } -std::string AssertionResult::getExpandedExpression() const { - std::string expr = m_resultData.reconstructExpression(); - return expr.empty() - ? getExpression() - : expr; -} + bool AssertionResult::hasExpandedExpression() const { + return hasExpression() && getExpandedExpression() != getExpression(); + } -std::string AssertionResult::getMessage() const { - return m_resultData.message; -} -SourceLineInfo AssertionResult::getSourceInfo() const { - return m_info.lineInfo; -} + std::string AssertionResult::getExpandedExpression() const { + std::string expr = m_resultData.reconstructExpression(); + return expr.empty() + ? getExpression() + : expr; + } -StringRef AssertionResult::getTestMacroName() const { - return m_info.macroName; -} + std::string AssertionResult::getMessage() const { + return m_resultData.message; + } + SourceLineInfo AssertionResult::getSourceInfo() const { + return m_info.lineInfo; + } + + StringRef AssertionResult::getTestMacroName() const { + return m_info.macroName; + } } // end namespace Catch // end catch_assertionresult.cpp @@ -8389,16 +8389,16 @@ StringRef AssertionResult::getTestMacroName() const { namespace Catch { -using StringMatcher = Matchers::Impl::MatcherBase; + using StringMatcher = Matchers::Impl::MatcherBase; -// This is the general overload that takes a any string matcher -// There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers -// the Equals matcher (so the header does not mention matchers) -void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) { - std::string exceptionMessage = Catch::translateActiveException(); - MatchExpr expr( exceptionMessage, matcher, matcherString ); - handler.handleExpr( expr ); -} + // This is the general overload that takes a any string matcher + // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers + // the Equals matcher (so the header does not mention matchers) + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr expr( exceptionMessage, matcher, matcherString ); + handler.handleExpr( expr ); + } } // namespace Catch // end catch_capture_matchers.cpp @@ -8476,312 +8476,312 @@ namespace clara { namespace TextFlow { inline auto isWhitespace(char c) -> bool { - static std::string chars = " \t\n\r"; - return chars.find(c) != std::string::npos; + static std::string chars = " \t\n\r"; + return chars.find(c) != std::string::npos; } inline auto isBreakableBefore(char c) -> bool { - static std::string chars = "[({<|"; - return chars.find(c) != std::string::npos; + static std::string chars = "[({<|"; + return chars.find(c) != std::string::npos; } inline auto isBreakableAfter(char c) -> bool { - static std::string chars = "])}>.,:;*+-=&/\\"; - return chars.find(c) != std::string::npos; + static std::string chars = "])}>.,:;*+-=&/\\"; + return chars.find(c) != std::string::npos; } class Columns; class Column { - std::vector m_strings; - size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; - size_t m_indent = 0; - size_t m_initialIndent = std::string::npos; + std::vector m_strings; + size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; + size_t m_indent = 0; + size_t m_initialIndent = std::string::npos; public: - class iterator { - friend Column; - - Column const& m_column; - size_t m_stringIndex = 0; - size_t m_pos = 0; + class iterator { + friend Column; - size_t m_len = 0; - size_t m_end = 0; - bool m_suffix = false; + Column const& m_column; + size_t m_stringIndex = 0; + size_t m_pos = 0; - iterator(Column const& column, size_t stringIndex) - : m_column(column), - m_stringIndex(stringIndex) {} + size_t m_len = 0; + size_t m_end = 0; + bool m_suffix = false; - auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; } + iterator(Column const& column, size_t stringIndex) + : m_column(column), + m_stringIndex(stringIndex) {} - auto isBoundary(size_t at) const -> bool { - assert(at > 0); - assert(at <= line().size()); + auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; } - return at == line().size() || - (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) || - isBreakableBefore(line()[at]) || - isBreakableAfter(line()[at - 1]); - } - - void calcLength() { - assert(m_stringIndex < m_column.m_strings.size()); + auto isBoundary(size_t at) const -> bool { + assert(at > 0); + assert(at <= line().size()); - m_suffix = false; - auto width = m_column.m_width - indent(); - m_end = m_pos; - if (line()[m_pos] == '\n') { - ++m_end; - } - while (m_end < line().size() && line()[m_end] != '\n') - ++m_end; + return at == line().size() || + (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) || + isBreakableBefore(line()[at]) || + isBreakableAfter(line()[at - 1]); + } - if (m_end < m_pos + width) { - m_len = m_end - m_pos; - } else { - size_t len = width; - while (len > 0 && !isBoundary(m_pos + len)) - --len; - while (len > 0 && isWhitespace(line()[m_pos + len - 1])) - --len; - - if (len > 0) { - m_len = len; - } else { - m_suffix = true; - m_len = width - 1; - } - } - } + void calcLength() { + assert(m_stringIndex < m_column.m_strings.size()); + + m_suffix = false; + auto width = m_column.m_width - indent(); + m_end = m_pos; + if (line()[m_pos] == '\n') { + ++m_end; + } + while (m_end < line().size() && line()[m_end] != '\n') + ++m_end; + + if (m_end < m_pos + width) { + m_len = m_end - m_pos; + } else { + size_t len = width; + while (len > 0 && !isBoundary(m_pos + len)) + --len; + while (len > 0 && isWhitespace(line()[m_pos + len - 1])) + --len; + + if (len > 0) { + m_len = len; + } else { + m_suffix = true; + m_len = width - 1; + } + } + } - auto indent() const -> size_t { - auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos; - return initial == std::string::npos ? m_column.m_indent : initial; - } + auto indent() const -> size_t { + auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos; + return initial == std::string::npos ? m_column.m_indent : initial; + } - auto addIndentAndSuffix(std::string const &plain) const -> std::string { - return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain); - } + auto addIndentAndSuffix(std::string const &plain) const -> std::string { + return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain); + } - public: - using difference_type = std::ptrdiff_t; - using value_type = std::string; - using pointer = value_type * ; - using reference = value_type & ; - using iterator_category = std::forward_iterator_tag; - - explicit iterator(Column const& column) : m_column(column) { - assert(m_column.m_width > m_column.m_indent); - assert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent); - calcLength(); - if (m_len == 0) - m_stringIndex++; // Empty string - } - - auto operator *() const -> std::string { - assert(m_stringIndex < m_column.m_strings.size()); - assert(m_pos <= m_end); - return addIndentAndSuffix(line().substr(m_pos, m_len)); - } - - auto operator ++() -> iterator& { - m_pos += m_len; - if (m_pos < line().size() && line()[m_pos] == '\n') - m_pos += 1; - else - while (m_pos < line().size() && isWhitespace(line()[m_pos])) - ++m_pos; + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type * ; + using reference = value_type & ; + using iterator_category = std::forward_iterator_tag; + + explicit iterator(Column const& column) : m_column(column) { + assert(m_column.m_width > m_column.m_indent); + assert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent); + calcLength(); + if (m_len == 0) + m_stringIndex++; // Empty string + } - if (m_pos == line().size()) { - m_pos = 0; - ++m_stringIndex; - } - if (m_stringIndex < m_column.m_strings.size()) - calcLength(); - return *this; - } - auto operator ++(int) -> iterator { - iterator prev(*this); - operator++(); - return prev; - } + auto operator *() const -> std::string { + assert(m_stringIndex < m_column.m_strings.size()); + assert(m_pos <= m_end); + return addIndentAndSuffix(line().substr(m_pos, m_len)); + } - auto operator ==(iterator const& other) const -> bool { - return - m_pos == other.m_pos && - m_stringIndex == other.m_stringIndex && - &m_column == &other.m_column; - } - auto operator !=(iterator const& other) const -> bool { - return !operator==(other); - } - }; - using const_iterator = iterator; + auto operator ++() -> iterator& { + m_pos += m_len; + if (m_pos < line().size() && line()[m_pos] == '\n') + m_pos += 1; + else + while (m_pos < line().size() && isWhitespace(line()[m_pos])) + ++m_pos; + + if (m_pos == line().size()) { + m_pos = 0; + ++m_stringIndex; + } + if (m_stringIndex < m_column.m_strings.size()) + calcLength(); + return *this; + } + auto operator ++(int) -> iterator { + iterator prev(*this); + operator++(); + return prev; + } - explicit Column(std::string const& text) { m_strings.push_back(text); } + auto operator ==(iterator const& other) const -> bool { + return + m_pos == other.m_pos && + m_stringIndex == other.m_stringIndex && + &m_column == &other.m_column; + } + auto operator !=(iterator const& other) const -> bool { + return !operator==(other); + } + }; + using const_iterator = iterator; - auto width(size_t newWidth) -> Column& { - assert(newWidth > 0); - m_width = newWidth; - return *this; - } - auto indent(size_t newIndent) -> Column& { - m_indent = newIndent; - return *this; - } - auto initialIndent(size_t newIndent) -> Column& { - m_initialIndent = newIndent; - return *this; - } + explicit Column(std::string const& text) { m_strings.push_back(text); } - auto width() const -> size_t { return m_width; } - auto begin() const -> iterator { return iterator(*this); } - auto end() const -> iterator { return { *this, m_strings.size() }; } + auto width(size_t newWidth) -> Column& { + assert(newWidth > 0); + m_width = newWidth; + return *this; + } + auto indent(size_t newIndent) -> Column& { + m_indent = newIndent; + return *this; + } + auto initialIndent(size_t newIndent) -> Column& { + m_initialIndent = newIndent; + return *this; + } - inline friend std::ostream& operator << (std::ostream& os, Column const& col) { - bool first = true; - for (auto line : col) { - if (first) - first = false; - else - os << "\n"; - os << line; - } - return os; - } + auto width() const -> size_t { return m_width; } + auto begin() const -> iterator { return iterator(*this); } + auto end() const -> iterator { return { *this, m_strings.size() }; } + + inline friend std::ostream& operator << (std::ostream& os, Column const& col) { + bool first = true; + for (auto line : col) { + if (first) + first = false; + else + os << "\n"; + os << line; + } + return os; + } - auto operator + (Column const& other)->Columns; + auto operator + (Column const& other)->Columns; - auto toString() const -> std::string { - std::ostringstream oss; - oss << *this; - return oss.str(); - } + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } }; class Spacer : public Column { public: - explicit Spacer(size_t spaceWidth) : Column("") { - width(spaceWidth); - } + explicit Spacer(size_t spaceWidth) : Column("") { + width(spaceWidth); + } }; class Columns { - std::vector m_columns; + std::vector m_columns; public: - class iterator { - friend Columns; - struct EndTag {}; + class iterator { + friend Columns; + struct EndTag {}; - std::vector const& m_columns; - std::vector m_iterators; - size_t m_activeIterators; + std::vector const& m_columns; + std::vector m_iterators; + size_t m_activeIterators; - iterator(Columns const& columns, EndTag) - : m_columns(columns.m_columns), - m_activeIterators(0) { - m_iterators.reserve(m_columns.size()); + iterator(Columns const& columns, EndTag) + : m_columns(columns.m_columns), + m_activeIterators(0) { + m_iterators.reserve(m_columns.size()); - for (auto const& col : m_columns) - m_iterators.push_back(col.end()); - } - - public: - using difference_type = std::ptrdiff_t; - using value_type = std::string; - using pointer = value_type * ; - using reference = value_type & ; - using iterator_category = std::forward_iterator_tag; + for (auto const& col : m_columns) + m_iterators.push_back(col.end()); + } - explicit iterator(Columns const& columns) - : m_columns(columns.m_columns), - m_activeIterators(m_columns.size()) { - m_iterators.reserve(m_columns.size()); + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type * ; + using reference = value_type & ; + using iterator_category = std::forward_iterator_tag; - for (auto const& col : m_columns) - m_iterators.push_back(col.begin()); - } + explicit iterator(Columns const& columns) + : m_columns(columns.m_columns), + m_activeIterators(m_columns.size()) { + m_iterators.reserve(m_columns.size()); - auto operator ==(iterator const& other) const -> bool { - return m_iterators == other.m_iterators; - } - auto operator !=(iterator const& other) const -> bool { - return m_iterators != other.m_iterators; - } - auto operator *() const -> std::string { - std::string row, padding; + for (auto const& col : m_columns) + m_iterators.push_back(col.begin()); + } - for (size_t i = 0; i < m_columns.size(); ++i) { - auto width = m_columns[i].width(); - if (m_iterators[i] != m_columns[i].end()) { - std::string col = *m_iterators[i]; - row += padding + col; - if (col.size() < width) - padding = std::string(width - col.size(), ' '); - else - padding = ""; - } else { - padding += std::string(width, ' '); - } - } - return row; - } - auto operator ++() -> iterator& { - for (size_t i = 0; i < m_columns.size(); ++i) { - if (m_iterators[i] != m_columns[i].end()) - ++m_iterators[i]; - } - return *this; - } - auto operator ++(int) -> iterator { - iterator prev(*this); - operator++(); - return prev; - } - }; - using const_iterator = iterator; + auto operator ==(iterator const& other) const -> bool { + return m_iterators == other.m_iterators; + } + auto operator !=(iterator const& other) const -> bool { + return m_iterators != other.m_iterators; + } + auto operator *() const -> std::string { + std::string row, padding; + + for (size_t i = 0; i < m_columns.size(); ++i) { + auto width = m_columns[i].width(); + if (m_iterators[i] != m_columns[i].end()) { + std::string col = *m_iterators[i]; + row += padding + col; + if (col.size() < width) + padding = std::string(width - col.size(), ' '); + else + padding = ""; + } else { + padding += std::string(width, ' '); + } + } + return row; + } + auto operator ++() -> iterator& { + for (size_t i = 0; i < m_columns.size(); ++i) { + if (m_iterators[i] != m_columns[i].end()) + ++m_iterators[i]; + } + return *this; + } + auto operator ++(int) -> iterator { + iterator prev(*this); + operator++(); + return prev; + } + }; + using const_iterator = iterator; - auto begin() const -> iterator { return iterator(*this); } - auto end() const -> iterator { return { *this, iterator::EndTag() }; } + auto begin() const -> iterator { return iterator(*this); } + auto end() const -> iterator { return { *this, iterator::EndTag() }; } - auto operator += (Column const& col) -> Columns& { - m_columns.push_back(col); - return *this; - } - auto operator + (Column const& col) -> Columns { - Columns combined = *this; - combined += col; - return combined; - } + auto operator += (Column const& col) -> Columns& { + m_columns.push_back(col); + return *this; + } + auto operator + (Column const& col) -> Columns { + Columns combined = *this; + combined += col; + return combined; + } - inline friend std::ostream& operator << (std::ostream& os, Columns const& cols) { + inline friend std::ostream& operator << (std::ostream& os, Columns const& cols) { - bool first = true; - for (auto line : cols) { - if (first) - first = false; - else - os << "\n"; - os << line; - } - return os; - } + bool first = true; + for (auto line : cols) { + if (first) + first = false; + else + os << "\n"; + os << line; + } + return os; + } - auto toString() const -> std::string { - std::ostringstream oss; - oss << *this; - return oss.str(); - } + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } }; inline auto Column::operator + (Column const& other) -> Columns { - Columns cols; - cols += *this; - cols += other; - return cols; + Columns cols; + cols += *this; + cols += other; + return cols; } } @@ -8804,297 +8804,297 @@ inline auto Column::operator + (Column const& other) -> Columns { namespace Catch { namespace clara { namespace detail { -// Traits for extracting arg and return type of lambdas (for single argument lambdas) -template -struct UnaryLambdaTraits : UnaryLambdaTraits {}; + // Traits for extracting arg and return type of lambdas (for single argument lambdas) + template + struct UnaryLambdaTraits : UnaryLambdaTraits {}; -template -struct UnaryLambdaTraits { - static const bool isValid = false; -}; + template + struct UnaryLambdaTraits { + static const bool isValid = false; + }; -template -struct UnaryLambdaTraits { - static const bool isValid = true; - using ArgType = typename std::remove_const::type>::type; - using ReturnType = ReturnT; -}; + template + struct UnaryLambdaTraits { + static const bool isValid = true; + using ArgType = typename std::remove_const::type>::type; + using ReturnType = ReturnT; + }; -class TokenStream; + class TokenStream; -// Transport for raw args (copied from main args, or supplied via init list for testing) -class Args { - friend TokenStream; - std::string m_exeName; - std::vector m_args; + // Transport for raw args (copied from main args, or supplied via init list for testing) + class Args { + friend TokenStream; + std::string m_exeName; + std::vector m_args; -public: - Args( int argc, char const* const* argv ) + public: + Args( int argc, char const* const* argv ) : m_exeName(argv[0]), m_args(argv + 1, argv + argc) {} - Args( std::initializer_list args ) - : m_exeName( *args.begin() ), - m_args( args.begin()+1, args.end() ) - {} + Args( std::initializer_list args ) + : m_exeName( *args.begin() ), + m_args( args.begin()+1, args.end() ) + {} - auto exeName() const -> std::string { - return m_exeName; - } -}; + auto exeName() const -> std::string { + return m_exeName; + } + }; -// Wraps a token coming from a token stream. These may not directly correspond to strings as a single string -// may encode an option + its argument if the : or = form is used -enum class TokenType { - Option, Argument -}; -struct Token { - TokenType type; - std::string token; -}; + // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string + // may encode an option + its argument if the : or = form is used + enum class TokenType { + Option, Argument + }; + struct Token { + TokenType type; + std::string token; + }; -inline auto isOptPrefix( char c ) -> bool { - return c == '-' + inline auto isOptPrefix( char c ) -> bool { + return c == '-' #ifdef CATCH_PLATFORM_WINDOWS - || c == '/' + || c == '/' #endif - ; -} + ; + } -// Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled -class TokenStream { - using Iterator = std::vector::const_iterator; - Iterator it; - Iterator itEnd; - std::vector m_tokenBuffer; - - void loadBuffer() { - m_tokenBuffer.resize( 0 ); - - // Skip any empty strings - while( it != itEnd && it->empty() ) - ++it; - - if( it != itEnd ) { - auto const &next = *it; - if( isOptPrefix( next[0] ) ) { - auto delimiterPos = next.find_first_of( " :=" ); - if( delimiterPos != std::string::npos ) { - m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } ); - m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } ); - } else { - if( next[1] != '-' && next.size() > 2 ) { - std::string opt = "- "; - for( size_t i = 1; i < next.size(); ++i ) { - opt[1] = next[i]; - m_tokenBuffer.push_back( { TokenType::Option, opt } ); - } + // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled + class TokenStream { + using Iterator = std::vector::const_iterator; + Iterator it; + Iterator itEnd; + std::vector m_tokenBuffer; + + void loadBuffer() { + m_tokenBuffer.resize( 0 ); + + // Skip any empty strings + while( it != itEnd && it->empty() ) + ++it; + + if( it != itEnd ) { + auto const &next = *it; + if( isOptPrefix( next[0] ) ) { + auto delimiterPos = next.find_first_of( " :=" ); + if( delimiterPos != std::string::npos ) { + m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } ); + m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } ); } else { - m_tokenBuffer.push_back( { TokenType::Option, next } ); + if( next[1] != '-' && next.size() > 2 ) { + std::string opt = "- "; + for( size_t i = 1; i < next.size(); ++i ) { + opt[1] = next[i]; + m_tokenBuffer.push_back( { TokenType::Option, opt } ); + } + } else { + m_tokenBuffer.push_back( { TokenType::Option, next } ); + } } + } else { + m_tokenBuffer.push_back( { TokenType::Argument, next } ); } - } else { - m_tokenBuffer.push_back( { TokenType::Argument, next } ); } } - } - -public: - explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {} - TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) { - loadBuffer(); - } + public: + explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {} - explicit operator bool() const { - return !m_tokenBuffer.empty() || it != itEnd; - } + TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) { + loadBuffer(); + } - auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); } + explicit operator bool() const { + return !m_tokenBuffer.empty() || it != itEnd; + } - auto operator*() const -> Token { - assert( !m_tokenBuffer.empty() ); - return m_tokenBuffer.front(); - } + auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); } - auto operator->() const -> Token const * { - assert( !m_tokenBuffer.empty() ); - return &m_tokenBuffer.front(); - } + auto operator*() const -> Token { + assert( !m_tokenBuffer.empty() ); + return m_tokenBuffer.front(); + } - auto operator++() -> TokenStream & { - if( m_tokenBuffer.size() >= 2 ) { - m_tokenBuffer.erase( m_tokenBuffer.begin() ); - } else { - if( it != itEnd ) - ++it; - loadBuffer(); + auto operator->() const -> Token const * { + assert( !m_tokenBuffer.empty() ); + return &m_tokenBuffer.front(); } - return *this; - } -}; -class ResultBase { -public: - enum Type { - Ok, LogicError, RuntimeError + auto operator++() -> TokenStream & { + if( m_tokenBuffer.size() >= 2 ) { + m_tokenBuffer.erase( m_tokenBuffer.begin() ); + } else { + if( it != itEnd ) + ++it; + loadBuffer(); + } + return *this; + } }; -protected: - ResultBase( Type type ) : m_type( type ) {} - virtual ~ResultBase() = default; + class ResultBase { + public: + enum Type { + Ok, LogicError, RuntimeError + }; - virtual void enforceOk() const = 0; + protected: + ResultBase( Type type ) : m_type( type ) {} + virtual ~ResultBase() = default; - Type m_type; -}; + virtual void enforceOk() const = 0; -template -class ResultValueBase : public ResultBase { -public: - auto value() const -> T const & { - enforceOk(); - return m_value; - } + Type m_type; + }; -protected: - ResultValueBase( Type type ) : ResultBase( type ) {} + template + class ResultValueBase : public ResultBase { + public: + auto value() const -> T const & { + enforceOk(); + return m_value; + } - ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) { - if( m_type == ResultBase::Ok ) - new( &m_value ) T( other.m_value ); - } + protected: + ResultValueBase( Type type ) : ResultBase( type ) {} - ResultValueBase( Type, T const &value ) : ResultBase( Ok ) { - new( &m_value ) T( value ); - } + ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) { + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + } - auto operator=( ResultValueBase const &other ) -> ResultValueBase & { - if( m_type == ResultBase::Ok ) - m_value.~T(); - ResultBase::operator=(other); - if( m_type == ResultBase::Ok ) - new( &m_value ) T( other.m_value ); - return *this; - } + ResultValueBase( Type, T const &value ) : ResultBase( Ok ) { + new( &m_value ) T( value ); + } - ~ResultValueBase() override { - if( m_type == Ok ) - m_value.~T(); - } + auto operator=( ResultValueBase const &other ) -> ResultValueBase & { + if( m_type == ResultBase::Ok ) + m_value.~T(); + ResultBase::operator=(other); + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + return *this; + } - union { - T m_value; - }; -}; + ~ResultValueBase() override { + if( m_type == Ok ) + m_value.~T(); + } -template<> -class ResultValueBase : public ResultBase { -protected: - using ResultBase::ResultBase; -}; + union { + T m_value; + }; + }; -template -class BasicResult : public ResultValueBase { -public: - template - explicit BasicResult( BasicResult const &other ) - : ResultValueBase( other.type() ), - m_errorMessage( other.errorMessage() ) - { - assert( type() != ResultBase::Ok ); - } + template<> + class ResultValueBase : public ResultBase { + protected: + using ResultBase::ResultBase; + }; - template - static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; } - static auto ok() -> BasicResult { return { ResultBase::Ok }; } - static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; } - static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; } + template + class BasicResult : public ResultValueBase { + public: + template + explicit BasicResult( BasicResult const &other ) + : ResultValueBase( other.type() ), + m_errorMessage( other.errorMessage() ) + { + assert( type() != ResultBase::Ok ); + } - explicit operator bool() const { return m_type == ResultBase::Ok; } - auto type() const -> ResultBase::Type { return m_type; } - auto errorMessage() const -> std::string { return m_errorMessage; } + template + static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; } + static auto ok() -> BasicResult { return { ResultBase::Ok }; } + static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; } + static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; } -protected: - void enforceOk() const override { + explicit operator bool() const { return m_type == ResultBase::Ok; } + auto type() const -> ResultBase::Type { return m_type; } + auto errorMessage() const -> std::string { return m_errorMessage; } - // Errors shouldn't reach this point, but if they do - // the actual error message will be in m_errorMessage - assert( m_type != ResultBase::LogicError ); - assert( m_type != ResultBase::RuntimeError ); - if( m_type != ResultBase::Ok ) - std::abort(); - } + protected: + void enforceOk() const override { + + // Errors shouldn't reach this point, but if they do + // the actual error message will be in m_errorMessage + assert( m_type != ResultBase::LogicError ); + assert( m_type != ResultBase::RuntimeError ); + if( m_type != ResultBase::Ok ) + std::abort(); + } - std::string m_errorMessage; // Only populated if resultType is an error + std::string m_errorMessage; // Only populated if resultType is an error - BasicResult( ResultBase::Type type, std::string const &message ) - : ResultValueBase(type), - m_errorMessage(message) - { - assert( m_type != ResultBase::Ok ); - } + BasicResult( ResultBase::Type type, std::string const &message ) + : ResultValueBase(type), + m_errorMessage(message) + { + assert( m_type != ResultBase::Ok ); + } - using ResultValueBase::ResultValueBase; - using ResultBase::m_type; -}; + using ResultValueBase::ResultValueBase; + using ResultBase::m_type; + }; -enum class ParseResultType { - Matched, NoMatch, ShortCircuitAll, ShortCircuitSame -}; + enum class ParseResultType { + Matched, NoMatch, ShortCircuitAll, ShortCircuitSame + }; -class ParseState { -public: + class ParseState { + public: - ParseState( ParseResultType type, TokenStream const &remainingTokens ) - : m_type(type), - m_remainingTokens( remainingTokens ) - {} + ParseState( ParseResultType type, TokenStream const &remainingTokens ) + : m_type(type), + m_remainingTokens( remainingTokens ) + {} - auto type() const -> ParseResultType { return m_type; } - auto remainingTokens() const -> TokenStream { return m_remainingTokens; } + auto type() const -> ParseResultType { return m_type; } + auto remainingTokens() const -> TokenStream { return m_remainingTokens; } -private: - ParseResultType m_type; - TokenStream m_remainingTokens; -}; + private: + ParseResultType m_type; + TokenStream m_remainingTokens; + }; -using Result = BasicResult; -using ParserResult = BasicResult; -using InternalParseResult = BasicResult; + using Result = BasicResult; + using ParserResult = BasicResult; + using InternalParseResult = BasicResult; -struct HelpColumns { - std::string left; - std::string right; -}; + struct HelpColumns { + std::string left; + std::string right; + }; -template -inline auto convertInto( std::string const &source, T& target ) -> ParserResult { - std::stringstream ss; - ss << source; - ss >> target; - if( ss.fail() ) - return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" ); - else + template + inline auto convertInto( std::string const &source, T& target ) -> ParserResult { + std::stringstream ss; + ss << source; + ss >> target; + if( ss.fail() ) + return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult { + target = source; return ParserResult::ok( ParseResultType::Matched ); -} -inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult { - target = source; - return ParserResult::ok( ParseResultType::Matched ); -} -inline auto convertInto( std::string const &source, bool &target ) -> ParserResult { - std::string srcLC = source; - std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast( std::tolower(c) ); } ); - if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on") - target = true; - else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off") - target = false; - else - return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); - return ParserResult::ok( ParseResultType::Matched ); -} + } + inline auto convertInto( std::string const &source, bool &target ) -> ParserResult { + std::string srcLC = source; + std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( unsigned char c ) { return static_cast( std::tolower(c) ); } ); + if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on") + target = true; + else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off") + target = false; + else + return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + } #ifdef CLARA_CONFIG_OPTIONAL_TYPE -template + template inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE& target ) -> ParserResult { T temp; auto result = convertInto( source, temp ); @@ -9104,551 +9104,551 @@ template } #endif // CLARA_CONFIG_OPTIONAL_TYPE -struct NonCopyable { - NonCopyable() = default; - NonCopyable( NonCopyable const & ) = delete; - NonCopyable( NonCopyable && ) = delete; - NonCopyable &operator=( NonCopyable const & ) = delete; - NonCopyable &operator=( NonCopyable && ) = delete; -}; + struct NonCopyable { + NonCopyable() = default; + NonCopyable( NonCopyable const & ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable &operator=( NonCopyable const & ) = delete; + NonCopyable &operator=( NonCopyable && ) = delete; + }; -struct BoundRef : NonCopyable { - virtual ~BoundRef() = default; - virtual auto isContainer() const -> bool { return false; } - virtual auto isFlag() const -> bool { return false; } -}; -struct BoundValueRefBase : BoundRef { - virtual auto setValue( std::string const &arg ) -> ParserResult = 0; -}; -struct BoundFlagRefBase : BoundRef { - virtual auto setFlag( bool flag ) -> ParserResult = 0; - virtual auto isFlag() const -> bool { return true; } -}; + struct BoundRef : NonCopyable { + virtual ~BoundRef() = default; + virtual auto isContainer() const -> bool { return false; } + virtual auto isFlag() const -> bool { return false; } + }; + struct BoundValueRefBase : BoundRef { + virtual auto setValue( std::string const &arg ) -> ParserResult = 0; + }; + struct BoundFlagRefBase : BoundRef { + virtual auto setFlag( bool flag ) -> ParserResult = 0; + virtual auto isFlag() const -> bool { return true; } + }; -template -struct BoundValueRef : BoundValueRefBase { - T &m_ref; + template + struct BoundValueRef : BoundValueRefBase { + T &m_ref; - explicit BoundValueRef( T &ref ) : m_ref( ref ) {} + explicit BoundValueRef( T &ref ) : m_ref( ref ) {} - auto setValue( std::string const &arg ) -> ParserResult override { - return convertInto( arg, m_ref ); - } -}; + auto setValue( std::string const &arg ) -> ParserResult override { + return convertInto( arg, m_ref ); + } + }; -template -struct BoundValueRef> : BoundValueRefBase { - std::vector &m_ref; + template + struct BoundValueRef> : BoundValueRefBase { + std::vector &m_ref; - explicit BoundValueRef( std::vector &ref ) : m_ref( ref ) {} + explicit BoundValueRef( std::vector &ref ) : m_ref( ref ) {} - auto isContainer() const -> bool override { return true; } + auto isContainer() const -> bool override { return true; } - auto setValue( std::string const &arg ) -> ParserResult override { - T temp; - auto result = convertInto( arg, temp ); - if( result ) - m_ref.push_back( temp ); - return result; - } -}; + auto setValue( std::string const &arg ) -> ParserResult override { + T temp; + auto result = convertInto( arg, temp ); + if( result ) + m_ref.push_back( temp ); + return result; + } + }; -struct BoundFlagRef : BoundFlagRefBase { - bool &m_ref; + struct BoundFlagRef : BoundFlagRefBase { + bool &m_ref; - explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {} + explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {} - auto setFlag( bool flag ) -> ParserResult override { - m_ref = flag; - return ParserResult::ok( ParseResultType::Matched ); - } -}; + auto setFlag( bool flag ) -> ParserResult override { + m_ref = flag; + return ParserResult::ok( ParseResultType::Matched ); + } + }; -template -struct LambdaInvoker { - static_assert( std::is_same::value, "Lambda must return void or clara::ParserResult" ); + template + struct LambdaInvoker { + static_assert( std::is_same::value, "Lambda must return void or clara::ParserResult" ); - template - static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { - return lambda( arg ); - } -}; + template + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + return lambda( arg ); + } + }; -template<> -struct LambdaInvoker { - template - static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { - lambda( arg ); - return ParserResult::ok( ParseResultType::Matched ); - } -}; + template<> + struct LambdaInvoker { + template + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + lambda( arg ); + return ParserResult::ok( ParseResultType::Matched ); + } + }; -template -inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult { - ArgType temp{}; - auto result = convertInto( arg, temp ); - return !result + template + inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult { + ArgType temp{}; + auto result = convertInto( arg, temp ); + return !result ? result : LambdaInvoker::ReturnType>::invoke( lambda, temp ); -} + } -template -struct BoundLambda : BoundValueRefBase { - L m_lambda; + template + struct BoundLambda : BoundValueRefBase { + L m_lambda; - static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); - explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {} + static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); + explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {} - auto setValue( std::string const &arg ) -> ParserResult override { - return invokeLambda::ArgType>( m_lambda, arg ); - } -}; + auto setValue( std::string const &arg ) -> ParserResult override { + return invokeLambda::ArgType>( m_lambda, arg ); + } + }; -template -struct BoundFlagLambda : BoundFlagRefBase { - L m_lambda; + template + struct BoundFlagLambda : BoundFlagRefBase { + L m_lambda; - static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); - static_assert( std::is_same::ArgType, bool>::value, "flags must be boolean" ); + static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); + static_assert( std::is_same::ArgType, bool>::value, "flags must be boolean" ); - explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {} + explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {} - auto setFlag( bool flag ) -> ParserResult override { - return LambdaInvoker::ReturnType>::invoke( m_lambda, flag ); - } -}; + auto setFlag( bool flag ) -> ParserResult override { + return LambdaInvoker::ReturnType>::invoke( m_lambda, flag ); + } + }; -enum class Optionality { Optional, Required }; + enum class Optionality { Optional, Required }; -struct Parser; + struct Parser; -class ParserBase { -public: - virtual ~ParserBase() = default; - virtual auto validate() const -> Result { return Result::ok(); } - virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; - virtual auto cardinality() const -> size_t { return 1; } + class ParserBase { + public: + virtual ~ParserBase() = default; + virtual auto validate() const -> Result { return Result::ok(); } + virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; + virtual auto cardinality() const -> size_t { return 1; } - auto parse( Args const &args ) const -> InternalParseResult { - return parse( args.exeName(), TokenStream( args ) ); - } -}; + auto parse( Args const &args ) const -> InternalParseResult { + return parse( args.exeName(), TokenStream( args ) ); + } + }; -template -class ComposableParserImpl : public ParserBase { -public: - template - auto operator|( T const &other ) const -> Parser; + template + class ComposableParserImpl : public ParserBase { + public: + template + auto operator|( T const &other ) const -> Parser; - template - auto operator+( T const &other ) const -> Parser; -}; + template + auto operator+( T const &other ) const -> Parser; + }; -// Common code and state for Args and Opts -template -class ParserRefImpl : public ComposableParserImpl { -protected: - Optionality m_optionality = Optionality::Optional; - std::shared_ptr m_ref; - std::string m_hint; - std::string m_description; + // Common code and state for Args and Opts + template + class ParserRefImpl : public ComposableParserImpl { + protected: + Optionality m_optionality = Optionality::Optional; + std::shared_ptr m_ref; + std::string m_hint; + std::string m_description; - explicit ParserRefImpl( std::shared_ptr const &ref ) : m_ref( ref ) {} + explicit ParserRefImpl( std::shared_ptr const &ref ) : m_ref( ref ) {} -public: - template - ParserRefImpl( T &ref, std::string const &hint ) - : m_ref( std::make_shared>( ref ) ), - m_hint( hint ) - {} + public: + template + ParserRefImpl( T &ref, std::string const &hint ) + : m_ref( std::make_shared>( ref ) ), + m_hint( hint ) + {} - template - ParserRefImpl( LambdaT const &ref, std::string const &hint ) - : m_ref( std::make_shared>( ref ) ), - m_hint(hint) - {} + template + ParserRefImpl( LambdaT const &ref, std::string const &hint ) + : m_ref( std::make_shared>( ref ) ), + m_hint(hint) + {} - auto operator()( std::string const &description ) -> DerivedT & { - m_description = description; - return static_cast( *this ); - } + auto operator()( std::string const &description ) -> DerivedT & { + m_description = description; + return static_cast( *this ); + } - auto optional() -> DerivedT & { - m_optionality = Optionality::Optional; - return static_cast( *this ); - }; + auto optional() -> DerivedT & { + m_optionality = Optionality::Optional; + return static_cast( *this ); + }; - auto required() -> DerivedT & { - m_optionality = Optionality::Required; - return static_cast( *this ); - }; + auto required() -> DerivedT & { + m_optionality = Optionality::Required; + return static_cast( *this ); + }; - auto isOptional() const -> bool { - return m_optionality == Optionality::Optional; - } + auto isOptional() const -> bool { + return m_optionality == Optionality::Optional; + } - auto cardinality() const -> size_t override { - if( m_ref->isContainer() ) - return 0; - else - return 1; - } + auto cardinality() const -> size_t override { + if( m_ref->isContainer() ) + return 0; + else + return 1; + } - auto hint() const -> std::string { return m_hint; } -}; + auto hint() const -> std::string { return m_hint; } + }; -class ExeName : public ComposableParserImpl { - std::shared_ptr m_name; - std::shared_ptr m_ref; + class ExeName : public ComposableParserImpl { + std::shared_ptr m_name; + std::shared_ptr m_ref; - template - static auto makeRef(LambdaT const &lambda) -> std::shared_ptr { - return std::make_shared>( lambda) ; - } + template + static auto makeRef(LambdaT const &lambda) -> std::shared_ptr { + return std::make_shared>( lambda) ; + } -public: - ExeName() : m_name( std::make_shared( "" ) ) {} + public: + ExeName() : m_name( std::make_shared( "" ) ) {} - explicit ExeName( std::string &ref ) : ExeName() { - m_ref = std::make_shared>( ref ); - } + explicit ExeName( std::string &ref ) : ExeName() { + m_ref = std::make_shared>( ref ); + } - template - explicit ExeName( LambdaT const& lambda ) : ExeName() { - m_ref = std::make_shared>( lambda ); - } + template + explicit ExeName( LambdaT const& lambda ) : ExeName() { + m_ref = std::make_shared>( lambda ); + } - // The exe name is not parsed out of the normal tokens, but is handled specially - auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { - return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); - } + // The exe name is not parsed out of the normal tokens, but is handled specially + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + } - auto name() const -> std::string { return *m_name; } - auto set( std::string const& newName ) -> ParserResult { + auto name() const -> std::string { return *m_name; } + auto set( std::string const& newName ) -> ParserResult { - auto lastSlash = newName.find_last_of( "\\/" ); - auto filename = ( lastSlash == std::string::npos ) - ? newName - : newName.substr( lastSlash+1 ); + auto lastSlash = newName.find_last_of( "\\/" ); + auto filename = ( lastSlash == std::string::npos ) + ? newName + : newName.substr( lastSlash+1 ); - *m_name = filename; - if( m_ref ) - return m_ref->setValue( filename ); - else - return ParserResult::ok( ParseResultType::Matched ); - } -}; + *m_name = filename; + if( m_ref ) + return m_ref->setValue( filename ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + }; -class Arg : public ParserRefImpl { -public: - using ParserRefImpl::ParserRefImpl; + class Arg : public ParserRefImpl { + public: + using ParserRefImpl::ParserRefImpl; - auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override { - auto validationResult = validate(); - if( !validationResult ) - return InternalParseResult( validationResult ); + auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); - auto remainingTokens = tokens; - auto const &token = *remainingTokens; - if( token.type != TokenType::Argument ) - return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); + auto remainingTokens = tokens; + auto const &token = *remainingTokens; + if( token.type != TokenType::Argument ) + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); - assert( !m_ref->isFlag() ); - auto valueRef = static_cast( m_ref.get() ); + assert( !m_ref->isFlag() ); + auto valueRef = static_cast( m_ref.get() ); - auto result = valueRef->setValue( remainingTokens->token ); - if( !result ) - return InternalParseResult( result ); - else - return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); - } -}; + auto result = valueRef->setValue( remainingTokens->token ); + if( !result ) + return InternalParseResult( result ); + else + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); + } + }; -inline auto normaliseOpt( std::string const &optName ) -> std::string { + inline auto normaliseOpt( std::string const &optName ) -> std::string { #ifdef CATCH_PLATFORM_WINDOWS - if( optName[0] == '/' ) + if( optName[0] == '/' ) return "-" + optName.substr( 1 ); else #endif - return optName; -} - -class Opt : public ParserRefImpl { -protected: - std::vector m_optNames; + return optName; + } -public: - template - explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared>( ref ) ) {} + class Opt : public ParserRefImpl { + protected: + std::vector m_optNames; - explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared( ref ) ) {} + public: + template + explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared>( ref ) ) {} - template - Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared( ref ) ) {} - template - Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + template + Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} - auto operator[]( std::string const &optName ) -> Opt & { - m_optNames.push_back( optName ); - return *this; - } + template + Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} - auto getHelpColumns() const -> std::vector { - std::ostringstream oss; - bool first = true; - for( auto const &opt : m_optNames ) { - if (first) - first = false; - else - oss << ", "; - oss << opt; + auto operator[]( std::string const &optName ) -> Opt & { + m_optNames.push_back( optName ); + return *this; } - if( !m_hint.empty() ) - oss << " <" << m_hint << ">"; - return { { oss.str(), m_description } }; - } - auto isMatch( std::string const &optToken ) const -> bool { - auto normalisedToken = normaliseOpt( optToken ); - for( auto const &name : m_optNames ) { - if( normaliseOpt( name ) == normalisedToken ) - return true; + auto getHelpColumns() const -> std::vector { + std::ostringstream oss; + bool first = true; + for( auto const &opt : m_optNames ) { + if (first) + first = false; + else + oss << ", "; + oss << opt; + } + if( !m_hint.empty() ) + oss << " <" << m_hint << ">"; + return { { oss.str(), m_description } }; } - return false; - } - using ParserBase::parse; - - auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { - auto validationResult = validate(); - if( !validationResult ) - return InternalParseResult( validationResult ); + auto isMatch( std::string const &optToken ) const -> bool { + auto normalisedToken = normaliseOpt( optToken ); + for( auto const &name : m_optNames ) { + if( normaliseOpt( name ) == normalisedToken ) + return true; + } + return false; + } - auto remainingTokens = tokens; - if( remainingTokens && remainingTokens->type == TokenType::Option ) { - auto const &token = *remainingTokens; - if( isMatch(token.token ) ) { - if( m_ref->isFlag() ) { - auto flagRef = static_cast( m_ref.get() ); - auto result = flagRef->setFlag( true ); - if( !result ) - return InternalParseResult( result ); - if( result.value() == ParseResultType::ShortCircuitAll ) - return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); - } else { - auto valueRef = static_cast( m_ref.get() ); - ++remainingTokens; - if( !remainingTokens ) - return InternalParseResult::runtimeError( "Expected argument following " + token.token ); - auto const &argToken = *remainingTokens; - if( argToken.type != TokenType::Argument ) - return InternalParseResult::runtimeError( "Expected argument following " + token.token ); - auto result = valueRef->setValue( argToken.token ); - if( !result ) - return InternalParseResult( result ); - if( result.value() == ParseResultType::ShortCircuitAll ) - return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + using ParserBase::parse; + + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); + + auto remainingTokens = tokens; + if( remainingTokens && remainingTokens->type == TokenType::Option ) { + auto const &token = *remainingTokens; + if( isMatch(token.token ) ) { + if( m_ref->isFlag() ) { + auto flagRef = static_cast( m_ref.get() ); + auto result = flagRef->setFlag( true ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } else { + auto valueRef = static_cast( m_ref.get() ); + ++remainingTokens; + if( !remainingTokens ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto const &argToken = *remainingTokens; + if( argToken.type != TokenType::Argument ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto result = valueRef->setValue( argToken.token ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); } - return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); } + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); } - return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); - } - auto validate() const -> Result override { - if( m_optNames.empty() ) - return Result::logicError( "No options supplied to Opt" ); - for( auto const &name : m_optNames ) { - if( name.empty() ) - return Result::logicError( "Option name cannot be empty" ); + auto validate() const -> Result override { + if( m_optNames.empty() ) + return Result::logicError( "No options supplied to Opt" ); + for( auto const &name : m_optNames ) { + if( name.empty() ) + return Result::logicError( "Option name cannot be empty" ); #ifdef CATCH_PLATFORM_WINDOWS - if( name[0] != '-' && name[0] != '/' ) + if( name[0] != '-' && name[0] != '/' ) return Result::logicError( "Option name must begin with '-' or '/'" ); #else - if( name[0] != '-' ) - return Result::logicError( "Option name must begin with '-'" ); + if( name[0] != '-' ) + return Result::logicError( "Option name must begin with '-'" ); #endif + } + return ParserRefImpl::validate(); } - return ParserRefImpl::validate(); - } -}; + }; -struct Help : Opt { - Help( bool &showHelpFlag ) - : Opt([&]( bool flag ) { - showHelpFlag = flag; - return ParserResult::ok( ParseResultType::ShortCircuitAll ); - }) - { - static_cast( *this ) - ("display usage information") - ["-?"]["-h"]["--help"] - .optional(); - } -}; + struct Help : Opt { + Help( bool &showHelpFlag ) + : Opt([&]( bool flag ) { + showHelpFlag = flag; + return ParserResult::ok( ParseResultType::ShortCircuitAll ); + }) + { + static_cast( *this ) + ("display usage information") + ["-?"]["-h"]["--help"] + .optional(); + } + }; -struct Parser : ParserBase { + struct Parser : ParserBase { - mutable ExeName m_exeName; - std::vector m_options; - std::vector m_args; + mutable ExeName m_exeName; + std::vector m_options; + std::vector m_args; - auto operator|=( ExeName const &exeName ) -> Parser & { - m_exeName = exeName; - return *this; - } + auto operator|=( ExeName const &exeName ) -> Parser & { + m_exeName = exeName; + return *this; + } - auto operator|=( Arg const &arg ) -> Parser & { - m_args.push_back(arg); - return *this; - } + auto operator|=( Arg const &arg ) -> Parser & { + m_args.push_back(arg); + return *this; + } - auto operator|=( Opt const &opt ) -> Parser & { - m_options.push_back(opt); - return *this; - } + auto operator|=( Opt const &opt ) -> Parser & { + m_options.push_back(opt); + return *this; + } - auto operator|=( Parser const &other ) -> Parser & { - m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end()); - m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end()); - return *this; - } + auto operator|=( Parser const &other ) -> Parser & { + m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end()); + m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end()); + return *this; + } - template - auto operator|( T const &other ) const -> Parser { - return Parser( *this ) |= other; - } + template + auto operator|( T const &other ) const -> Parser { + return Parser( *this ) |= other; + } - // Forward deprecated interface with '+' instead of '|' - template - auto operator+=( T const &other ) -> Parser & { return operator|=( other ); } - template - auto operator+( T const &other ) const -> Parser { return operator|( other ); } + // Forward deprecated interface with '+' instead of '|' + template + auto operator+=( T const &other ) -> Parser & { return operator|=( other ); } + template + auto operator+( T const &other ) const -> Parser { return operator|( other ); } - auto getHelpColumns() const -> std::vector { - std::vector cols; - for (auto const &o : m_options) { - auto childCols = o.getHelpColumns(); - cols.insert( cols.end(), childCols.begin(), childCols.end() ); + auto getHelpColumns() const -> std::vector { + std::vector cols; + for (auto const &o : m_options) { + auto childCols = o.getHelpColumns(); + cols.insert( cols.end(), childCols.begin(), childCols.end() ); + } + return cols; } - return cols; - } - void writeToStream( std::ostream &os ) const { - if (!m_exeName.name().empty()) { - os << "usage:\n" << " " << m_exeName.name() << " "; - bool required = true, first = true; - for( auto const &arg : m_args ) { - if (first) - first = false; - else - os << " "; - if( arg.isOptional() && required ) { - os << "["; - required = false; + void writeToStream( std::ostream &os ) const { + if (!m_exeName.name().empty()) { + os << "usage:\n" << " " << m_exeName.name() << " "; + bool required = true, first = true; + for( auto const &arg : m_args ) { + if (first) + first = false; + else + os << " "; + if( arg.isOptional() && required ) { + os << "["; + required = false; + } + os << "<" << arg.hint() << ">"; + if( arg.cardinality() == 0 ) + os << " ... "; } - os << "<" << arg.hint() << ">"; - if( arg.cardinality() == 0 ) - os << " ... "; + if( !required ) + os << "]"; + if( !m_options.empty() ) + os << " options"; + os << "\n\nwhere options are:" << std::endl; } - if( !required ) - os << "]"; - if( !m_options.empty() ) - os << " options"; - os << "\n\nwhere options are:" << std::endl; - } - auto rows = getHelpColumns(); - size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH; - size_t optWidth = 0; - for( auto const &cols : rows ) - optWidth = (std::max)(optWidth, cols.left.size() + 2); + auto rows = getHelpColumns(); + size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH; + size_t optWidth = 0; + for( auto const &cols : rows ) + optWidth = (std::max)(optWidth, cols.left.size() + 2); - optWidth = (std::min)(optWidth, consoleWidth/2); + optWidth = (std::min)(optWidth, consoleWidth/2); - for( auto const &cols : rows ) { - auto row = - TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) + - TextFlow::Spacer(4) + - TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth ); - os << row << std::endl; + for( auto const &cols : rows ) { + auto row = + TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) + + TextFlow::Spacer(4) + + TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth ); + os << row << std::endl; + } } - } - - friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& { - parser.writeToStream( os ); - return os; - } - auto validate() const -> Result override { - for( auto const &opt : m_options ) { - auto result = opt.validate(); - if( !result ) - return result; + friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& { + parser.writeToStream( os ); + return os; } - for( auto const &arg : m_args ) { - auto result = arg.validate(); - if( !result ) - return result; + + auto validate() const -> Result override { + for( auto const &opt : m_options ) { + auto result = opt.validate(); + if( !result ) + return result; + } + for( auto const &arg : m_args ) { + auto result = arg.validate(); + if( !result ) + return result; + } + return Result::ok(); } - return Result::ok(); - } - using ParserBase::parse; + using ParserBase::parse; - auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override { + auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override { - struct ParserInfo { - ParserBase const* parser = nullptr; - size_t count = 0; - }; - const size_t totalParsers = m_options.size() + m_args.size(); - assert( totalParsers < 512 ); - // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do - ParserInfo parseInfos[512]; + struct ParserInfo { + ParserBase const* parser = nullptr; + size_t count = 0; + }; + const size_t totalParsers = m_options.size() + m_args.size(); + assert( totalParsers < 512 ); + // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do + ParserInfo parseInfos[512]; - { - size_t i = 0; - for (auto const &opt : m_options) parseInfos[i++].parser = &opt; - for (auto const &arg : m_args) parseInfos[i++].parser = &arg; - } - - m_exeName.set( exeName ); - - auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); - while( result.value().remainingTokens() ) { - bool tokenParsed = false; - - for( size_t i = 0; i < totalParsers; ++i ) { - auto& parseInfo = parseInfos[i]; - if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) { - result = parseInfo.parser->parse(exeName, result.value().remainingTokens()); - if (!result) - return result; - if (result.value().type() != ParseResultType::NoMatch) { - tokenParsed = true; - ++parseInfo.count; - break; + { + size_t i = 0; + for (auto const &opt : m_options) parseInfos[i++].parser = &opt; + for (auto const &arg : m_args) parseInfos[i++].parser = &arg; + } + + m_exeName.set( exeName ); + + auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + while( result.value().remainingTokens() ) { + bool tokenParsed = false; + + for( size_t i = 0; i < totalParsers; ++i ) { + auto& parseInfo = parseInfos[i]; + if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) { + result = parseInfo.parser->parse(exeName, result.value().remainingTokens()); + if (!result) + return result; + if (result.value().type() != ParseResultType::NoMatch) { + tokenParsed = true; + ++parseInfo.count; + break; + } } } - } - if( result.value().type() == ParseResultType::ShortCircuitAll ) - return result; - if( !tokenParsed ) - return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token ); + if( result.value().type() == ParseResultType::ShortCircuitAll ) + return result; + if( !tokenParsed ) + return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token ); + } + // !TBD Check missing required options + return result; } - // !TBD Check missing required options - return result; - } -}; + }; -template -template -auto ComposableParserImpl::operator|( T const &other ) const -> Parser { - return Parser() | static_cast( *this ) | other; -} + template + template + auto ComposableParserImpl::operator|( T const &other ) const -> Parser { + return Parser() | static_cast( *this ) | other; + } } // namespace detail // A Combined parser @@ -9691,7 +9691,7 @@ using detail::ParserResult; // end catch_clara.h namespace Catch { -clara::Parser makeCommandLineParser( ConfigData& config ); + clara::Parser makeCommandLineParser( ConfigData& config ); } // end namespace Catch @@ -9701,214 +9701,214 @@ clara::Parser makeCommandLineParser( ConfigData& config ); namespace Catch { -clara::Parser makeCommandLineParser( ConfigData& config ) { + clara::Parser makeCommandLineParser( ConfigData& config ) { - using namespace clara; + using namespace clara; - auto const setWarning = [&]( std::string const& warning ) { - auto warningSet = [&]() { - if( warning == "NoAssertions" ) - return WarnAbout::NoAssertions; + auto const setWarning = [&]( std::string const& warning ) { + auto warningSet = [&]() { + if( warning == "NoAssertions" ) + return WarnAbout::NoAssertions; - if ( warning == "NoTests" ) - return WarnAbout::NoTests; + if ( warning == "NoTests" ) + return WarnAbout::NoTests; - return WarnAbout::Nothing; - }(); + return WarnAbout::Nothing; + }(); - if (warningSet == WarnAbout::Nothing) - return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); - config.warnings = static_cast( config.warnings | warningSet ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const loadTestNamesFromFile = [&]( std::string const& filename ) { - std::ifstream f( filename.c_str() ); - if( !f.is_open() ) - return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" ); - - std::string line; - while( std::getline( f, line ) ) { - line = trim(line); - if( !line.empty() && !startsWith( line, '#' ) ) { - if( !startsWith( line, '"' ) ) - line = '"' + line + '"'; - config.testsOrTags.push_back( line ); - config.testsOrTags.emplace_back( "," ); - } - } - //Remove comma in the end - if(!config.testsOrTags.empty()) - config.testsOrTags.erase( config.testsOrTags.end()-1 ); + if (warningSet == WarnAbout::Nothing) + return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); + config.warnings = static_cast( config.warnings | warningSet ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const loadTestNamesFromFile = [&]( std::string const& filename ) { + std::ifstream f( filename.c_str() ); + if( !f.is_open() ) + return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" ); + + std::string line; + while( std::getline( f, line ) ) { + line = trim(line); + if( !line.empty() && !startsWith( line, '#' ) ) { + if( !startsWith( line, '"' ) ) + line = '"' + line + '"'; + config.testsOrTags.push_back( line ); + config.testsOrTags.emplace_back( "," ); + } + } + //Remove comma in the end + if(!config.testsOrTags.empty()) + config.testsOrTags.erase( config.testsOrTags.end()-1 ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setTestOrder = [&]( std::string const& order ) { - if( startsWith( "declared", order ) ) - config.runOrder = RunTests::InDeclarationOrder; - else if( startsWith( "lexical", order ) ) - config.runOrder = RunTests::InLexicographicalOrder; - else if( startsWith( "random", order ) ) - config.runOrder = RunTests::InRandomOrder; - else - return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setRngSeed = [&]( std::string const& seed ) { - if( seed != "time" ) - return clara::detail::convertInto( seed, config.rngSeed ); - config.rngSeed = static_cast( std::time(nullptr) ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setColourUsage = [&]( std::string const& useColour ) { - auto mode = toLower( useColour ); - - if( mode == "yes" ) - config.useColour = UseColour::Yes; - else if( mode == "no" ) - config.useColour = UseColour::No; - else if( mode == "auto" ) - config.useColour = UseColour::Auto; - else - return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setWaitForKeypress = [&]( std::string const& keypress ) { - auto keypressLc = toLower( keypress ); - if (keypressLc == "never") - config.waitForKeypress = WaitForKeypress::Never; - else if( keypressLc == "start" ) - config.waitForKeypress = WaitForKeypress::BeforeStart; - else if( keypressLc == "exit" ) - config.waitForKeypress = WaitForKeypress::BeforeExit; - else if( keypressLc == "both" ) - config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; - else - return ParserResult::runtimeError( "keypress argument must be one of: never, start, exit or both. '" + keypress + "' not recognised" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setVerbosity = [&]( std::string const& verbosity ) { - auto lcVerbosity = toLower( verbosity ); - if( lcVerbosity == "quiet" ) - config.verbosity = Verbosity::Quiet; - else if( lcVerbosity == "normal" ) - config.verbosity = Verbosity::Normal; - else if( lcVerbosity == "high" ) - config.verbosity = Verbosity::High; - else - return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); - return ParserResult::ok( ParseResultType::Matched ); - }; - auto const setReporter = [&]( std::string const& reporter ) { - IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setTestOrder = [&]( std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = RunTests::InDeclarationOrder; + else if( startsWith( "lexical", order ) ) + config.runOrder = RunTests::InLexicographicalOrder; + else if( startsWith( "random", order ) ) + config.runOrder = RunTests::InRandomOrder; + else + return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setRngSeed = [&]( std::string const& seed ) { + if( seed != "time" ) + return clara::detail::convertInto( seed, config.rngSeed ); + config.rngSeed = static_cast( std::time(nullptr) ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setColourUsage = [&]( std::string const& useColour ) { + auto mode = toLower( useColour ); + + if( mode == "yes" ) + config.useColour = UseColour::Yes; + else if( mode == "no" ) + config.useColour = UseColour::No; + else if( mode == "auto" ) + config.useColour = UseColour::Auto; + else + return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setWaitForKeypress = [&]( std::string const& keypress ) { + auto keypressLc = toLower( keypress ); + if (keypressLc == "never") + config.waitForKeypress = WaitForKeypress::Never; + else if( keypressLc == "start" ) + config.waitForKeypress = WaitForKeypress::BeforeStart; + else if( keypressLc == "exit" ) + config.waitForKeypress = WaitForKeypress::BeforeExit; + else if( keypressLc == "both" ) + config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; + else + return ParserResult::runtimeError( "keypress argument must be one of: never, start, exit or both. '" + keypress + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setVerbosity = [&]( std::string const& verbosity ) { + auto lcVerbosity = toLower( verbosity ); + if( lcVerbosity == "quiet" ) + config.verbosity = Verbosity::Quiet; + else if( lcVerbosity == "normal" ) + config.verbosity = Verbosity::Normal; + else if( lcVerbosity == "high" ) + config.verbosity = Verbosity::High; + else + return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setReporter = [&]( std::string const& reporter ) { + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); - auto lcReporter = toLower( reporter ); - auto result = factories.find( lcReporter ); + auto lcReporter = toLower( reporter ); + auto result = factories.find( lcReporter ); - if( factories.end() != result ) - config.reporterName = lcReporter; - else - return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" ); - return ParserResult::ok( ParseResultType::Matched ); - }; + if( factories.end() != result ) + config.reporterName = lcReporter; + else + return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" ); + return ParserResult::ok( ParseResultType::Matched ); + }; - auto cli + auto cli = ExeName( config.processName ) - | Help( config.showHelp ) - | Opt( config.listTests ) - ["-l"]["--list-tests"] - ( "list all/matching test cases" ) - | Opt( config.listTags ) - ["-t"]["--list-tags"] - ( "list all/matching tags" ) - | Opt( config.showSuccessfulTests ) - ["-s"]["--success"] - ( "include successful tests in output" ) - | Opt( config.shouldDebugBreak ) - ["-b"]["--break"] - ( "break into debugger on failure" ) - | Opt( config.noThrow ) - ["-e"]["--nothrow"] - ( "skip exception tests" ) - | Opt( config.showInvisibles ) - ["-i"]["--invisibles"] - ( "show invisibles (tabs, newlines)" ) - | Opt( config.outputFilename, "filename" ) - ["-o"]["--out"] - ( "output filename" ) - | Opt( setReporter, "name" ) - ["-r"]["--reporter"] - ( "reporter to use (defaults to console)" ) - | Opt( config.name, "name" ) - ["-n"]["--name"] - ( "suite name" ) - | Opt( [&]( bool ){ config.abortAfter = 1; } ) - ["-a"]["--abort"] - ( "abort at first failure" ) - | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) - ["-x"]["--abortx"] - ( "abort after x failures" ) - | Opt( setWarning, "warning name" ) - ["-w"]["--warn"] - ( "enable warnings" ) - | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) - ["-d"]["--durations"] - ( "show test durations" ) - | Opt( config.minDuration, "seconds" ) - ["-D"]["--min-duration"] - ( "show test durations for tests taking at least the given number of seconds" ) - | Opt( loadTestNamesFromFile, "filename" ) - ["-f"]["--input-file"] - ( "load test names to run from a file" ) - | Opt( config.filenamesAsTags ) - ["-#"]["--filenames-as-tags"] - ( "adds a tag for the filename" ) - | Opt( config.sectionsToRun, "section name" ) - ["-c"]["--section"] - ( "specify section to run" ) - | Opt( setVerbosity, "quiet|normal|high" ) - ["-v"]["--verbosity"] - ( "set output verbosity" ) - | Opt( config.listTestNamesOnly ) - ["--list-test-names-only"] - ( "list all/matching test cases names only" ) - | Opt( config.listReporters ) - ["--list-reporters"] - ( "list all reporters" ) - | Opt( setTestOrder, "decl|lex|rand" ) - ["--order"] - ( "test case order (defaults to decl)" ) - | Opt( setRngSeed, "'time'|number" ) - ["--rng-seed"] - ( "set a specific seed for random numbers" ) - | Opt( setColourUsage, "yes|no" ) - ["--use-colour"] - ( "should output be colourised" ) - | Opt( config.libIdentify ) - ["--libidentify"] - ( "report name and version according to libidentify standard" ) - | Opt( setWaitForKeypress, "never|start|exit|both" ) - ["--wait-for-keypress"] - ( "waits for a keypress before exiting" ) - | Opt( config.benchmarkSamples, "samples" ) - ["--benchmark-samples"] - ( "number of samples to collect (default: 100)" ) - | Opt( config.benchmarkResamples, "resamples" ) - ["--benchmark-resamples"] - ( "number of resamples for the bootstrap (default: 100000)" ) - | Opt( config.benchmarkConfidenceInterval, "confidence interval" ) - ["--benchmark-confidence-interval"] - ( "confidence interval for the bootstrap (between 0 and 1, default: 0.95)" ) - | Opt( config.benchmarkNoAnalysis ) - ["--benchmark-no-analysis"] - ( "perform only measurements; do not perform any analysis" ) - | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" ) - ["--benchmark-warmup-time"] - ( "amount of time in milliseconds spent on warming up each test (default: 100)" ) - | Arg( config.testsOrTags, "test name|pattern|tags" ) - ( "which test or tests to use" ); - - return cli; -} + | Help( config.showHelp ) + | Opt( config.listTests ) + ["-l"]["--list-tests"] + ( "list all/matching test cases" ) + | Opt( config.listTags ) + ["-t"]["--list-tags"] + ( "list all/matching tags" ) + | Opt( config.showSuccessfulTests ) + ["-s"]["--success"] + ( "include successful tests in output" ) + | Opt( config.shouldDebugBreak ) + ["-b"]["--break"] + ( "break into debugger on failure" ) + | Opt( config.noThrow ) + ["-e"]["--nothrow"] + ( "skip exception tests" ) + | Opt( config.showInvisibles ) + ["-i"]["--invisibles"] + ( "show invisibles (tabs, newlines)" ) + | Opt( config.outputFilename, "filename" ) + ["-o"]["--out"] + ( "output filename" ) + | Opt( setReporter, "name" ) + ["-r"]["--reporter"] + ( "reporter to use (defaults to console)" ) + | Opt( config.name, "name" ) + ["-n"]["--name"] + ( "suite name" ) + | Opt( [&]( bool ){ config.abortAfter = 1; } ) + ["-a"]["--abort"] + ( "abort at first failure" ) + | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) + ["-x"]["--abortx"] + ( "abort after x failures" ) + | Opt( setWarning, "warning name" ) + ["-w"]["--warn"] + ( "enable warnings" ) + | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) + ["-d"]["--durations"] + ( "show test durations" ) + | Opt( config.minDuration, "seconds" ) + ["-D"]["--min-duration"] + ( "show test durations for tests taking at least the given number of seconds" ) + | Opt( loadTestNamesFromFile, "filename" ) + ["-f"]["--input-file"] + ( "load test names to run from a file" ) + | Opt( config.filenamesAsTags ) + ["-#"]["--filenames-as-tags"] + ( "adds a tag for the filename" ) + | Opt( config.sectionsToRun, "section name" ) + ["-c"]["--section"] + ( "specify section to run" ) + | Opt( setVerbosity, "quiet|normal|high" ) + ["-v"]["--verbosity"] + ( "set output verbosity" ) + | Opt( config.listTestNamesOnly ) + ["--list-test-names-only"] + ( "list all/matching test cases names only" ) + | Opt( config.listReporters ) + ["--list-reporters"] + ( "list all reporters" ) + | Opt( setTestOrder, "decl|lex|rand" ) + ["--order"] + ( "test case order (defaults to decl)" ) + | Opt( setRngSeed, "'time'|number" ) + ["--rng-seed"] + ( "set a specific seed for random numbers" ) + | Opt( setColourUsage, "yes|no" ) + ["--use-colour"] + ( "should output be colourised" ) + | Opt( config.libIdentify ) + ["--libidentify"] + ( "report name and version according to libidentify standard" ) + | Opt( setWaitForKeypress, "never|start|exit|both" ) + ["--wait-for-keypress"] + ( "waits for a keypress before exiting" ) + | Opt( config.benchmarkSamples, "samples" ) + ["--benchmark-samples"] + ( "number of samples to collect (default: 100)" ) + | Opt( config.benchmarkResamples, "resamples" ) + ["--benchmark-resamples"] + ( "number of resamples for the bootstrap (default: 100000)" ) + | Opt( config.benchmarkConfidenceInterval, "confidence interval" ) + ["--benchmark-confidence-interval"] + ( "confidence interval for the bootstrap (between 0 and 1, default: 0.95)" ) + | Opt( config.benchmarkNoAnalysis ) + ["--benchmark-no-analysis"] + ( "perform only measurements; do not perform any analysis" ) + | Opt( config.benchmarkWarmupTime, "benchmarkWarmupTime" ) + ["--benchmark-warmup-time"] + ( "amount of time in milliseconds spent on warming up each test (default: 100)" ) + | Arg( config.testsOrTags, "test name|pattern|tags" ) + ( "which test or tests to use" ); + + return cli; + } } // end namespace Catch // end catch_commandline.cpp @@ -9919,30 +9919,30 @@ clara::Parser makeCommandLineParser( ConfigData& config ) { namespace Catch { -bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { - return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); -} -bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { - // We can assume that the same file will usually have the same pointer. - // Thus, if the pointers are the same, there is no point in calling the strcmp - return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); -} + bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { + return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); + } + bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { + // We can assume that the same file will usually have the same pointer. + // Thus, if the pointers are the same, there is no point in calling the strcmp + return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); + } -std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { #ifndef __GNUG__ - os << info.file << '(' << info.line << ')'; + os << info.file << '(' << info.line << ')'; #else - os << info.file << ':' << info.line; + os << info.file << ':' << info.line; #endif - return os; -} + return os; + } -std::string StreamEndStop::operator+() const { - return std::string(); -} + std::string StreamEndStop::operator+() const { + return std::string(); + } -NonCopyable::NonCopyable() = default; -NonCopyable::~NonCopyable() = default; + NonCopyable::NonCopyable() = default; + NonCopyable::~NonCopyable() = default; } // end catch_common.cpp @@ -9950,77 +9950,77 @@ NonCopyable::~NonCopyable() = default; namespace Catch { -Config::Config( ConfigData const& data ) - : m_data( data ), - m_stream( openStream() ) -{ - // We need to trim filter specs to avoid trouble with superfluous - // whitespace (esp. important for bdd macros, as those are manually - // aligned with whitespace). + Config::Config( ConfigData const& data ) + : m_data( data ), + m_stream( openStream() ) + { + // We need to trim filter specs to avoid trouble with superfluous + // whitespace (esp. important for bdd macros, as those are manually + // aligned with whitespace). - for (auto& elem : m_data.testsOrTags) { - elem = trim(elem); - } - for (auto& elem : m_data.sectionsToRun) { - elem = trim(elem); - } + for (auto& elem : m_data.testsOrTags) { + elem = trim(elem); + } + for (auto& elem : m_data.sectionsToRun) { + elem = trim(elem); + } - TestSpecParser parser(ITagAliasRegistry::get()); - if (!m_data.testsOrTags.empty()) { - m_hasTestFilters = true; - for (auto const& testOrTags : m_data.testsOrTags) { - parser.parse(testOrTags); + TestSpecParser parser(ITagAliasRegistry::get()); + if (!m_data.testsOrTags.empty()) { + m_hasTestFilters = true; + for (auto const& testOrTags : m_data.testsOrTags) { + parser.parse(testOrTags); + } } + m_testSpec = parser.testSpec(); } - m_testSpec = parser.testSpec(); -} -std::string const& Config::getFilename() const { - return m_data.outputFilename ; -} + std::string const& Config::getFilename() const { + return m_data.outputFilename ; + } -bool Config::listTests() const { return m_data.listTests; } -bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; } -bool Config::listTags() const { return m_data.listTags; } -bool Config::listReporters() const { return m_data.listReporters; } - -std::string Config::getProcessName() const { return m_data.processName; } -std::string const& Config::getReporterName() const { return m_data.reporterName; } - -std::vector const& Config::getTestsOrTags() const { return m_data.testsOrTags; } -std::vector const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } - -TestSpec const& Config::testSpec() const { return m_testSpec; } -bool Config::hasTestFilters() const { return m_hasTestFilters; } - -bool Config::showHelp() const { return m_data.showHelp; } - -// IConfig interface -bool Config::allowThrows() const { return !m_data.noThrow; } -std::ostream& Config::stream() const { return m_stream->stream(); } -std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } -bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; } -bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); } -bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } -ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; } -double Config::minDuration() const { return m_data.minDuration; } -RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; } -unsigned int Config::rngSeed() const { return m_data.rngSeed; } -UseColour::YesOrNo Config::useColour() const { return m_data.useColour; } -bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; } -int Config::abortAfter() const { return m_data.abortAfter; } -bool Config::showInvisibles() const { return m_data.showInvisibles; } -Verbosity Config::verbosity() const { return m_data.verbosity; } - -bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } -int Config::benchmarkSamples() const { return m_data.benchmarkSamples; } -double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; } -unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; } -std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); } - -IStream const* Config::openStream() { - return Catch::makeStream(m_data.outputFilename); -} + bool Config::listTests() const { return m_data.listTests; } + bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; } + bool Config::listTags() const { return m_data.listTags; } + bool Config::listReporters() const { return m_data.listReporters; } + + std::string Config::getProcessName() const { return m_data.processName; } + std::string const& Config::getReporterName() const { return m_data.reporterName; } + + std::vector const& Config::getTestsOrTags() const { return m_data.testsOrTags; } + std::vector const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + + TestSpec const& Config::testSpec() const { return m_testSpec; } + bool Config::hasTestFilters() const { return m_hasTestFilters; } + + bool Config::showHelp() const { return m_data.showHelp; } + + // IConfig interface + bool Config::allowThrows() const { return !m_data.noThrow; } + std::ostream& Config::stream() const { return m_stream->stream(); } + std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } + bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; } + bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); } + bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } + ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; } + double Config::minDuration() const { return m_data.minDuration; } + RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; } + unsigned int Config::rngSeed() const { return m_data.rngSeed; } + UseColour::YesOrNo Config::useColour() const { return m_data.useColour; } + bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; } + int Config::abortAfter() const { return m_data.abortAfter; } + bool Config::showInvisibles() const { return m_data.showInvisibles; } + Verbosity Config::verbosity() const { return m_data.verbosity; } + + bool Config::benchmarkNoAnalysis() const { return m_data.benchmarkNoAnalysis; } + int Config::benchmarkSamples() const { return m_data.benchmarkSamples; } + double Config::benchmarkConfidenceInterval() const { return m_data.benchmarkConfidenceInterval; } + unsigned int Config::benchmarkResamples() const { return m_data.benchmarkResamples; } + std::chrono::milliseconds Config::benchmarkWarmupTime() const { return std::chrono::milliseconds(m_data.benchmarkWarmupTime); } + + IStream const* Config::openStream() { + return Catch::makeStream(m_data.outputFilename); + } } // end namespace Catch // end catch_config.cpp @@ -10035,13 +10035,13 @@ IStream const* Config::openStream() { namespace Catch { -class ErrnoGuard { -public: - ErrnoGuard(); - ~ErrnoGuard(); -private: - int m_oldErrno; -}; + class ErrnoGuard { + public: + ErrnoGuard(); + ~ErrnoGuard(); + private: + int m_oldErrno; + }; } @@ -10079,23 +10079,23 @@ class ErrnoGuard { #include namespace Catch { -namespace { + namespace { -struct IColourImpl { - virtual ~IColourImpl() = default; - virtual void use( Colour::Code _colourCode ) = 0; -}; + struct IColourImpl { + virtual ~IColourImpl() = default; + virtual void use( Colour::Code _colourCode ) = 0; + }; -struct NoColourImpl : IColourImpl { - void use( Colour::Code ) override {} + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) override {} - static IColourImpl* instance() { - static NoColourImpl s_instance; - return &s_instance; - } -}; + static IColourImpl* instance() { + static NoColourImpl s_instance; + return &s_instance; + } + }; -} // anon namespace + } // anon namespace } // namespace Catch #if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) @@ -10178,71 +10178,71 @@ namespace { namespace Catch { namespace { -// use POSIX/ ANSI console terminal codes -// Thanks to Adam Strzelecki for original contribution -// (http://github.com/nanoant) -// https://github.com/philsquared/Catch/pull/131 -class PosixColourImpl : public IColourImpl { -public: - void use( Colour::Code _colourCode ) override { - switch( _colourCode ) { - case Colour::None: - case Colour::White: return setColour( "[0m" ); - case Colour::Red: return setColour( "[0;31m" ); - case Colour::Green: return setColour( "[0;32m" ); - case Colour::Blue: return setColour( "[0;34m" ); - case Colour::Cyan: return setColour( "[0;36m" ); - case Colour::Yellow: return setColour( "[0;33m" ); - case Colour::Grey: return setColour( "[1;30m" ); - - case Colour::LightGrey: return setColour( "[0;37m" ); - case Colour::BrightRed: return setColour( "[1;31m" ); - case Colour::BrightGreen: return setColour( "[1;32m" ); - case Colour::BrightWhite: return setColour( "[1;37m" ); - case Colour::BrightYellow: return setColour( "[1;33m" ); + // use POSIX/ ANSI console terminal codes + // Thanks to Adam Strzelecki for original contribution + // (http://github.com/nanoant) + // https://github.com/philsquared/Catch/pull/131 + class PosixColourImpl : public IColourImpl { + public: + void use( Colour::Code _colourCode ) override { + switch( _colourCode ) { + case Colour::None: + case Colour::White: return setColour( "[0m" ); + case Colour::Red: return setColour( "[0;31m" ); + case Colour::Green: return setColour( "[0;32m" ); + case Colour::Blue: return setColour( "[0;34m" ); + case Colour::Cyan: return setColour( "[0;36m" ); + case Colour::Yellow: return setColour( "[0;33m" ); + case Colour::Grey: return setColour( "[1;30m" ); + + case Colour::LightGrey: return setColour( "[0;37m" ); + case Colour::BrightRed: return setColour( "[1;31m" ); + case Colour::BrightGreen: return setColour( "[1;32m" ); + case Colour::BrightWhite: return setColour( "[1;37m" ); + case Colour::BrightYellow: return setColour( "[1;33m" ); - case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); - default: CATCH_INTERNAL_ERROR( "Unknown colour requested" ); + case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); + default: CATCH_INTERNAL_ERROR( "Unknown colour requested" ); + } + } + static IColourImpl* instance() { + static PosixColourImpl s_instance; + return &s_instance; } - } - static IColourImpl* instance() { - static PosixColourImpl s_instance; - return &s_instance; - } -private: - void setColour( const char* _escapeCode ) { - getCurrentContext().getConfig()->stream() + private: + void setColour( const char* _escapeCode ) { + getCurrentContext().getConfig()->stream() << '\033' << _escapeCode; - } -}; + } + }; -bool useColourOnPlatform() { - return + bool useColourOnPlatform() { + return #if defined(CATCH_PLATFORM_MAC) || defined(CATCH_PLATFORM_IPHONE) !isDebuggerActive() && - #endif - #if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) +#endif +#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) isatty(STDOUT_FILENO) #else - false + false #endif ; -} -IColourImpl* platformColourInstance() { - ErrnoGuard guard; - IConfigPtr config = getCurrentContext().getConfig(); - UseColour::YesOrNo colourMode = config - ? config->useColour() - : UseColour::Auto; - if( colourMode == UseColour::Auto ) - colourMode = useColourOnPlatform() - ? UseColour::Yes - : UseColour::No; - return colourMode == UseColour::Yes - ? PosixColourImpl::instance() - : NoColourImpl::instance(); -} + } + IColourImpl* platformColourInstance() { + ErrnoGuard guard; + IConfigPtr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = useColourOnPlatform() + ? UseColour::Yes + : UseColour::No; + return colourMode == UseColour::Yes + ? PosixColourImpl::instance() + : NoColourImpl::instance(); + } } // end anon namespace } // end namespace Catch @@ -10259,33 +10259,33 @@ namespace Catch { namespace Catch { -Colour::Colour( Code _colourCode ) { use( _colourCode ); } -Colour::Colour( Colour&& other ) noexcept { - m_moved = other.m_moved; - other.m_moved = true; -} -Colour& Colour::operator=( Colour&& other ) noexcept { - m_moved = other.m_moved; - other.m_moved = true; - return *this; -} + Colour::Colour( Code _colourCode ) { use( _colourCode ); } + Colour::Colour( Colour&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; + } + Colour& Colour::operator=( Colour&& other ) noexcept { + m_moved = other.m_moved; + other.m_moved = true; + return *this; + } -Colour::~Colour(){ if( !m_moved ) use( None ); } + Colour::~Colour(){ if( !m_moved ) use( None ); } -void Colour::use( Code _colourCode ) { - static IColourImpl* impl = platformColourInstance(); - // Strictly speaking, this cannot possibly happen. - // However, under some conditions it does happen (see #1626), - // and this change is small enough that we can let practicality - // triumph over purity in this case. - if (impl != nullptr) { - impl->use( _colourCode ); + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = platformColourInstance(); + // Strictly speaking, this cannot possibly happen. + // However, under some conditions it does happen (see #1626), + // and this change is small enough that we can let practicality + // triumph over purity in this case. + if (impl != nullptr) { + impl->use( _colourCode ); + } } -} -std::ostream& operator << ( std::ostream& os, Colour const& ) { - return os; -} + std::ostream& operator << ( std::ostream& os, Colour const& ) { + return os; + } } // end namespace Catch @@ -10298,60 +10298,60 @@ std::ostream& operator << ( std::ostream& os, Colour const& ) { namespace Catch { -class Context : public IMutableContext, NonCopyable { - -public: // IContext - IResultCapture* getResultCapture() override { - return m_resultCapture; - } - IRunner* getRunner() override { - return m_runner; - } - - IConfigPtr const& getConfig() const override { - return m_config; - } + class Context : public IMutableContext, NonCopyable { - ~Context() override; + public: // IContext + IResultCapture* getResultCapture() override { + return m_resultCapture; + } + IRunner* getRunner() override { + return m_runner; + } -public: // IMutableContext - void setResultCapture( IResultCapture* resultCapture ) override { - m_resultCapture = resultCapture; - } - void setRunner( IRunner* runner ) override { - m_runner = runner; - } - void setConfig( IConfigPtr const& config ) override { - m_config = config; - } + IConfigPtr const& getConfig() const override { + return m_config; + } - friend IMutableContext& getCurrentMutableContext(); + ~Context() override; -private: - IConfigPtr m_config; - IRunner* m_runner = nullptr; - IResultCapture* m_resultCapture = nullptr; -}; + public: // IMutableContext + void setResultCapture( IResultCapture* resultCapture ) override { + m_resultCapture = resultCapture; + } + void setRunner( IRunner* runner ) override { + m_runner = runner; + } + void setConfig( IConfigPtr const& config ) override { + m_config = config; + } -IMutableContext *IMutableContext::currentContext = nullptr; + friend IMutableContext& getCurrentMutableContext(); -void IMutableContext::createContext() -{ - currentContext = new Context(); -} + private: + IConfigPtr m_config; + IRunner* m_runner = nullptr; + IResultCapture* m_resultCapture = nullptr; + }; -void cleanUpContext() { - delete IMutableContext::currentContext; - IMutableContext::currentContext = nullptr; -} -IContext::~IContext() = default; -IMutableContext::~IMutableContext() = default; -Context::~Context() = default; + IMutableContext *IMutableContext::currentContext = nullptr; -SimplePcg32& rng() { - static SimplePcg32 s_rng; - return s_rng; -} + void IMutableContext::createContext() + { + currentContext = new Context(); + } + + void cleanUpContext() { + delete IMutableContext::currentContext; + IMutableContext::currentContext = nullptr; + } + IContext::~IContext() = default; + IMutableContext::~IMutableContext() = default; + Context::~Context() = default; + + SimplePcg32& rng() { + static SimplePcg32 s_rng; + return s_rng; + } } // end catch_context.cpp @@ -10362,7 +10362,7 @@ SimplePcg32& rng() { #include namespace Catch { -void writeToDebugConsole( std::string const& text ); + void writeToDebugConsole( std::string const& text ); } // end catch_debug_console.h @@ -10377,7 +10377,7 @@ void writeToDebugConsole( std::string const& text ); #elif defined(CATCH_PLATFORM_WINDOWS) -namespace Catch { + namespace Catch { void writeToDebugConsole( std::string const& text ) { ::OutputDebugStringA( text.c_str() ); } @@ -10385,12 +10385,12 @@ namespace Catch { #else -namespace Catch { -void writeToDebugConsole( std::string const& text ) { - // !TBD: Need a version for Mac/ XCode and other IDEs - Catch::cout() << text; -} -} + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + // !TBD: Need a version for Mac/ XCode and other IDEs + Catch::cout() << text; + } + } #endif // Platform // end catch_debug_console.cpp @@ -10405,58 +10405,58 @@ void writeToDebugConsole( std::string const& text ) { # include #ifdef __apple_build_version__ -// These headers will only compile with AppleClang (XCode) -// For other compilers (Clang, GCC, ... ) we need to exclude them + // These headers will only compile with AppleClang (XCode) + // For other compilers (Clang, GCC, ... ) we need to exclude them # include #endif -namespace Catch { -#ifdef __apple_build_version__ -// The following function is taken directly from the following technical note: -// https://developer.apple.com/library/archive/qa/qa1361/_index.html + namespace Catch { + #ifdef __apple_build_version__ + // The following function is taken directly from the following technical note: + // https://developer.apple.com/library/archive/qa/qa1361/_index.html -// Returns true if the current process is being debugged (either -// running under the debugger or has a debugger attached post facto). -bool isDebuggerActive(){ - int mib[4]; - struct kinfo_proc info; - std::size_t size; + // Returns true if the current process is being debugged (either + // running under the debugger or has a debugger attached post facto). + bool isDebuggerActive(){ + int mib[4]; + struct kinfo_proc info; + std::size_t size; - // Initialize the flags so that, if sysctl fails for some bizarre - // reason, we get a predictable result. + // Initialize the flags so that, if sysctl fails for some bizarre + // reason, we get a predictable result. - info.kp_proc.p_flag = 0; + info.kp_proc.p_flag = 0; - // Initialize mib, which tells sysctl the info we want, in this case - // we're looking for information about a specific process ID. + // Initialize mib, which tells sysctl the info we want, in this case + // we're looking for information about a specific process ID. - mib[0] = CTL_KERN; - mib[1] = KERN_PROC; - mib[2] = KERN_PROC_PID; - mib[3] = getpid(); + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); - // Call sysctl. + // Call sysctl. - size = sizeof(info); - if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) { - Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; - return false; - } + size = sizeof(info); + if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) { + Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; + return false; + } - // We're being debugged if the P_TRACED flag is set. + // We're being debugged if the P_TRACED flag is set. - return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); -} -#else -bool isDebuggerActive() { + return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); + } + #else + bool isDebuggerActive() { // We need to find another way to determine this for non-appleclang compilers on macOS return false; } -#endif -} // namespace Catch + #endif + } // namespace Catch #elif defined(CATCH_PLATFORM_LINUX) -#include + #include #include namespace Catch{ @@ -10509,16 +10509,16 @@ bool isDebuggerActive() { namespace Catch { -ITransientExpression::~ITransientExpression() = default; + ITransientExpression::~ITransientExpression() = default; -void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { - if( lhs.size() + rhs.size() < 40 && - lhs.find('\n') == std::string::npos && - rhs.find('\n') == std::string::npos ) - os << lhs << " " << op << " " << rhs; - else - os << lhs << "\n" << op << "\n" << rhs; -} + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { + if( lhs.size() + rhs.size() < 40 && + lhs.find('\n') == std::string::npos && + rhs.find('\n') == std::string::npos ) + os << lhs << " " << op << " " << rhs; + else + os << lhs << "\n" << op << "\n" << rhs; + } } // end catch_decomposer.cpp // start catch_enforce.cpp @@ -10527,7 +10527,7 @@ void formatReconstructedExpression( std::ostream &os, std::string const& lhs, St namespace Catch { #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) -[[noreturn]] + [[noreturn]] void throw_exception(std::exception const& e) { Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" << "The message was: " << e.what() << '\n'; @@ -10535,20 +10535,20 @@ namespace Catch { } #endif -[[noreturn]] -void throw_logic_error(std::string const& msg) { - throw_exception(std::logic_error(msg)); -} + [[noreturn]] + void throw_logic_error(std::string const& msg) { + throw_exception(std::logic_error(msg)); + } -[[noreturn]] -void throw_domain_error(std::string const& msg) { - throw_exception(std::domain_error(msg)); -} + [[noreturn]] + void throw_domain_error(std::string const& msg) { + throw_exception(std::domain_error(msg)); + } -[[noreturn]] -void throw_runtime_error(std::string const& msg) { - throw_exception(std::runtime_error(msg)); -} + [[noreturn]] + void throw_runtime_error(std::string const& msg) { + throw_exception(std::runtime_error(msg)); + } } // namespace Catch; // end catch_enforce.cpp @@ -10560,20 +10560,20 @@ void throw_runtime_error(std::string const& msg) { namespace Catch { -namespace Detail { + namespace Detail { -std::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ); + std::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ); -class EnumValuesRegistry : public IMutableEnumValuesRegistry { + class EnumValuesRegistry : public IMutableEnumValuesRegistry { - std::vector> m_enumInfos; + std::vector> m_enumInfos; - EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values) override; -}; + EnumInfo const& registerEnum( StringRef enumName, StringRef allEnums, std::vector const& values) override; + }; -std::vector parseEnums( StringRef enums ); + std::vector parseEnums( StringRef enums ); -} // Detail + } // Detail } // Catch @@ -10584,63 +10584,63 @@ std::vector parseEnums( StringRef enums ); namespace Catch { -IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {} + IMutableEnumValuesRegistry::~IMutableEnumValuesRegistry() {} -namespace Detail { + namespace Detail { -namespace { -// Extracts the actual name part of an enum instance -// In other words, it returns the Blue part of Bikeshed::Colour::Blue -StringRef extractInstanceName(StringRef enumInstance) { - // Find last occurrence of ":" - size_t name_start = enumInstance.size(); - while (name_start > 0 && enumInstance[name_start - 1] != ':') { - --name_start; - } - return enumInstance.substr(name_start, enumInstance.size() - name_start); -} -} + namespace { + // Extracts the actual name part of an enum instance + // In other words, it returns the Blue part of Bikeshed::Colour::Blue + StringRef extractInstanceName(StringRef enumInstance) { + // Find last occurrence of ":" + size_t name_start = enumInstance.size(); + while (name_start > 0 && enumInstance[name_start - 1] != ':') { + --name_start; + } + return enumInstance.substr(name_start, enumInstance.size() - name_start); + } + } -std::vector parseEnums( StringRef enums ) { - auto enumValues = splitStringRef( enums, ',' ); - std::vector parsed; - parsed.reserve( enumValues.size() ); - for( auto const& enumValue : enumValues ) { - parsed.push_back(trim(extractInstanceName(enumValue))); - } - return parsed; -} + std::vector parseEnums( StringRef enums ) { + auto enumValues = splitStringRef( enums, ',' ); + std::vector parsed; + parsed.reserve( enumValues.size() ); + for( auto const& enumValue : enumValues ) { + parsed.push_back(trim(extractInstanceName(enumValue))); + } + return parsed; + } -EnumInfo::~EnumInfo() {} + EnumInfo::~EnumInfo() {} -StringRef EnumInfo::lookup( int value ) const { - for( auto const& valueToName : m_values ) { - if( valueToName.first == value ) - return valueToName.second; - } - return "{** unexpected enum value **}"_sr; -} + StringRef EnumInfo::lookup( int value ) const { + for( auto const& valueToName : m_values ) { + if( valueToName.first == value ) + return valueToName.second; + } + return "{** unexpected enum value **}"_sr; + } -std::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ) { - std::unique_ptr enumInfo( new EnumInfo ); - enumInfo->m_name = enumName; - enumInfo->m_values.reserve( values.size() ); + std::unique_ptr makeEnumInfo( StringRef enumName, StringRef allValueNames, std::vector const& values ) { + std::unique_ptr enumInfo( new EnumInfo ); + enumInfo->m_name = enumName; + enumInfo->m_values.reserve( values.size() ); - const auto valueNames = Catch::Detail::parseEnums( allValueNames ); - assert( valueNames.size() == values.size() ); - std::size_t i = 0; - for( auto value : values ) - enumInfo->m_values.emplace_back(value, valueNames[i++]); + const auto valueNames = Catch::Detail::parseEnums( allValueNames ); + assert( valueNames.size() == values.size() ); + std::size_t i = 0; + for( auto value : values ) + enumInfo->m_values.emplace_back(value, valueNames[i++]); - return enumInfo; -} + return enumInfo; + } -EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector const& values ) { - m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values)); - return *m_enumInfos.back(); -} + EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef allValueNames, std::vector const& values ) { + m_enumInfos.push_back(makeEnumInfo(enumName, allValueNames, values)); + return *m_enumInfos.back(); + } -} // Detail + } // Detail } // Catch // end catch_enum_values_registry.cpp @@ -10649,8 +10649,8 @@ EnumInfo const& EnumValuesRegistry::registerEnum( StringRef enumName, StringRef #include namespace Catch { -ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} -ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } } // end catch_errno_guard.cpp // start catch_exception_translator_registry.cpp @@ -10663,16 +10663,16 @@ ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } namespace Catch { -class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { -public: - ~ExceptionTranslatorRegistry(); - virtual void registerTranslator( const IExceptionTranslator* translator ); - std::string translateActiveException() const override; - std::string tryTranslators() const; + class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { + public: + ~ExceptionTranslatorRegistry(); + virtual void registerTranslator( const IExceptionTranslator* translator ); + std::string translateActiveException() const override; + std::string tryTranslators() const; -private: - std::vector> m_translators; -}; + private: + std::vector> m_translators; + }; } // end catch_exception_translator_registry.h @@ -10682,18 +10682,18 @@ class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { namespace Catch { -ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { -} + ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { + } -void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { - m_translators.push_back( std::unique_ptr( translator ) ); -} + void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { + m_translators.push_back( std::unique_ptr( translator ) ); + } #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -std::string ExceptionTranslatorRegistry::translateActiveException() const { - try { + std::string ExceptionTranslatorRegistry::translateActiveException() const { + try { #ifdef __OBJC__ - // In Objective-C try objective-c exceptions first + // In Objective-C try objective-c exceptions first @try { return tryTranslators(); } @@ -10701,47 +10701,47 @@ std::string ExceptionTranslatorRegistry::translateActiveException() const { return Catch::Detail::stringify( [exception description] ); } #else - // Compiling a mixed mode project with MSVC means that CLR - // exceptions will be caught in (...) as well. However, these - // do not fill-in std::current_exception and thus lead to crash - // when attempting rethrow. - // /EHa switch also causes structured exceptions to be caught - // here, but they fill-in current_exception properly, so - // at worst the output should be a little weird, instead of - // causing a crash. - if (std::current_exception() == nullptr) { - return "Non C++ exception. Possibly a CLR exception."; - } - return tryTranslators(); + // Compiling a mixed mode project with MSVC means that CLR + // exceptions will be caught in (...) as well. However, these + // do not fill-in std::current_exception and thus lead to crash + // when attempting rethrow. + // /EHa switch also causes structured exceptions to be caught + // here, but they fill-in current_exception properly, so + // at worst the output should be a little weird, instead of + // causing a crash. + if (std::current_exception() == nullptr) { + return "Non C++ exception. Possibly a CLR exception."; + } + return tryTranslators(); #endif + } + catch( TestFailureException& ) { + std::rethrow_exception(std::current_exception()); + } + catch( std::exception& ex ) { + return ex.what(); + } + catch( std::string& msg ) { + return msg; + } + catch( const char* msg ) { + return msg; + } + catch(...) { + return "Unknown exception"; + } } - catch( TestFailureException& ) { - std::rethrow_exception(std::current_exception()); - } - catch( std::exception& ex ) { - return ex.what(); - } - catch( std::string& msg ) { - return msg; - } - catch( const char* msg ) { - return msg; - } - catch(...) { - return "Unknown exception"; - } -} -std::string ExceptionTranslatorRegistry::tryTranslators() const { - if (m_translators.empty()) { - std::rethrow_exception(std::current_exception()); - } else { - return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end()); + std::string ExceptionTranslatorRegistry::tryTranslators() const { + if (m_translators.empty()) { + std::rethrow_exception(std::current_exception()); + } else { + return m_translators[0]->translate(m_translators.begin() + 1, m_translators.end()); + } } -} #else // ^^ Exceptions are enabled // Exceptions are disabled vv -std::string ExceptionTranslatorRegistry::translateActiveException() const { + std::string ExceptionTranslatorRegistry::translateActiveException() const { CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); } @@ -10778,15 +10778,15 @@ namespace Catch { #if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS ) namespace { -//! Signals fatal error message to the run context -void reportFatal( char const * const message ) { - Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); -} + //! Signals fatal error message to the run context + void reportFatal( char const * const message ) { + Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); + } -//! Minimal size Catch2 needs for its own fatal error handling. -//! Picked anecdotally, so it might not be sufficient on all -//! platforms, and for all configurations. -constexpr std::size_t minStackSizeForErrors = 32 * 1024; + //! Minimal size Catch2 needs for its own fatal error handling. + //! Picked anecdotally, so it might not be sufficient on all + //! platforms, and for all configurations. + constexpr std::size_t minStackSizeForErrors = 32 * 1024; } // end unnamed namespace #endif // CATCH_CONFIG_WINDOWS_SEH || CATCH_CONFIG_POSIX_SIGNALS @@ -10865,19 +10865,19 @@ namespace Catch { namespace Catch { -struct SignalDefs { - int id; - const char* name; -}; + struct SignalDefs { + int id; + const char* name; + }; -static SignalDefs signalDefs[] = { + static SignalDefs signalDefs[] = { { SIGINT, "SIGINT - Terminal interrupt signal" }, { SIGILL, "SIGILL - Illegal instruction signal" }, { SIGFPE, "SIGFPE - Floating point error signal" }, { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, { SIGTERM, "SIGTERM - Termination request signal" }, { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } -}; + }; // Older GCCs trigger -Wmissing-field-initializers for T foo = {} // which is zero initialization, but not explicit. We want to avoid @@ -10887,76 +10887,76 @@ static SignalDefs signalDefs[] = { # pragma GCC diagnostic ignored "-Wmissing-field-initializers" #endif -static char* altStackMem = nullptr; -static std::size_t altStackSize = 0; -static stack_t oldSigStack{}; -static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{}; - -static void restorePreviousSignalHandlers() { - // We set signal handlers back to the previous ones. Hopefully - // nobody overwrote them in the meantime, and doesn't expect - // their signal handlers to live past ours given that they - // installed them after ours.. - for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) { - sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); - } - // Return the old stack - sigaltstack(&oldSigStack, nullptr); -} - -static void handleSignal( int sig ) { - char const * name = ""; - for (auto const& def : signalDefs) { - if (sig == def.id) { - name = def.name; - break; + static char* altStackMem = nullptr; + static std::size_t altStackSize = 0; + static stack_t oldSigStack{}; + static struct sigaction oldSigActions[sizeof(signalDefs) / sizeof(SignalDefs)]{}; + + static void restorePreviousSignalHandlers() { + // We set signal handlers back to the previous ones. Hopefully + // nobody overwrote them in the meantime, and doesn't expect + // their signal handlers to live past ours given that they + // installed them after ours.. + for (std::size_t i = 0; i < sizeof(signalDefs) / sizeof(SignalDefs); ++i) { + sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); } + // Return the old stack + sigaltstack(&oldSigStack, nullptr); } - // We need to restore previous signal handlers and let them do - // their thing, so that the users can have the debugger break - // when a signal is raised, and so on. - restorePreviousSignalHandlers(); - reportFatal( name ); - raise( sig ); -} -FatalConditionHandler::FatalConditionHandler() { - assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists"); - if (altStackSize == 0) { - altStackSize = std::max(static_cast(SIGSTKSZ), minStackSizeForErrors); + static void handleSignal( int sig ) { + char const * name = ""; + for (auto const& def : signalDefs) { + if (sig == def.id) { + name = def.name; + break; + } + } + // We need to restore previous signal handlers and let them do + // their thing, so that the users can have the debugger break + // when a signal is raised, and so on. + restorePreviousSignalHandlers(); + reportFatal( name ); + raise( sig ); } - altStackMem = new char[altStackSize](); -} -FatalConditionHandler::~FatalConditionHandler() { - delete[] altStackMem; - // We signal that another instance can be constructed by zeroing - // out the pointer. - altStackMem = nullptr; -} + FatalConditionHandler::FatalConditionHandler() { + assert(!altStackMem && "Cannot initialize POSIX signal handler when one already exists"); + if (altStackSize == 0) { + altStackSize = std::max(static_cast(SIGSTKSZ), minStackSizeForErrors); + } + altStackMem = new char[altStackSize](); + } -void FatalConditionHandler::engage_platform() { - stack_t sigStack; - sigStack.ss_sp = altStackMem; - sigStack.ss_size = altStackSize; - sigStack.ss_flags = 0; - sigaltstack(&sigStack, &oldSigStack); - struct sigaction sa = { }; + FatalConditionHandler::~FatalConditionHandler() { + delete[] altStackMem; + // We signal that another instance can be constructed by zeroing + // out the pointer. + altStackMem = nullptr; + } - sa.sa_handler = handleSignal; - sa.sa_flags = SA_ONSTACK; - for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) { - sigaction(signalDefs[i].id, &sa, &oldSigActions[i]); + void FatalConditionHandler::engage_platform() { + stack_t sigStack; + sigStack.ss_sp = altStackMem; + sigStack.ss_size = altStackSize; + sigStack.ss_flags = 0; + sigaltstack(&sigStack, &oldSigStack); + struct sigaction sa = { }; + + sa.sa_handler = handleSignal; + sa.sa_flags = SA_ONSTACK; + for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) { + sigaction(signalDefs[i].id, &sa, &oldSigActions[i]); + } } -} #if defined(__GNUC__) # pragma GCC diagnostic pop #endif -void FatalConditionHandler::disengage_platform() { - restorePreviousSignalHandlers(); -} + void FatalConditionHandler::disengage_platform() { + restorePreviousSignalHandlers(); + } } // end namespace Catch @@ -10977,11 +10977,11 @@ const char* GeneratorException::what() const noexcept { namespace Generators { -GeneratorUntypedBase::~GeneratorUntypedBase() {} + GeneratorUntypedBase::~GeneratorUntypedBase() {} -auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { - return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); -} + auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + return getResultCapture().acquireGeneratorTracker( generatorName, lineInfo ); + } } // namespace Generators } // namespace Catch @@ -10989,27 +10989,27 @@ auto acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lin // start catch_interfaces_capture.cpp namespace Catch { -IResultCapture::~IResultCapture() = default; + IResultCapture::~IResultCapture() = default; } // end catch_interfaces_capture.cpp // start catch_interfaces_config.cpp namespace Catch { -IConfig::~IConfig() = default; + IConfig::~IConfig() = default; } // end catch_interfaces_config.cpp // start catch_interfaces_exception.cpp namespace Catch { -IExceptionTranslator::~IExceptionTranslator() = default; -IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; } // end catch_interfaces_exception.cpp // start catch_interfaces_registry_hub.cpp namespace Catch { -IRegistryHub::~IRegistryHub() = default; -IMutableRegistryHub::~IMutableRegistryHub() = default; + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; } // end catch_interfaces_registry_hub.cpp // start catch_interfaces_reporter.cpp @@ -11018,169 +11018,169 @@ IMutableRegistryHub::~IMutableRegistryHub() = default; namespace Catch { -class ListeningReporter : public IStreamingReporter { - using Reporters = std::vector; - Reporters m_listeners; - IStreamingReporterPtr m_reporter = nullptr; - ReporterPreferences m_preferences; + class ListeningReporter : public IStreamingReporter { + using Reporters = std::vector; + Reporters m_listeners; + IStreamingReporterPtr m_reporter = nullptr; + ReporterPreferences m_preferences; -public: - ListeningReporter(); + public: + ListeningReporter(); - void addListener( IStreamingReporterPtr&& listener ); - void addReporter( IStreamingReporterPtr&& reporter ); + void addListener( IStreamingReporterPtr&& listener ); + void addReporter( IStreamingReporterPtr&& reporter ); -public: // IStreamingReporter + public: // IStreamingReporter - ReporterPreferences getPreferences() const override; + ReporterPreferences getPreferences() const override; - void noMatchingTestCases( std::string const& spec ) override; + void noMatchingTestCases( std::string const& spec ) override; - void reportInvalidArguments(std::string const&arg) override; + void reportInvalidArguments(std::string const&arg) override; - static std::set getSupportedVerbosities(); + static std::set getSupportedVerbosities(); #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) - void benchmarkPreparing(std::string const& name) override; + void benchmarkPreparing(std::string const& name) override; void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; void benchmarkEnded( BenchmarkStats<> const& benchmarkStats ) override; void benchmarkFailed(std::string const&) override; #endif // CATCH_CONFIG_ENABLE_BENCHMARKING - void testRunStarting( TestRunInfo const& testRunInfo ) override; - void testGroupStarting( GroupInfo const& groupInfo ) override; - void testCaseStarting( TestCaseInfo const& testInfo ) override; - void sectionStarting( SectionInfo const& sectionInfo ) override; - void assertionStarting( AssertionInfo const& assertionInfo ) override; + void testRunStarting( TestRunInfo const& testRunInfo ) override; + void testGroupStarting( GroupInfo const& groupInfo ) override; + void testCaseStarting( TestCaseInfo const& testInfo ) override; + void sectionStarting( SectionInfo const& sectionInfo ) override; + void assertionStarting( AssertionInfo const& assertionInfo ) override; - // The return value indicates if the messages buffer should be cleared: - bool assertionEnded( AssertionStats const& assertionStats ) override; - void sectionEnded( SectionStats const& sectionStats ) override; - void testCaseEnded( TestCaseStats const& testCaseStats ) override; - void testGroupEnded( TestGroupStats const& testGroupStats ) override; - void testRunEnded( TestRunStats const& testRunStats ) override; + // The return value indicates if the messages buffer should be cleared: + bool assertionEnded( AssertionStats const& assertionStats ) override; + void sectionEnded( SectionStats const& sectionStats ) override; + void testCaseEnded( TestCaseStats const& testCaseStats ) override; + void testGroupEnded( TestGroupStats const& testGroupStats ) override; + void testRunEnded( TestRunStats const& testRunStats ) override; - void skipTest( TestCaseInfo const& testInfo ) override; - bool isMulti() const override; + void skipTest( TestCaseInfo const& testInfo ) override; + bool isMulti() const override; -}; + }; } // end namespace Catch // end catch_reporter_listening.h namespace Catch { -ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig ) - : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig ) + : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} -ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ) - : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ) + : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} -std::ostream& ReporterConfig::stream() const { return *m_stream; } -IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; } + std::ostream& ReporterConfig::stream() const { return *m_stream; } + IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; } -TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {} + TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {} -GroupInfo::GroupInfo( std::string const& _name, - std::size_t _groupIndex, - std::size_t _groupsCount ) - : name( _name ), - groupIndex( _groupIndex ), - groupsCounts( _groupsCount ) -{} + GroupInfo::GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ) + : name( _name ), + groupIndex( _groupIndex ), + groupsCounts( _groupsCount ) + {} -AssertionStats::AssertionStats( AssertionResult const& _assertionResult, - std::vector const& _infoMessages, - Totals const& _totals ) - : assertionResult( _assertionResult ), - infoMessages( _infoMessages ), - totals( _totals ) -{ - assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression; + AssertionStats::AssertionStats( AssertionResult const& _assertionResult, + std::vector const& _infoMessages, + Totals const& _totals ) + : assertionResult( _assertionResult ), + infoMessages( _infoMessages ), + totals( _totals ) + { + assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression; - if( assertionResult.hasMessage() ) { - // Copy message into messages list. - // !TBD This should have been done earlier, somewhere - MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); - builder << assertionResult.getMessage(); - builder.m_info.message = builder.m_stream.str(); + if( assertionResult.hasMessage() ) { + // Copy message into messages list. + // !TBD This should have been done earlier, somewhere + MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); + builder << assertionResult.getMessage(); + builder.m_info.message = builder.m_stream.str(); - infoMessages.push_back( builder.m_info ); + infoMessages.push_back( builder.m_info ); + } } -} -AssertionStats::~AssertionStats() = default; - -SectionStats::SectionStats( SectionInfo const& _sectionInfo, - Counts const& _assertions, - double _durationInSeconds, - bool _missingAssertions ) - : sectionInfo( _sectionInfo ), - assertions( _assertions ), - durationInSeconds( _durationInSeconds ), - missingAssertions( _missingAssertions ) -{} - -SectionStats::~SectionStats() = default; - -TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, - Totals const& _totals, - std::string const& _stdOut, - std::string const& _stdErr, - bool _aborting ) - : testInfo( _testInfo ), - totals( _totals ), - stdOut( _stdOut ), - stdErr( _stdErr ), - aborting( _aborting ) -{} - -TestCaseStats::~TestCaseStats() = default; - -TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo, - Totals const& _totals, - bool _aborting ) - : groupInfo( _groupInfo ), - totals( _totals ), - aborting( _aborting ) -{} - -TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo ) - : groupInfo( _groupInfo ), - aborting( false ) -{} - -TestGroupStats::~TestGroupStats() = default; - -TestRunStats::TestRunStats( TestRunInfo const& _runInfo, - Totals const& _totals, - bool _aborting ) - : runInfo( _runInfo ), - totals( _totals ), - aborting( _aborting ) -{} - -TestRunStats::~TestRunStats() = default; - -void IStreamingReporter::fatalErrorEncountered( StringRef ) {} -bool IStreamingReporter::isMulti() const { return false; } - -IReporterFactory::~IReporterFactory() = default; -IReporterRegistry::~IReporterRegistry() = default; + AssertionStats::~AssertionStats() = default; + + SectionStats::SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ) + : sectionInfo( _sectionInfo ), + assertions( _assertions ), + durationInSeconds( _durationInSeconds ), + missingAssertions( _missingAssertions ) + {} + + SectionStats::~SectionStats() = default; + + TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ) + : testInfo( _testInfo ), + totals( _totals ), + stdOut( _stdOut ), + stdErr( _stdErr ), + aborting( _aborting ) + {} + + TestCaseStats::~TestCaseStats() = default; + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ) + : groupInfo( _groupInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo ) + : groupInfo( _groupInfo ), + aborting( false ) + {} + + TestGroupStats::~TestGroupStats() = default; + + TestRunStats::TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ) + : runInfo( _runInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestRunStats::~TestRunStats() = default; + + void IStreamingReporter::fatalErrorEncountered( StringRef ) {} + bool IStreamingReporter::isMulti() const { return false; } + + IReporterFactory::~IReporterFactory() = default; + IReporterRegistry::~IReporterRegistry() = default; } // end namespace Catch // end catch_interfaces_reporter.cpp // start catch_interfaces_runner.cpp namespace Catch { -IRunner::~IRunner() = default; + IRunner::~IRunner() = default; } // end catch_interfaces_runner.cpp // start catch_interfaces_testcase.cpp namespace Catch { -ITestInvoker::~ITestInvoker() = default; -ITestCaseRegistry::~ITestCaseRegistry() = default; + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; } // end catch_interfaces_testcase.cpp // start catch_leak_detector.cpp @@ -11204,7 +11204,7 @@ namespace Catch { #else -Catch::LeakDetector::LeakDetector() {} + Catch::LeakDetector::LeakDetector() {} #endif @@ -11220,23 +11220,23 @@ Catch::LeakDetector::~LeakDetector() { namespace Catch { -std::size_t listTests( Config const& config ); + std::size_t listTests( Config const& config ); -std::size_t listTestsNamesOnly( Config const& config ); + std::size_t listTestsNamesOnly( Config const& config ); -struct TagInfo { - void add( std::string const& spelling ); - std::string all() const; + struct TagInfo { + void add( std::string const& spelling ); + std::string all() const; - std::set spellings; - std::size_t count = 0; -}; + std::set spellings; + std::size_t count = 0; + }; -std::size_t listTags( Config const& config ); + std::size_t listTags( Config const& config ); -std::size_t listReporters(); + std::size_t listReporters(); -Option list( std::shared_ptr const& config ); + Option list( std::shared_ptr const& config ); } // end namespace Catch @@ -11244,7 +11244,7 @@ Option list( std::shared_ptr const& config ); // start catch_text.h namespace Catch { -using namespace clara::TextFlow; + using namespace clara::TextFlow; } // end catch_text.h @@ -11254,148 +11254,148 @@ using namespace clara::TextFlow; namespace Catch { -std::size_t listTests( Config const& config ) { - TestSpec const& testSpec = config.testSpec(); - if( config.hasTestFilters() ) - Catch::cout() << "Matching test cases:\n"; - else { - Catch::cout() << "All available test cases:\n"; - } + std::size_t listTests( Config const& config ) { + TestSpec const& testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Matching test cases:\n"; + else { + Catch::cout() << "All available test cases:\n"; + } - auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); - for( auto const& testCaseInfo : matchedTestCases ) { - Colour::Code colour = testCaseInfo.isHidden() - ? Colour::SecondaryText - : Colour::None; - Colour colourGuard( colour ); + auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + Colour::Code colour = testCaseInfo.isHidden() + ? Colour::SecondaryText + : Colour::None; + Colour colourGuard( colour ); + + Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; + if( config.verbosity() >= Verbosity::High ) { + Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; + std::string description = testCaseInfo.description; + if( description.empty() ) + description = "(NO DESCRIPTION)"; + Catch::cout() << Column( description ).indent(4) << std::endl; + } + if( !testCaseInfo.tags.empty() ) + Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; + } - Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; - if( config.verbosity() >= Verbosity::High ) { - Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; - std::string description = testCaseInfo.description; - if( description.empty() ) - description = "(NO DESCRIPTION)"; - Catch::cout() << Column( description ).indent(4) << std::endl; + if( !config.hasTestFilters() ) + Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; + else + Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; + return matchedTestCases.size(); + } + + std::size_t listTestsNamesOnly( Config const& config ) { + TestSpec const& testSpec = config.testSpec(); + std::size_t matchedTests = 0; + std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + matchedTests++; + if( startsWith( testCaseInfo.name, '#' ) ) + Catch::cout() << '"' << testCaseInfo.name << '"'; + else + Catch::cout() << testCaseInfo.name; + if ( config.verbosity() >= Verbosity::High ) + Catch::cout() << "\t@" << testCaseInfo.lineInfo; + Catch::cout() << std::endl; } - if( !testCaseInfo.tags.empty() ) - Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; + return matchedTests; } - if( !config.hasTestFilters() ) - Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; - else - Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; - return matchedTestCases.size(); -} - -std::size_t listTestsNamesOnly( Config const& config ) { - TestSpec const& testSpec = config.testSpec(); - std::size_t matchedTests = 0; - std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); - for( auto const& testCaseInfo : matchedTestCases ) { - matchedTests++; - if( startsWith( testCaseInfo.name, '#' ) ) - Catch::cout() << '"' << testCaseInfo.name << '"'; - else - Catch::cout() << testCaseInfo.name; - if ( config.verbosity() >= Verbosity::High ) - Catch::cout() << "\t@" << testCaseInfo.lineInfo; - Catch::cout() << std::endl; + void TagInfo::add( std::string const& spelling ) { + ++count; + spellings.insert( spelling ); } - return matchedTests; -} -void TagInfo::add( std::string const& spelling ) { - ++count; - spellings.insert( spelling ); -} + std::string TagInfo::all() const { + size_t size = 0; + for (auto const& spelling : spellings) { + // Add 2 for the brackes + size += spelling.size() + 2; + } -std::string TagInfo::all() const { - size_t size = 0; - for (auto const& spelling : spellings) { - // Add 2 for the brackes - size += spelling.size() + 2; + std::string out; out.reserve(size); + for (auto const& spelling : spellings) { + out += '['; + out += spelling; + out += ']'; + } + return out; } - std::string out; out.reserve(size); - for (auto const& spelling : spellings) { - out += '['; - out += spelling; - out += ']'; - } - return out; -} + std::size_t listTags( Config const& config ) { + TestSpec const& testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Tags for matching test cases:\n"; + else { + Catch::cout() << "All available tags:\n"; + } -std::size_t listTags( Config const& config ) { - TestSpec const& testSpec = config.testSpec(); - if( config.hasTestFilters() ) - Catch::cout() << "Tags for matching test cases:\n"; - else { - Catch::cout() << "All available tags:\n"; - } + std::map tagCounts; - std::map tagCounts; + std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCase : matchedTestCases ) { + for( auto const& tagName : testCase.getTestCaseInfo().tags ) { + std::string lcaseTagName = toLower( tagName ); + auto countIt = tagCounts.find( lcaseTagName ); + if( countIt == tagCounts.end() ) + countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first; + countIt->second.add( tagName ); + } + } - std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); - for( auto const& testCase : matchedTestCases ) { - for( auto const& tagName : testCase.getTestCaseInfo().tags ) { - std::string lcaseTagName = toLower( tagName ); - auto countIt = tagCounts.find( lcaseTagName ); - if( countIt == tagCounts.end() ) - countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first; - countIt->second.add( tagName ); + for( auto const& tagCount : tagCounts ) { + ReusableStringStream rss; + rss << " " << std::setw(2) << tagCount.second.count << " "; + auto str = rss.str(); + auto wrapper = Column( tagCount.second.all() ) + .initialIndent( 0 ) + .indent( str.size() ) + .width( CATCH_CONFIG_CONSOLE_WIDTH-10 ); + Catch::cout() << str << wrapper << '\n'; } + Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; + return tagCounts.size(); } - for( auto const& tagCount : tagCounts ) { - ReusableStringStream rss; - rss << " " << std::setw(2) << tagCount.second.count << " "; - auto str = rss.str(); - auto wrapper = Column( tagCount.second.all() ) - .initialIndent( 0 ) - .indent( str.size() ) - .width( CATCH_CONFIG_CONSOLE_WIDTH-10 ); - Catch::cout() << str << wrapper << '\n'; - } - Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; - return tagCounts.size(); -} - -std::size_t listReporters() { - Catch::cout() << "Available reporters:\n"; - IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); - std::size_t maxNameLen = 0; - for( auto const& factoryKvp : factories ) - maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() ); - - for( auto const& factoryKvp : factories ) { - Catch::cout() - << Column( factoryKvp.first + ":" ) - .indent(2) - .width( 5+maxNameLen ) - + Column( factoryKvp.second->getDescription() ) - .initialIndent(0) - .indent(2) - .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) - << "\n"; - } - Catch::cout() << std::endl; - return factories.size(); -} + std::size_t listReporters() { + Catch::cout() << "Available reporters:\n"; + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + std::size_t maxNameLen = 0; + for( auto const& factoryKvp : factories ) + maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() ); + + for( auto const& factoryKvp : factories ) { + Catch::cout() + << Column( factoryKvp.first + ":" ) + .indent(2) + .width( 5+maxNameLen ) + + Column( factoryKvp.second->getDescription() ) + .initialIndent(0) + .indent(2) + .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) + << "\n"; + } + Catch::cout() << std::endl; + return factories.size(); + } -Option list( std::shared_ptr const& config ) { - Option listedCount; - getCurrentMutableContext().setConfig( config ); - if( config->listTests() ) - listedCount = listedCount.valueOr(0) + listTests( *config ); - if( config->listTestNamesOnly() ) - listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config ); - if( config->listTags() ) - listedCount = listedCount.valueOr(0) + listTags( *config ); - if( config->listReporters() ) - listedCount = listedCount.valueOr(0) + listReporters(); - return listedCount; -} + Option list( std::shared_ptr const& config ) { + Option listedCount; + getCurrentMutableContext().setConfig( config ); + if( config->listTests() ) + listedCount = listedCount.valueOr(0) + listTests( *config ); + if( config->listTestNamesOnly() ) + listedCount = listedCount.valueOr(0) + listTestsNamesOnly( *config ); + if( config->listTags() ) + listedCount = listedCount.valueOr(0) + listTags( *config ); + if( config->listReporters() ) + listedCount = listedCount.valueOr(0) + listReporters(); + return listedCount; + } } // end namespace Catch // end catch_list.cpp @@ -11403,17 +11403,17 @@ Option list( std::shared_ptr const& config ) { namespace Catch { namespace Matchers { -namespace Impl { + namespace Impl { -std::string MatcherUntypedBase::toString() const { - if( m_cachedToString.empty() ) - m_cachedToString = describe(); - return m_cachedToString; -} + std::string MatcherUntypedBase::toString() const { + if( m_cachedToString.empty() ) + m_cachedToString = describe(); + return m_cachedToString; + } -MatcherUntypedBase::~MatcherUntypedBase() = default; + MatcherUntypedBase::~MatcherUntypedBase() = default; -} // namespace Impl + } // namespace Impl } // namespace Matchers using namespace Matchers; @@ -11449,8 +11449,8 @@ Exception::ExceptionMessageMatcher Message(std::string const& message) { // start catch_polyfills.hpp namespace Catch { -bool isnan(float f); -bool isnan(double d); + bool isnan(float f); + bool isnan(double d); } // end catch_polyfills.hpp @@ -11459,16 +11459,16 @@ bool isnan(double d); #include namespace Catch { -template -std::string to_string(T const& t) { + template + std::string to_string(T const& t) { #if defined(CATCH_CONFIG_CPP11_TO_STRING) - return std::to_string(t); + return std::to_string(t); #else - ReusableStringStream rss; + ReusableStringStream rss; rss << t; return rss.str(); #endif -} + } } // end namespace Catch // end catch_to_string.hpp @@ -11485,50 +11485,50 @@ std::string to_string(T const& t) { namespace Catch { namespace { -int32_t convert(float f) { - static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); - int32_t i; - std::memcpy(&i, &f, sizeof(f)); - return i; -} - -int64_t convert(double d) { - static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); - int64_t i; - std::memcpy(&i, &d, sizeof(d)); - return i; -} + int32_t convert(float f) { + static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); + int32_t i; + std::memcpy(&i, &f, sizeof(f)); + return i; + } -template -bool almostEqualUlps(FP lhs, FP rhs, uint64_t maxUlpDiff) { - // Comparison with NaN should always be false. - // This way we can rule it out before getting into the ugly details - if (Catch::isnan(lhs) || Catch::isnan(rhs)) { - return false; + int64_t convert(double d) { + static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); + int64_t i; + std::memcpy(&i, &d, sizeof(d)); + return i; } - auto lc = convert(lhs); - auto rc = convert(rhs); + template + bool almostEqualUlps(FP lhs, FP rhs, uint64_t maxUlpDiff) { + // Comparison with NaN should always be false. + // This way we can rule it out before getting into the ugly details + if (Catch::isnan(lhs) || Catch::isnan(rhs)) { + return false; + } - if ((lc < 0) != (rc < 0)) { - // Potentially we can have +0 and -0 - return lhs == rhs; - } + auto lc = convert(lhs); + auto rc = convert(rhs); - // static cast as a workaround for IBM XLC - auto ulpDiff = std::abs(static_cast(lc - rc)); - return static_cast(ulpDiff) <= maxUlpDiff; -} + if ((lc < 0) != (rc < 0)) { + // Potentially we can have +0 and -0 + return lhs == rhs; + } + + // static cast as a workaround for IBM XLC + auto ulpDiff = std::abs(static_cast(lc - rc)); + return static_cast(ulpDiff) <= maxUlpDiff; + } #if defined(CATCH_CONFIG_GLOBAL_NEXTAFTER) -float nextafter(float x, float y) { - return ::nextafterf(x, y); -} + float nextafter(float x, float y) { + return ::nextafterf(x, y); + } -double nextafter(double x, double y) { - return ::nextafter(x, y); -} + double nextafter(double x, double y) { + return ::nextafter(x, y); + } #endif // ^^^ CATCH_CONFIG_GLOBAL_NEXTAFTER ^^^ @@ -11562,33 +11562,33 @@ void write(std::ostream& out, FloatingPoint num) { namespace Matchers { namespace Floating { -enum class FloatingPointKind : uint8_t { - Float, - Double -}; + enum class FloatingPointKind : uint8_t { + Float, + Double + }; -WithinAbsMatcher::WithinAbsMatcher(double target, double margin) + WithinAbsMatcher::WithinAbsMatcher(double target, double margin) :m_target{ target }, m_margin{ margin } { - CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.' - << " Margin has to be non-negative."); -} + CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.' + << " Margin has to be non-negative."); + } -// Performs equivalent check of std::fabs(lhs - rhs) <= margin -// But without the subtraction to allow for INFINITY in comparison -bool WithinAbsMatcher::match(double const& matchee) const { - return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee); -} + // Performs equivalent check of std::fabs(lhs - rhs) <= margin + // But without the subtraction to allow for INFINITY in comparison + bool WithinAbsMatcher::match(double const& matchee) const { + return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee); + } -std::string WithinAbsMatcher::describe() const { - return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); -} + std::string WithinAbsMatcher::describe() const { + return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); + } -WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType) + WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPointKind baseType) :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { - CATCH_ENFORCE(m_type == FloatingPointKind::Double - || m_ulps < (std::numeric_limits::max)(), - "Provided ULP is impossibly large for a float comparison."); -} + CATCH_ENFORCE(m_type == FloatingPointKind::Double + || m_ulps < (std::numeric_limits::max)(), + "Provided ULP is impossibly large for a float comparison."); + } #if defined(__clang__) #pragma clang diagnostic push @@ -11596,67 +11596,67 @@ WithinUlpsMatcher::WithinUlpsMatcher(double target, uint64_t ulps, FloatingPoint #pragma clang diagnostic ignored "-Wunreachable-code" #endif -bool WithinUlpsMatcher::match(double const& matchee) const { - switch (m_type) { + bool WithinUlpsMatcher::match(double const& matchee) const { + switch (m_type) { case FloatingPointKind::Float: return almostEqualUlps(static_cast(matchee), static_cast(m_target), m_ulps); case FloatingPointKind::Double: return almostEqualUlps(matchee, m_target, m_ulps); default: CATCH_INTERNAL_ERROR( "Unknown FloatingPointKind value" ); + } } -} #if defined(__clang__) #pragma clang diagnostic pop #endif -std::string WithinUlpsMatcher::describe() const { - std::stringstream ret; + std::string WithinUlpsMatcher::describe() const { + std::stringstream ret; - ret << "is within " << m_ulps << " ULPs of "; + ret << "is within " << m_ulps << " ULPs of "; - if (m_type == FloatingPointKind::Float) { - write(ret, static_cast(m_target)); - ret << 'f'; - } else { - write(ret, m_target); - } + if (m_type == FloatingPointKind::Float) { + write(ret, static_cast(m_target)); + ret << 'f'; + } else { + write(ret, m_target); + } - ret << " (["; - if (m_type == FloatingPointKind::Double) { - write(ret, step(m_target, static_cast(-INFINITY), m_ulps)); - ret << ", "; - write(ret, step(m_target, static_cast( INFINITY), m_ulps)); - } else { - // We have to cast INFINITY to float because of MinGW, see #1782 - write(ret, step(static_cast(m_target), static_cast(-INFINITY), m_ulps)); - ret << ", "; - write(ret, step(static_cast(m_target), static_cast( INFINITY), m_ulps)); - } - ret << "])"; + ret << " (["; + if (m_type == FloatingPointKind::Double) { + write(ret, step(m_target, static_cast(-INFINITY), m_ulps)); + ret << ", "; + write(ret, step(m_target, static_cast( INFINITY), m_ulps)); + } else { + // We have to cast INFINITY to float because of MinGW, see #1782 + write(ret, step(static_cast(m_target), static_cast(-INFINITY), m_ulps)); + ret << ", "; + write(ret, step(static_cast(m_target), static_cast( INFINITY), m_ulps)); + } + ret << "])"; - return ret.str(); -} + return ret.str(); + } -WithinRelMatcher::WithinRelMatcher(double target, double epsilon): + WithinRelMatcher::WithinRelMatcher(double target, double epsilon): m_target(target), m_epsilon(epsilon){ - CATCH_ENFORCE(m_epsilon >= 0., "Relative comparison with epsilon < 0 does not make sense."); - CATCH_ENFORCE(m_epsilon < 1., "Relative comparison with epsilon >= 1 does not make sense."); -} + CATCH_ENFORCE(m_epsilon >= 0., "Relative comparison with epsilon < 0 does not make sense."); + CATCH_ENFORCE(m_epsilon < 1., "Relative comparison with epsilon >= 1 does not make sense."); + } -bool WithinRelMatcher::match(double const& matchee) const { - const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target)); - return marginComparison(matchee, m_target, - std::isinf(relMargin)? 0 : relMargin); -} + bool WithinRelMatcher::match(double const& matchee) const { + const auto relMargin = m_epsilon * (std::max)(std::fabs(matchee), std::fabs(m_target)); + return marginComparison(matchee, m_target, + std::isinf(relMargin)? 0 : relMargin); + } -std::string WithinRelMatcher::describe() const { - Catch::ReusableStringStream sstr; - sstr << "and " << m_target << " are within " << m_epsilon * 100. << "% of each other"; - return sstr.str(); -} + std::string WithinRelMatcher::describe() const { + Catch::ReusableStringStream sstr; + sstr << "and " << m_target << " are within " << m_epsilon * 100. << "% of each other"; + return sstr.str(); + } }// namespace Floating @@ -11708,97 +11708,97 @@ std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::str namespace Catch { namespace Matchers { -namespace StdString { + namespace StdString { -CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ) + CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ) : m_caseSensitivity( caseSensitivity ), m_str( adjustString( str ) ) -{} -std::string CasedString::adjustString( std::string const& str ) const { - return m_caseSensitivity == CaseSensitive::No - ? toLower( str ) - : str; -} -std::string CasedString::caseSensitivitySuffix() const { - return m_caseSensitivity == CaseSensitive::No - ? " (case insensitive)" - : std::string(); -} + {} + std::string CasedString::adjustString( std::string const& str ) const { + return m_caseSensitivity == CaseSensitive::No + ? toLower( str ) + : str; + } + std::string CasedString::caseSensitivitySuffix() const { + return m_caseSensitivity == CaseSensitive::No + ? " (case insensitive)" + : std::string(); + } -StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) + StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) : m_comparator( comparator ), m_operation( operation ) { -} + } -std::string StringMatcherBase::describe() const { - std::string description; - description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + - m_comparator.caseSensitivitySuffix().size()); - description += m_operation; - description += ": \""; - description += m_comparator.m_str; - description += "\""; - description += m_comparator.caseSensitivitySuffix(); - return description; -} + std::string StringMatcherBase::describe() const { + std::string description; + description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + + m_comparator.caseSensitivitySuffix().size()); + description += m_operation; + description += ": \""; + description += m_comparator.m_str; + description += "\""; + description += m_comparator.caseSensitivitySuffix(); + return description; + } -EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} -bool EqualsMatcher::match( std::string const& source ) const { - return m_comparator.adjustString( source ) == m_comparator.m_str; -} + bool EqualsMatcher::match( std::string const& source ) const { + return m_comparator.adjustString( source ) == m_comparator.m_str; + } -ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} + ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} -bool ContainsMatcher::match( std::string const& source ) const { - return contains( m_comparator.adjustString( source ), m_comparator.m_str ); -} + bool ContainsMatcher::match( std::string const& source ) const { + return contains( m_comparator.adjustString( source ), m_comparator.m_str ); + } -StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {} + StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {} -bool StartsWithMatcher::match( std::string const& source ) const { - return startsWith( m_comparator.adjustString( source ), m_comparator.m_str ); -} + bool StartsWithMatcher::match( std::string const& source ) const { + return startsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } -EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {} + EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {} -bool EndsWithMatcher::match( std::string const& source ) const { - return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); -} + bool EndsWithMatcher::match( std::string const& source ) const { + return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } -RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} + RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} -bool RegexMatcher::match(std::string const& matchee) const { - auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway - if (m_caseSensitivity == CaseSensitive::Choice::No) { - flags |= std::regex::icase; - } - auto reg = std::regex(m_regex, flags); - return std::regex_match(matchee, reg); -} + bool RegexMatcher::match(std::string const& matchee) const { + auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway + if (m_caseSensitivity == CaseSensitive::Choice::No) { + flags |= std::regex::icase; + } + auto reg = std::regex(m_regex, flags); + return std::regex_match(matchee, reg); + } -std::string RegexMatcher::describe() const { - return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively"); -} + std::string RegexMatcher::describe() const { + return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively"); + } -} // namespace StdString + } // namespace StdString -StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) ); -} -StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) ); -} -StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) ); -} -StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { - return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) ); -} + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } -StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) { - return StdString::RegexMatcher(regex, caseSensitivity); -} + StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) { + return StdString::RegexMatcher(regex, caseSensitivity); + } } // namespace Matchers } // namespace Catch @@ -11808,7 +11808,7 @@ StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice // start catch_uncaught_exceptions.h namespace Catch { -bool uncaught_exceptions(); + bool uncaught_exceptions(); } // end namespace Catch // end catch_uncaught_exceptions.h @@ -11817,84 +11817,84 @@ bool uncaught_exceptions(); namespace Catch { -MessageInfo::MessageInfo( StringRef const& _macroName, - SourceLineInfo const& _lineInfo, - ResultWas::OfType _type ) - : macroName( _macroName ), - lineInfo( _lineInfo ), - type( _type ), - sequence( ++globalCount ) -{} - -bool MessageInfo::operator==( MessageInfo const& other ) const { - return sequence == other.sequence; -} + MessageInfo::MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ) + : macroName( _macroName ), + lineInfo( _lineInfo ), + type( _type ), + sequence( ++globalCount ) + {} -bool MessageInfo::operator<( MessageInfo const& other ) const { - return sequence < other.sequence; -} + bool MessageInfo::operator==( MessageInfo const& other ) const { + return sequence == other.sequence; + } + + bool MessageInfo::operator<( MessageInfo const& other ) const { + return sequence < other.sequence; + } -// This may need protecting if threading support is added -unsigned int MessageInfo::globalCount = 0; + // This may need protecting if threading support is added + unsigned int MessageInfo::globalCount = 0; -//////////////////////////////////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////// -Catch::MessageBuilder::MessageBuilder( StringRef const& macroName, - SourceLineInfo const& lineInfo, - ResultWas::OfType type ) + Catch::MessageBuilder::MessageBuilder( StringRef const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ) :m_info(macroName, lineInfo, type) {} -//////////////////////////////////////////////////////////////////////////// - -ScopedMessage::ScopedMessage( MessageBuilder const& builder ) - : m_info( builder.m_info ), m_moved() -{ - m_info.message = builder.m_stream.str(); - getResultCapture().pushScopedMessage( m_info ); -} + //////////////////////////////////////////////////////////////////////////// -ScopedMessage::ScopedMessage( ScopedMessage&& old ) - : m_info( old.m_info ), m_moved() -{ - old.m_moved = true; -} + ScopedMessage::ScopedMessage( MessageBuilder const& builder ) + : m_info( builder.m_info ), m_moved() + { + m_info.message = builder.m_stream.str(); + getResultCapture().pushScopedMessage( m_info ); + } -ScopedMessage::~ScopedMessage() { - if ( !uncaught_exceptions() && !m_moved ){ - getResultCapture().popScopedMessage(m_info); + ScopedMessage::ScopedMessage( ScopedMessage&& old ) + : m_info( old.m_info ), m_moved() + { + old.m_moved = true; } -} -Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { - auto trimmed = [&] (size_t start, size_t end) { - while (names[start] == ',' || isspace(static_cast(names[start]))) { - ++start; + ScopedMessage::~ScopedMessage() { + if ( !uncaught_exceptions() && !m_moved ){ + getResultCapture().popScopedMessage(m_info); } - while (names[end] == ',' || isspace(static_cast(names[end]))) { - --end; - } - return names.substr(start, end - start + 1); - }; - auto skipq = [&] (size_t start, char quote) { - for (auto i = start + 1; i < names.size() ; ++i) { - if (names[i] == quote) - return i; - if (names[i] == '\\') - ++i; - } - CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote"); - }; + } - size_t start = 0; - std::stack openings; - for (size_t pos = 0; pos < names.size(); ++pos) { - char c = names[pos]; - switch (c) { + Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { + auto trimmed = [&] (size_t start, size_t end) { + while (names[start] == ',' || isspace(static_cast(names[start]))) { + ++start; + } + while (names[end] == ',' || isspace(static_cast(names[end]))) { + --end; + } + return names.substr(start, end - start + 1); + }; + auto skipq = [&] (size_t start, char quote) { + for (auto i = start + 1; i < names.size() ; ++i) { + if (names[i] == quote) + return i; + if (names[i] == '\\') + ++i; + } + CATCH_INTERNAL_ERROR("CAPTURE parsing encountered unmatched quote"); + }; + + size_t start = 0; + std::stack openings; + for (size_t pos = 0; pos < names.size(); ++pos) { + char c = names[pos]; + switch (c) { case '[': case '{': case '(': - // It is basically impossible to disambiguate between - // comparison and start of template args in this context + // It is basically impossible to disambiguate between + // comparison and start of template args in this context // case '<': openings.push(c); break; @@ -11915,27 +11915,27 @@ Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultW m_messages.back().message += " := "; start = pos; } + } + } + assert(openings.empty() && "Mismatched openings"); + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = static_cast(trimmed(start, names.size() - 1)); + m_messages.back().message += " := "; + } + Capturer::~Capturer() { + if ( !uncaught_exceptions() ){ + assert( m_captured == m_messages.size() ); + for( size_t i = 0; i < m_captured; ++i ) + m_resultCapture.popScopedMessage( m_messages[i] ); } } - assert(openings.empty() && "Mismatched openings"); - m_messages.emplace_back(macroName, lineInfo, resultType); - m_messages.back().message = static_cast(trimmed(start, names.size() - 1)); - m_messages.back().message += " := "; -} -Capturer::~Capturer() { - if ( !uncaught_exceptions() ){ - assert( m_captured == m_messages.size() ); - for( size_t i = 0; i < m_captured; ++i ) - m_resultCapture.popScopedMessage( m_messages[i] ); - } -} -void Capturer::captureValue( size_t index, std::string const& value ) { - assert( index < m_messages.size() ); - m_messages[index].message += value; - m_resultCapture.pushScopedMessage( m_messages[index] ); - m_captured++; -} + void Capturer::captureValue( size_t index, std::string const& value ) { + assert( index < m_messages.size() ); + m_messages[index].message += value; + m_resultCapture.pushScopedMessage( m_messages[index] ); + m_captured++; + } } // end namespace Catch // end catch_message.cpp @@ -11951,55 +11951,55 @@ void Capturer::captureValue( size_t index, std::string const& value ) { namespace Catch { -class RedirectedStream { - std::ostream& m_originalStream; - std::ostream& m_redirectionStream; - std::streambuf* m_prevBuf; + class RedirectedStream { + std::ostream& m_originalStream; + std::ostream& m_redirectionStream; + std::streambuf* m_prevBuf; -public: - RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ); - ~RedirectedStream(); -}; + public: + RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ); + ~RedirectedStream(); + }; -class RedirectedStdOut { - ReusableStringStream m_rss; - RedirectedStream m_cout; -public: - RedirectedStdOut(); - auto str() const -> std::string; -}; + class RedirectedStdOut { + ReusableStringStream m_rss; + RedirectedStream m_cout; + public: + RedirectedStdOut(); + auto str() const -> std::string; + }; -// StdErr has two constituent streams in C++, std::cerr and std::clog -// This means that we need to redirect 2 streams into 1 to keep proper -// order of writes -class RedirectedStdErr { - ReusableStringStream m_rss; - RedirectedStream m_cerr; - RedirectedStream m_clog; -public: - RedirectedStdErr(); - auto str() const -> std::string; -}; + // StdErr has two constituent streams in C++, std::cerr and std::clog + // This means that we need to redirect 2 streams into 1 to keep proper + // order of writes + class RedirectedStdErr { + ReusableStringStream m_rss; + RedirectedStream m_cerr; + RedirectedStream m_clog; + public: + RedirectedStdErr(); + auto str() const -> std::string; + }; -class RedirectedStreams { -public: - RedirectedStreams(RedirectedStreams const&) = delete; - RedirectedStreams& operator=(RedirectedStreams const&) = delete; - RedirectedStreams(RedirectedStreams&&) = delete; - RedirectedStreams& operator=(RedirectedStreams&&) = delete; + class RedirectedStreams { + public: + RedirectedStreams(RedirectedStreams const&) = delete; + RedirectedStreams& operator=(RedirectedStreams const&) = delete; + RedirectedStreams(RedirectedStreams&&) = delete; + RedirectedStreams& operator=(RedirectedStreams&&) = delete; - RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr); - ~RedirectedStreams(); -private: - std::string& m_redirectedCout; - std::string& m_redirectedCerr; - RedirectedStdOut m_redirectedStdOut; - RedirectedStdErr m_redirectedStdErr; -}; + RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr); + ~RedirectedStreams(); + private: + std::string& m_redirectedCout; + std::string& m_redirectedCerr; + RedirectedStdOut m_redirectedStdOut; + RedirectedStdErr m_redirectedStdErr; + }; #if defined(CATCH_CONFIG_NEW_CAPTURE) -// Windows's implementation of std::tmpfile is terrible (it tries + // Windows's implementation of std::tmpfile is terrible (it tries // to create a file inside system folder, thus requiring elevated // privileges for the binary), so we have to use tmpnam(_s) and // create the file ourselves there. @@ -12055,7 +12055,7 @@ class RedirectedStreams { #include #if defined(CATCH_CONFIG_NEW_CAPTURE) -#if defined(_MSC_VER) + #if defined(_MSC_VER) #include //_dup and _dup2 #define dup _dup #define dup2 _dup2 @@ -12067,36 +12067,36 @@ class RedirectedStreams { namespace Catch { -RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ) - : m_originalStream( originalStream ), - m_redirectionStream( redirectionStream ), - m_prevBuf( m_originalStream.rdbuf() ) -{ - m_originalStream.rdbuf( m_redirectionStream.rdbuf() ); -} + RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ) + : m_originalStream( originalStream ), + m_redirectionStream( redirectionStream ), + m_prevBuf( m_originalStream.rdbuf() ) + { + m_originalStream.rdbuf( m_redirectionStream.rdbuf() ); + } -RedirectedStream::~RedirectedStream() { - m_originalStream.rdbuf( m_prevBuf ); -} + RedirectedStream::~RedirectedStream() { + m_originalStream.rdbuf( m_prevBuf ); + } -RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} -auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); } + RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} + auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); } -RedirectedStdErr::RedirectedStdErr() - : m_cerr( Catch::cerr(), m_rss.get() ), - m_clog( Catch::clog(), m_rss.get() ) -{} -auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); } + RedirectedStdErr::RedirectedStdErr() + : m_cerr( Catch::cerr(), m_rss.get() ), + m_clog( Catch::clog(), m_rss.get() ) + {} + auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); } -RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr) - : m_redirectedCout(redirectedCout), - m_redirectedCerr(redirectedCerr) -{} + RedirectedStreams::RedirectedStreams(std::string& redirectedCout, std::string& redirectedCerr) + : m_redirectedCout(redirectedCout), + m_redirectedCerr(redirectedCerr) + {} -RedirectedStreams::~RedirectedStreams() { - m_redirectedCout += m_redirectedStdOut.str(); - m_redirectedCerr += m_redirectedStdErr.str(); -} + RedirectedStreams::~RedirectedStreams() { + m_redirectedCout += m_redirectedStdOut.str(); + m_redirectedCerr += m_redirectedStdErr.str(); + } #if defined(CATCH_CONFIG_NEW_CAPTURE) @@ -12177,7 +12177,7 @@ RedirectedStreams::~RedirectedStreams() { } // namespace Catch #if defined(CATCH_CONFIG_NEW_CAPTURE) -#if defined(_MSC_VER) + #if defined(_MSC_VER) #undef dup #undef dup2 #undef fileno @@ -12191,14 +12191,14 @@ RedirectedStreams::~RedirectedStreams() { namespace Catch { #if !defined(CATCH_CONFIG_POLYFILL_ISNAN) -bool isnan(float f) { - return std::isnan(f); -} -bool isnan(double d) { - return std::isnan(d); -} + bool isnan(float f) { + return std::isnan(f); + } + bool isnan(double d) { + return std::isnan(d); + } #else -// For now we only use this for embarcadero + // For now we only use this for embarcadero bool isnan(float f) { return std::_isnan(f); } @@ -12219,12 +12219,12 @@ namespace { #pragma warning(push) #pragma warning(disable:4146) // we negate uint32 during the rotate #endif -// Safe rotr implementation thanks to John Regehr -uint32_t rotate_right(uint32_t val, uint32_t count) { - const uint32_t mask = 31; - count &= mask; - return (val >> count) | (val << (-count & mask)); -} + // Safe rotr implementation thanks to John Regehr + uint32_t rotate_right(uint32_t val, uint32_t count) { + const uint32_t mask = 31; + count &= mask; + return (val >> count) | (val << (-count & mask)); + } #if defined(_MSC_VER) #pragma warning(pop) @@ -12232,43 +12232,43 @@ uint32_t rotate_right(uint32_t val, uint32_t count) { } -SimplePcg32::SimplePcg32(result_type seed_) { - seed(seed_); -} + SimplePcg32::SimplePcg32(result_type seed_) { + seed(seed_); + } -void SimplePcg32::seed(result_type seed_) { - m_state = 0; - (*this)(); - m_state += seed_; - (*this)(); -} + void SimplePcg32::seed(result_type seed_) { + m_state = 0; + (*this)(); + m_state += seed_; + (*this)(); + } -void SimplePcg32::discard(uint64_t skip) { - // We could implement this to run in O(log n) steps, but this - // should suffice for our use case. - for (uint64_t s = 0; s < skip; ++s) { - static_cast((*this)()); + void SimplePcg32::discard(uint64_t skip) { + // We could implement this to run in O(log n) steps, but this + // should suffice for our use case. + for (uint64_t s = 0; s < skip; ++s) { + static_cast((*this)()); + } } -} -SimplePcg32::result_type SimplePcg32::operator()() { - // prepare the output value - const uint32_t xorshifted = static_cast(((m_state >> 18u) ^ m_state) >> 27u); - const auto output = rotate_right(xorshifted, m_state >> 59u); + SimplePcg32::result_type SimplePcg32::operator()() { + // prepare the output value + const uint32_t xorshifted = static_cast(((m_state >> 18u) ^ m_state) >> 27u); + const auto output = rotate_right(xorshifted, m_state >> 59u); - // advance state - m_state = m_state * 6364136223846793005ULL + s_inc; + // advance state + m_state = m_state * 6364136223846793005ULL + s_inc; - return output; -} + return output; + } -bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { - return lhs.m_state == rhs.m_state; -} + bool operator==(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { + return lhs.m_state == rhs.m_state; + } -bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { - return lhs.m_state != rhs.m_state; -} + bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { + return lhs.m_state != rhs.m_state; + } } // end catch_random_number_generator.cpp // start catch_registry_hub.cpp @@ -12282,49 +12282,49 @@ bool operator!=(SimplePcg32 const& lhs, SimplePcg32 const& rhs) { namespace Catch { -class TestCase; -struct IConfig; + class TestCase; + struct IConfig; -std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ); + std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ); -bool isThrowSafe( TestCase const& testCase, IConfig const& config ); -bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + bool isThrowSafe( TestCase const& testCase, IConfig const& config ); + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); -void enforceNoDuplicateTestCases( std::vector const& functions ); + void enforceNoDuplicateTestCases( std::vector const& functions ); -std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); -std::vector const& getAllTestCasesSorted( IConfig const& config ); + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); -class TestRegistry : public ITestCaseRegistry { -public: - virtual ~TestRegistry() = default; + class TestRegistry : public ITestCaseRegistry { + public: + virtual ~TestRegistry() = default; - virtual void registerTest( TestCase const& testCase ); + virtual void registerTest( TestCase const& testCase ); - std::vector const& getAllTests() const override; - std::vector const& getAllTestsSorted( IConfig const& config ) const override; + std::vector const& getAllTests() const override; + std::vector const& getAllTestsSorted( IConfig const& config ) const override; -private: - std::vector m_functions; - mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder; - mutable std::vector m_sortedFunctions; - std::size_t m_unnamedCount = 0; - std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised -}; + private: + std::vector m_functions; + mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder; + mutable std::vector m_sortedFunctions; + std::size_t m_unnamedCount = 0; + std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised + }; -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// -class TestInvokerAsFunction : public ITestInvoker { - void(*m_testAsFunction)(); -public: - TestInvokerAsFunction( void(*testAsFunction)() ) noexcept; + class TestInvokerAsFunction : public ITestInvoker { + void(*m_testAsFunction)(); + public: + TestInvokerAsFunction( void(*testAsFunction)() ) noexcept; - void invoke() const override; -}; + void invoke() const override; + }; -std::string extractClassName( StringRef const& classOrQualifiedMethodName ); + std::string extractClassName( StringRef const& classOrQualifiedMethodName ); -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// } // end namespace Catch @@ -12335,24 +12335,24 @@ std::string extractClassName( StringRef const& classOrQualifiedMethodName ); namespace Catch { -class ReporterRegistry : public IReporterRegistry { + class ReporterRegistry : public IReporterRegistry { -public: + public: - ~ReporterRegistry() override; + ~ReporterRegistry() override; - IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; + IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; - void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); - void registerListener( IReporterFactoryPtr const& factory ); + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); + void registerListener( IReporterFactoryPtr const& factory ); - FactoryMap const& getFactories() const override; - Listeners const& getListeners() const override; + FactoryMap const& getFactories() const override; + Listeners const& getListeners() const override; -private: - FactoryMap m_factories; - Listeners m_listeners; -}; + private: + FactoryMap m_factories; + Listeners m_listeners; + }; } // end catch_reporter_registry.h @@ -12364,12 +12364,12 @@ class ReporterRegistry : public IReporterRegistry { namespace Catch { -struct TagAlias { - TagAlias(std::string const& _tag, SourceLineInfo _lineInfo); + struct TagAlias { + TagAlias(std::string const& _tag, SourceLineInfo _lineInfo); - std::string tag; - SourceLineInfo lineInfo; -}; + std::string tag; + SourceLineInfo lineInfo; + }; } // end namespace Catch @@ -12378,16 +12378,16 @@ struct TagAlias { namespace Catch { -class TagAliasRegistry : public ITagAliasRegistry { -public: - ~TagAliasRegistry() override; - TagAlias const* find( std::string const& alias ) const override; - std::string expandAliases( std::string const& unexpandedTestSpec ) const override; - void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); + class TagAliasRegistry : public ITagAliasRegistry { + public: + ~TagAliasRegistry() override; + TagAlias const* find( std::string const& alias ) const override; + std::string expandAliases( std::string const& unexpandedTestSpec ) const override; + void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); -private: - std::map m_registry; -}; + private: + std::map m_registry; + }; } // end namespace Catch @@ -12399,15 +12399,15 @@ class TagAliasRegistry : public ITagAliasRegistry { namespace Catch { -class StartupExceptionRegistry { + class StartupExceptionRegistry { #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) -public: - void add(std::exception_ptr const& exception) noexcept; - std::vector const& getExceptions() const noexcept; -private: - std::vector m_exceptions; + public: + void add(std::exception_ptr const& exception) noexcept; + std::vector const& getExceptions() const noexcept; + private: + std::vector m_exceptions; #endif -}; + }; } // end namespace Catch @@ -12416,114 +12416,114 @@ class StartupExceptionRegistry { namespace Catch { -struct ISingleton { - virtual ~ISingleton(); -}; + struct ISingleton { + virtual ~ISingleton(); + }; -void addSingleton( ISingleton* singleton ); -void cleanupSingletons(); + void addSingleton( ISingleton* singleton ); + void cleanupSingletons(); -template -class Singleton : SingletonImplT, public ISingleton { + template + class Singleton : SingletonImplT, public ISingleton { - static auto getInternal() -> Singleton* { - static Singleton* s_instance = nullptr; - if( !s_instance ) { - s_instance = new Singleton; - addSingleton( s_instance ); + static auto getInternal() -> Singleton* { + static Singleton* s_instance = nullptr; + if( !s_instance ) { + s_instance = new Singleton; + addSingleton( s_instance ); + } + return s_instance; } - return s_instance; - } -public: - static auto get() -> InterfaceT const& { - return *getInternal(); - } - static auto getMutable() -> MutableInterfaceT& { - return *getInternal(); - } -}; + public: + static auto get() -> InterfaceT const& { + return *getInternal(); + } + static auto getMutable() -> MutableInterfaceT& { + return *getInternal(); + } + }; } // namespace Catch // end catch_singletons.hpp namespace Catch { -namespace { + namespace { -class RegistryHub : public IRegistryHub, public IMutableRegistryHub, - private NonCopyable { + class RegistryHub : public IRegistryHub, public IMutableRegistryHub, + private NonCopyable { -public: // IRegistryHub - RegistryHub() = default; - IReporterRegistry const& getReporterRegistry() const override { - return m_reporterRegistry; - } - ITestCaseRegistry const& getTestCaseRegistry() const override { - return m_testCaseRegistry; - } - IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override { - return m_exceptionTranslatorRegistry; - } - ITagAliasRegistry const& getTagAliasRegistry() const override { - return m_tagAliasRegistry; - } - StartupExceptionRegistry const& getStartupExceptionRegistry() const override { - return m_exceptionRegistry; - } + public: // IRegistryHub + RegistryHub() = default; + IReporterRegistry const& getReporterRegistry() const override { + return m_reporterRegistry; + } + ITestCaseRegistry const& getTestCaseRegistry() const override { + return m_testCaseRegistry; + } + IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override { + return m_exceptionTranslatorRegistry; + } + ITagAliasRegistry const& getTagAliasRegistry() const override { + return m_tagAliasRegistry; + } + StartupExceptionRegistry const& getStartupExceptionRegistry() const override { + return m_exceptionRegistry; + } -public: // IMutableRegistryHub - void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { - m_reporterRegistry.registerReporter( name, factory ); - } - void registerListener( IReporterFactoryPtr const& factory ) override { - m_reporterRegistry.registerListener( factory ); - } - void registerTest( TestCase const& testInfo ) override { - m_testCaseRegistry.registerTest( testInfo ); - } - void registerTranslator( const IExceptionTranslator* translator ) override { - m_exceptionTranslatorRegistry.registerTranslator( translator ); - } - void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { - m_tagAliasRegistry.add( alias, tag, lineInfo ); - } - void registerStartupException() noexcept override { + public: // IMutableRegistryHub + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerReporter( name, factory ); + } + void registerListener( IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerListener( factory ); + } + void registerTest( TestCase const& testInfo ) override { + m_testCaseRegistry.registerTest( testInfo ); + } + void registerTranslator( const IExceptionTranslator* translator ) override { + m_exceptionTranslatorRegistry.registerTranslator( translator ); + } + void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { + m_tagAliasRegistry.add( alias, tag, lineInfo ); + } + void registerStartupException() noexcept override { #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - m_exceptionRegistry.add(std::current_exception()); + m_exceptionRegistry.add(std::current_exception()); #else - CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + CATCH_INTERNAL_ERROR("Attempted to register active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); #endif - } - IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override { - return m_enumValuesRegistry; - } + } + IMutableEnumValuesRegistry& getMutableEnumValuesRegistry() override { + return m_enumValuesRegistry; + } -private: - TestRegistry m_testCaseRegistry; - ReporterRegistry m_reporterRegistry; - ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; - TagAliasRegistry m_tagAliasRegistry; - StartupExceptionRegistry m_exceptionRegistry; - Detail::EnumValuesRegistry m_enumValuesRegistry; -}; -} + private: + TestRegistry m_testCaseRegistry; + ReporterRegistry m_reporterRegistry; + ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; + TagAliasRegistry m_tagAliasRegistry; + StartupExceptionRegistry m_exceptionRegistry; + Detail::EnumValuesRegistry m_enumValuesRegistry; + }; + } -using RegistryHubSingleton = Singleton; + using RegistryHubSingleton = Singleton; -IRegistryHub const& getRegistryHub() { - return RegistryHubSingleton::get(); -} -IMutableRegistryHub& getMutableRegistryHub() { - return RegistryHubSingleton::getMutable(); -} -void cleanUp() { - cleanupSingletons(); - cleanUpContext(); -} -std::string translateActiveException() { - return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); -} + IRegistryHub const& getRegistryHub() { + return RegistryHubSingleton::get(); + } + IMutableRegistryHub& getMutableRegistryHub() { + return RegistryHubSingleton::getMutable(); + } + void cleanUp() { + cleanupSingletons(); + cleanUpContext(); + } + std::string translateActiveException() { + return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); + } } // end namespace Catch // end catch_registry_hub.cpp @@ -12531,28 +12531,28 @@ std::string translateActiveException() { namespace Catch { -ReporterRegistry::~ReporterRegistry() = default; + ReporterRegistry::~ReporterRegistry() = default; -IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { - auto it = m_factories.find( name ); - if( it == m_factories.end() ) - return nullptr; - return it->second->create( ReporterConfig( config ) ); -} + IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { + auto it = m_factories.find( name ); + if( it == m_factories.end() ) + return nullptr; + return it->second->create( ReporterConfig( config ) ); + } -void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { - m_factories.emplace(name, factory); -} -void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { - m_listeners.push_back( factory ); -} + void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { + m_factories.emplace(name, factory); + } + void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { + m_listeners.push_back( factory ); + } -IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { - return m_factories; -} -IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { - return m_listeners; -} + IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { + return m_factories; + } + IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { + return m_listeners; + } } // end catch_reporter_registry.cpp @@ -12560,19 +12560,19 @@ IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { namespace Catch { -bool isOk( ResultWas::OfType resultType ) { - return ( resultType & ResultWas::FailureBit ) == 0; -} -bool isJustInfo( int flags ) { - return flags == ResultWas::Info; -} + bool isOk( ResultWas::OfType resultType ) { + return ( resultType & ResultWas::FailureBit ) == 0; + } + bool isJustInfo( int flags ) { + return flags == ResultWas::Info; + } -ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { - return static_cast( static_cast( lhs ) | static_cast( rhs ) ); -} + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { + return static_cast( static_cast( lhs ) | static_cast( rhs ) ); + } -bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } -bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } + bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } + bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } } // end namespace Catch // end catch_result_type.cpp @@ -12584,301 +12584,301 @@ bool shouldSuppressFailure( int flags ) { return ( flags & ResultDispositio namespace Catch { -namespace Generators { -struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { - GeneratorBasePtr m_generator; + namespace Generators { + struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { + GeneratorBasePtr m_generator; - GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) : TrackerBase( nameAndLocation, ctx, parent ) - {} - ~GeneratorTracker(); - - static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { - std::shared_ptr tracker; - - ITracker& currentTracker = ctx.currentTracker(); - // Under specific circumstances, the generator we want - // to acquire is also the current tracker. If this is - // the case, we have to avoid looking through current - // tracker's children, and instead return the current - // tracker. - // A case where this check is important is e.g. - // for (int i = 0; i < 5; ++i) { - // int n = GENERATE(1, 2); - // } - // - // without it, the code above creates 5 nested generators. - if (currentTracker.nameAndLocation() == nameAndLocation) { - auto thisTracker = currentTracker.parent().findChild(nameAndLocation); - assert(thisTracker); - assert(thisTracker->isGeneratorTracker()); - tracker = std::static_pointer_cast(thisTracker); - } else if ( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { - assert( childTracker ); - assert( childTracker->isGeneratorTracker() ); - tracker = std::static_pointer_cast( childTracker ); - } else { - tracker = std::make_shared( nameAndLocation, ctx, ¤tTracker ); - currentTracker.addChild( tracker ); - } - - if( !tracker->isComplete() ) { - tracker->open(); - } + {} + ~GeneratorTracker(); + + static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { + std::shared_ptr tracker; + + ITracker& currentTracker = ctx.currentTracker(); + // Under specific circumstances, the generator we want + // to acquire is also the current tracker. If this is + // the case, we have to avoid looking through current + // tracker's children, and instead return the current + // tracker. + // A case where this check is important is e.g. + // for (int i = 0; i < 5; ++i) { + // int n = GENERATE(1, 2); + // } + // + // without it, the code above creates 5 nested generators. + if (currentTracker.nameAndLocation() == nameAndLocation) { + auto thisTracker = currentTracker.parent().findChild(nameAndLocation); + assert(thisTracker); + assert(thisTracker->isGeneratorTracker()); + tracker = std::static_pointer_cast(thisTracker); + } else if ( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isGeneratorTracker() ); + tracker = std::static_pointer_cast( childTracker ); + } else { + tracker = std::make_shared( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( tracker ); + } - return *tracker; - } + if( !tracker->isComplete() ) { + tracker->open(); + } - // TrackerBase interface - bool isGeneratorTracker() const override { return true; } - auto hasGenerator() const -> bool override { - return !!m_generator; - } - void close() override { - TrackerBase::close(); - // If a generator has a child (it is followed by a section) - // and none of its children have started, then we must wait - // until later to start consuming its values. - // This catches cases where `GENERATE` is placed between two - // `SECTION`s. - // **The check for m_children.empty cannot be removed**. - // doing so would break `GENERATE` _not_ followed by `SECTION`s. - const bool should_wait_for_child = [&]() { - // No children -> nobody to wait for - if ( m_children.empty() ) { - return false; - } - // If at least one child started executing, don't wait - if ( std::find_if( - m_children.begin(), - m_children.end(), - []( TestCaseTracking::ITrackerPtr tracker ) { - return tracker->hasStarted(); - } ) != m_children.end() ) { - return false; + return *tracker; } - // No children have started. We need to check if they _can_ - // start, and thus we should wait for them, or they cannot - // start (due to filters), and we shouldn't wait for them - auto* parent = m_parent; - // This is safe: there is always at least one section - // tracker in a test case tracking tree - while ( !parent->isSectionTracker() ) { - parent = &( parent->parent() ); + // TrackerBase interface + bool isGeneratorTracker() const override { return true; } + auto hasGenerator() const -> bool override { + return !!m_generator; } - assert( parent && + void close() override { + TrackerBase::close(); + // If a generator has a child (it is followed by a section) + // and none of its children have started, then we must wait + // until later to start consuming its values. + // This catches cases where `GENERATE` is placed between two + // `SECTION`s. + // **The check for m_children.empty cannot be removed**. + // doing so would break `GENERATE` _not_ followed by `SECTION`s. + const bool should_wait_for_child = [&]() { + // No children -> nobody to wait for + if ( m_children.empty() ) { + return false; + } + // If at least one child started executing, don't wait + if ( std::find_if( + m_children.begin(), + m_children.end(), + []( TestCaseTracking::ITrackerPtr tracker ) { + return tracker->hasStarted(); + } ) != m_children.end() ) { + return false; + } + + // No children have started. We need to check if they _can_ + // start, and thus we should wait for them, or they cannot + // start (due to filters), and we shouldn't wait for them + auto* parent = m_parent; + // This is safe: there is always at least one section + // tracker in a test case tracking tree + while ( !parent->isSectionTracker() ) { + parent = &( parent->parent() ); + } + assert( parent && "Missing root (test case) level section" ); - auto const& parentSection = - static_cast( *parent ); - auto const& filters = parentSection.getFilters(); - // No filters -> no restrictions on running sections - if ( filters.empty() ) { - return true; - } + auto const& parentSection = + static_cast( *parent ); + auto const& filters = parentSection.getFilters(); + // No filters -> no restrictions on running sections + if ( filters.empty() ) { + return true; + } - for ( auto const& child : m_children ) { - if ( child->isSectionTracker() && - std::find( filters.begin(), - filters.end(), - static_cast( *child ) - .trimmedName() ) != - filters.end() ) { - return true; + for ( auto const& child : m_children ) { + if ( child->isSectionTracker() && + std::find( filters.begin(), + filters.end(), + static_cast( *child ) + .trimmedName() ) != + filters.end() ) { + return true; + } + } + return false; + }(); + + // This check is a bit tricky, because m_generator->next() + // has a side-effect, where it consumes generator's current + // value, but we do not want to invoke the side-effect if + // this generator is still waiting for any child to start. + if ( should_wait_for_child || + ( m_runState == CompletedSuccessfully && + m_generator->next() ) ) { + m_children.clear(); + m_runState = Executing; } } - return false; - }(); - // This check is a bit tricky, because m_generator->next() - // has a side-effect, where it consumes generator's current - // value, but we do not want to invoke the side-effect if - // this generator is still waiting for any child to start. - if ( should_wait_for_child || - ( m_runState == CompletedSuccessfully && - m_generator->next() ) ) { - m_children.clear(); - m_runState = Executing; - } + // IGeneratorTracker interface + auto getGenerator() const -> GeneratorBasePtr const& override { + return m_generator; + } + void setGenerator( GeneratorBasePtr&& generator ) override { + m_generator = std::move( generator ); + } + }; + GeneratorTracker::~GeneratorTracker() {} } - // IGeneratorTracker interface - auto getGenerator() const -> GeneratorBasePtr const& override { - return m_generator; + RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) + : m_runInfo(_config->name()), + m_context(getCurrentMutableContext()), + m_config(_config), + m_reporter(std::move(reporter)), + m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, + m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) + { + m_context.setRunner(this); + m_context.setConfig(m_config); + m_context.setResultCapture(this); + m_reporter->testRunStarting(m_runInfo); } - void setGenerator( GeneratorBasePtr&& generator ) override { - m_generator = std::move( generator ); + + RunContext::~RunContext() { + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting())); } -}; -GeneratorTracker::~GeneratorTracker() {} -} -RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) - : m_runInfo(_config->name()), - m_context(getCurrentMutableContext()), - m_config(_config), - m_reporter(std::move(reporter)), - m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, - m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) -{ - m_context.setRunner(this); - m_context.setConfig(m_config); - m_context.setResultCapture(this); - m_reporter->testRunStarting(m_runInfo); -} + void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount)); + } -RunContext::~RunContext() { - m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting())); -} + void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting())); + } -void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) { - m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount)); -} + Totals RunContext::runTest(TestCase const& testCase) { + Totals prevTotals = m_totals; -void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) { - m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting())); -} + std::string redirectedCout; + std::string redirectedCerr; -Totals RunContext::runTest(TestCase const& testCase) { - Totals prevTotals = m_totals; + auto const& testInfo = testCase.getTestCaseInfo(); - std::string redirectedCout; - std::string redirectedCerr; + m_reporter->testCaseStarting(testInfo); - auto const& testInfo = testCase.getTestCaseInfo(); + m_activeTestCase = &testCase; - m_reporter->testCaseStarting(testInfo); + ITracker& rootTracker = m_trackerContext.startRun(); + assert(rootTracker.isSectionTracker()); + static_cast(rootTracker).addInitialFilters(m_config->getSectionsToRun()); + do { + m_trackerContext.startCycle(); + m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); + runCurrentTest(redirectedCout, redirectedCerr); + } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); + + Totals deltaTotals = m_totals.delta(prevTotals); + if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) { + deltaTotals.assertions.failed++; + deltaTotals.testCases.passed--; + deltaTotals.testCases.failed++; + } + m_totals.testCases += deltaTotals.testCases; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + redirectedCout, + redirectedCerr, + aborting())); - m_activeTestCase = &testCase; + m_activeTestCase = nullptr; + m_testCaseTracker = nullptr; - ITracker& rootTracker = m_trackerContext.startRun(); - assert(rootTracker.isSectionTracker()); - static_cast(rootTracker).addInitialFilters(m_config->getSectionsToRun()); - do { - m_trackerContext.startCycle(); - m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); - runCurrentTest(redirectedCout, redirectedCerr); - } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); + return deltaTotals; + } - Totals deltaTotals = m_totals.delta(prevTotals); - if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) { - deltaTotals.assertions.failed++; - deltaTotals.testCases.passed--; - deltaTotals.testCases.failed++; + IConfigPtr RunContext::config() const { + return m_config; } - m_totals.testCases += deltaTotals.testCases; - m_reporter->testCaseEnded(TestCaseStats(testInfo, - deltaTotals, - redirectedCout, - redirectedCerr, - aborting())); - m_activeTestCase = nullptr; - m_testCaseTracker = nullptr; + IStreamingReporter& RunContext::reporter() const { + return *m_reporter; + } - return deltaTotals; -} + void RunContext::assertionEnded(AssertionResult const & result) { + if (result.getResultType() == ResultWas::Ok) { + m_totals.assertions.passed++; + m_lastAssertionPassed = true; + } else if (!result.isOk()) { + m_lastAssertionPassed = false; + if( m_activeTestCase->getTestCaseInfo().okToFail() ) + m_totals.assertions.failedButOk++; + else + m_totals.assertions.failed++; + } + else { + m_lastAssertionPassed = true; + } -IConfigPtr RunContext::config() const { - return m_config; -} + // We have no use for the return value (whether messages should be cleared), because messages were made scoped + // and should be let to clear themselves out. + static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); -IStreamingReporter& RunContext::reporter() const { - return *m_reporter; -} + if (result.getResultType() != ResultWas::Warning) + m_messageScopes.clear(); -void RunContext::assertionEnded(AssertionResult const & result) { - if (result.getResultType() == ResultWas::Ok) { - m_totals.assertions.passed++; - m_lastAssertionPassed = true; - } else if (!result.isOk()) { - m_lastAssertionPassed = false; - if( m_activeTestCase->getTestCaseInfo().okToFail() ) - m_totals.assertions.failedButOk++; - else - m_totals.assertions.failed++; + // Reset working state + resetAssertionInfo(); + m_lastResult = result; } - else { - m_lastAssertionPassed = true; + void RunContext::resetAssertionInfo() { + m_lastAssertionInfo.macroName = StringRef(); + m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; } - // We have no use for the return value (whether messages should be cleared), because messages were made scoped - // and should be let to clear themselves out. - static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); - - if (result.getResultType() != ResultWas::Warning) - m_messageScopes.clear(); - - // Reset working state - resetAssertionInfo(); - m_lastResult = result; -} -void RunContext::resetAssertionInfo() { - m_lastAssertionInfo.macroName = StringRef(); - m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; -} + bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { + ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); + if (!sectionTracker.isOpen()) + return false; + m_activeSections.push_back(§ionTracker); -bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { - ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); - if (!sectionTracker.isOpen()) - return false; - m_activeSections.push_back(§ionTracker); + m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; - m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; + m_reporter->sectionStarting(sectionInfo); - m_reporter->sectionStarting(sectionInfo); + assertions = m_totals.assertions; - assertions = m_totals.assertions; + return true; + } + auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + using namespace Generators; + GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext, + TestCaseTracking::NameAndLocation( static_cast(generatorName), lineInfo ) ); + m_lastAssertionInfo.lineInfo = lineInfo; + return tracker; + } - return true; -} -auto RunContext::acquireGeneratorTracker( StringRef generatorName, SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { - using namespace Generators; - GeneratorTracker& tracker = GeneratorTracker::acquire(m_trackerContext, - TestCaseTracking::NameAndLocation( static_cast(generatorName), lineInfo ) ); - m_lastAssertionInfo.lineInfo = lineInfo; - return tracker; -} + bool RunContext::testForMissingAssertions(Counts& assertions) { + if (assertions.total() != 0) + return false; + if (!m_config->warnAboutMissingAssertions()) + return false; + if (m_trackerContext.currentTracker().hasChildren()) + return false; + m_totals.assertions.failed++; + assertions.failed++; + return true; + } -bool RunContext::testForMissingAssertions(Counts& assertions) { - if (assertions.total() != 0) - return false; - if (!m_config->warnAboutMissingAssertions()) - return false; - if (m_trackerContext.currentTracker().hasChildren()) - return false; - m_totals.assertions.failed++; - assertions.failed++; - return true; -} + void RunContext::sectionEnded(SectionEndInfo const & endInfo) { + Counts assertions = m_totals.assertions - endInfo.prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); -void RunContext::sectionEnded(SectionEndInfo const & endInfo) { - Counts assertions = m_totals.assertions - endInfo.prevAssertions; - bool missingAssertions = testForMissingAssertions(assertions); + if (!m_activeSections.empty()) { + m_activeSections.back()->close(); + m_activeSections.pop_back(); + } - if (!m_activeSections.empty()) { - m_activeSections.back()->close(); - m_activeSections.pop_back(); + m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); + m_messages.clear(); + m_messageScopes.clear(); } - m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); - m_messages.clear(); - m_messageScopes.clear(); -} - -void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { - if (m_unfinishedSections.empty()) - m_activeSections.back()->fail(); - else - m_activeSections.back()->close(); - m_activeSections.pop_back(); + void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { + if (m_unfinishedSections.empty()) + m_activeSections.back()->fail(); + else + m_activeSections.back()->close(); + m_activeSections.pop_back(); - m_unfinishedSections.push_back(endInfo); -} + m_unfinishedSections.push_back(endInfo); + } #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) -void RunContext::benchmarkPreparing(std::string const& name) { + void RunContext::benchmarkPreparing(std::string const& name) { m_reporter->benchmarkPreparing(name); } void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { @@ -12892,275 +12892,275 @@ void RunContext::benchmarkPreparing(std::string const& name) { } #endif // CATCH_CONFIG_ENABLE_BENCHMARKING -void RunContext::pushScopedMessage(MessageInfo const & message) { - m_messages.push_back(message); -} + void RunContext::pushScopedMessage(MessageInfo const & message) { + m_messages.push_back(message); + } -void RunContext::popScopedMessage(MessageInfo const & message) { - m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); -} + void RunContext::popScopedMessage(MessageInfo const & message) { + m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); + } -void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { - m_messageScopes.emplace_back( builder ); -} + void RunContext::emplaceUnscopedMessage( MessageBuilder const& builder ) { + m_messageScopes.emplace_back( builder ); + } -std::string RunContext::getCurrentTestName() const { - return m_activeTestCase - ? m_activeTestCase->getTestCaseInfo().name - : std::string(); -} + std::string RunContext::getCurrentTestName() const { + return m_activeTestCase + ? m_activeTestCase->getTestCaseInfo().name + : std::string(); + } -const AssertionResult * RunContext::getLastResult() const { - return &(*m_lastResult); -} + const AssertionResult * RunContext::getLastResult() const { + return &(*m_lastResult); + } -void RunContext::exceptionEarlyReported() { - m_shouldReportUnexpected = false; -} + void RunContext::exceptionEarlyReported() { + m_shouldReportUnexpected = false; + } -void RunContext::handleFatalErrorCondition( StringRef message ) { - // First notify reporter that bad things happened - m_reporter->fatalErrorEncountered(message); - - // Don't rebuild the result -- the stringification itself can cause more fatal errors - // Instead, fake a result data. - AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); - tempResult.message = static_cast(message); - AssertionResult result(m_lastAssertionInfo, tempResult); - - assertionEnded(result); - - handleUnfinishedSections(); - - // Recreate section for test case (as we will lose the one that was in scope) - auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); - SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); - - Counts assertions; - assertions.failed = 1; - SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); - m_reporter->sectionEnded(testCaseSectionStats); - - auto const& testInfo = m_activeTestCase->getTestCaseInfo(); - - Totals deltaTotals; - deltaTotals.testCases.failed = 1; - deltaTotals.assertions.failed = 1; - m_reporter->testCaseEnded(TestCaseStats(testInfo, - deltaTotals, - std::string(), - std::string(), - false)); - m_totals.testCases.failed++; - testGroupEnded(std::string(), m_totals, 1, 1); - m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); -} + void RunContext::handleFatalErrorCondition( StringRef message ) { + // First notify reporter that bad things happened + m_reporter->fatalErrorEncountered(message); -bool RunContext::lastAssertionPassed() { - return m_lastAssertionPassed; -} + // Don't rebuild the result -- the stringification itself can cause more fatal errors + // Instead, fake a result data. + AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); + tempResult.message = static_cast(message); + AssertionResult result(m_lastAssertionInfo, tempResult); -void RunContext::assertionPassed() { - m_lastAssertionPassed = true; - ++m_totals.assertions.passed; - resetAssertionInfo(); - m_messageScopes.clear(); -} + assertionEnded(result); -bool RunContext::aborting() const { - return m_totals.assertions.failed >= static_cast(m_config->abortAfter()); -} + handleUnfinishedSections(); + + // Recreate section for test case (as we will lose the one that was in scope) + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); + + Counts assertions; + assertions.failed = 1; + SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); + m_reporter->sectionEnded(testCaseSectionStats); + + auto const& testInfo = m_activeTestCase->getTestCaseInfo(); + + Totals deltaTotals; + deltaTotals.testCases.failed = 1; + deltaTotals.assertions.failed = 1; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + std::string(), + std::string(), + false)); + m_totals.testCases.failed++; + testGroupEnded(std::string(), m_totals, 1, 1); + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); + } + + bool RunContext::lastAssertionPassed() { + return m_lastAssertionPassed; + } + + void RunContext::assertionPassed() { + m_lastAssertionPassed = true; + ++m_totals.assertions.passed; + resetAssertionInfo(); + m_messageScopes.clear(); + } + + bool RunContext::aborting() const { + return m_totals.assertions.failed >= static_cast(m_config->abortAfter()); + } -void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) { - auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); - SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); - m_reporter->sectionStarting(testCaseSection); - Counts prevAssertions = m_totals.assertions; - double duration = 0; - m_shouldReportUnexpected = true; - m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; + void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) { + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); + m_reporter->sectionStarting(testCaseSection); + Counts prevAssertions = m_totals.assertions; + double duration = 0; + m_shouldReportUnexpected = true; + m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; - seedRng(*m_config); + seedRng(*m_config); - Timer timer; - CATCH_TRY { - if (m_reporter->getPreferences().shouldRedirectStdOut) { + Timer timer; + CATCH_TRY { + if (m_reporter->getPreferences().shouldRedirectStdOut) { #if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) - RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr); + RedirectedStreams redirectedStreams(redirectedCout, redirectedCerr); - timer.start(); - invokeActiveTestCase(); + timer.start(); + invokeActiveTestCase(); #else - OutputRedirect r(redirectedCout, redirectedCerr); + OutputRedirect r(redirectedCout, redirectedCerr); timer.start(); invokeActiveTestCase(); #endif - } else { - timer.start(); - invokeActiveTestCase(); - } - duration = timer.getElapsedSeconds(); - } CATCH_CATCH_ANON (TestFailureException&) { - // This just means the test was aborted due to failure - } CATCH_CATCH_ALL { - // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions - // are reported without translation at the point of origin. - if( m_shouldReportUnexpected ) { - AssertionReaction dummyReaction; - handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); - } - } - Counts assertions = m_totals.assertions - prevAssertions; - bool missingAssertions = testForMissingAssertions(assertions); - - m_testCaseTracker->close(); - handleUnfinishedSections(); - m_messages.clear(); - m_messageScopes.clear(); - - SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); - m_reporter->sectionEnded(testCaseSectionStats); -} + } else { + timer.start(); + invokeActiveTestCase(); + } + duration = timer.getElapsedSeconds(); + } CATCH_CATCH_ANON (TestFailureException&) { + // This just means the test was aborted due to failure + } CATCH_CATCH_ALL { + // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions + // are reported without translation at the point of origin. + if( m_shouldReportUnexpected ) { + AssertionReaction dummyReaction; + handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); + } + } + Counts assertions = m_totals.assertions - prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); -void RunContext::invokeActiveTestCase() { - FatalConditionHandlerGuard _(&m_fatalConditionhandler); - m_activeTestCase->invoke(); -} + m_testCaseTracker->close(); + handleUnfinishedSections(); + m_messages.clear(); + m_messageScopes.clear(); -void RunContext::handleUnfinishedSections() { - // If sections ended prematurely due to an exception we stored their - // infos here so we can tear them down outside the unwind process. - for (auto it = m_unfinishedSections.rbegin(), - itEnd = m_unfinishedSections.rend(); - it != itEnd; - ++it) - sectionEnded(*it); - m_unfinishedSections.clear(); -} + SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + m_reporter->sectionEnded(testCaseSectionStats); + } + + void RunContext::invokeActiveTestCase() { + FatalConditionHandlerGuard _(&m_fatalConditionhandler); + m_activeTestCase->invoke(); + } -void RunContext::handleExpr( + void RunContext::handleUnfinishedSections() { + // If sections ended prematurely due to an exception we stored their + // infos here so we can tear them down outside the unwind process. + for (auto it = m_unfinishedSections.rbegin(), + itEnd = m_unfinishedSections.rend(); + it != itEnd; + ++it) + sectionEnded(*it); + m_unfinishedSections.clear(); + } + + void RunContext::handleExpr( AssertionInfo const& info, ITransientExpression const& expr, AssertionReaction& reaction -) { - m_reporter->assertionStarting( info ); + ) { + m_reporter->assertionStarting( info ); - bool negated = isFalseTest( info.resultDisposition ); - bool result = expr.getResult() != negated; + bool negated = isFalseTest( info.resultDisposition ); + bool result = expr.getResult() != negated; - if( result ) { - if (!m_includeSuccessfulResults) { - assertionPassed(); + if( result ) { + if (!m_includeSuccessfulResults) { + assertionPassed(); + } + else { + reportExpr(info, ResultWas::Ok, &expr, negated); + } } else { - reportExpr(info, ResultWas::Ok, &expr, negated); + reportExpr(info, ResultWas::ExpressionFailed, &expr, negated ); + populateReaction( reaction ); } } - else { - reportExpr(info, ResultWas::ExpressionFailed, &expr, negated ); - populateReaction( reaction ); - } -} -void RunContext::reportExpr( - AssertionInfo const &info, - ResultWas::OfType resultType, - ITransientExpression const *expr, - bool negated ) { + void RunContext::reportExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ) { - m_lastAssertionInfo = info; - AssertionResultData data( resultType, LazyExpression( negated ) ); + m_lastAssertionInfo = info; + AssertionResultData data( resultType, LazyExpression( negated ) ); - AssertionResult assertionResult{ info, data }; - assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; + AssertionResult assertionResult{ info, data }; + assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; - assertionEnded( assertionResult ); -} + assertionEnded( assertionResult ); + } -void RunContext::handleMessage( - AssertionInfo const& info, - ResultWas::OfType resultType, - StringRef const& message, - AssertionReaction& reaction -) { - m_reporter->assertionStarting( info ); + void RunContext::handleMessage( + AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction + ) { + m_reporter->assertionStarting( info ); + + m_lastAssertionInfo = info; - m_lastAssertionInfo = info; + AssertionResultData data( resultType, LazyExpression( false ) ); + data.message = static_cast(message); + AssertionResult assertionResult{ m_lastAssertionInfo, data }; + assertionEnded( assertionResult ); + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } + void RunContext::handleUnexpectedExceptionNotThrown( + AssertionInfo const& info, + AssertionReaction& reaction + ) { + handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction); + } - AssertionResultData data( resultType, LazyExpression( false ) ); - data.message = static_cast(message); - AssertionResult assertionResult{ m_lastAssertionInfo, data }; - assertionEnded( assertionResult ); - if( !assertionResult.isOk() ) + void RunContext::handleUnexpectedInflightException( + AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = message; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); populateReaction( reaction ); -} -void RunContext::handleUnexpectedExceptionNotThrown( - AssertionInfo const& info, - AssertionReaction& reaction -) { - handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction); -} + } -void RunContext::handleUnexpectedInflightException( - AssertionInfo const& info, - std::string const& message, - AssertionReaction& reaction -) { - m_lastAssertionInfo = info; - - AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); - data.message = message; - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); - populateReaction( reaction ); -} + void RunContext::populateReaction( AssertionReaction& reaction ) { + reaction.shouldDebugBreak = m_config->shouldDebugBreak(); + reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal); + } -void RunContext::populateReaction( AssertionReaction& reaction ) { - reaction.shouldDebugBreak = m_config->shouldDebugBreak(); - reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal); -} + void RunContext::handleIncomplete( + AssertionInfo const& info + ) { + m_lastAssertionInfo = info; -void RunContext::handleIncomplete( - AssertionInfo const& info -) { - m_lastAssertionInfo = info; + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + } + void RunContext::handleNonExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction + ) { + m_lastAssertionInfo = info; - AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); - data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); -} -void RunContext::handleNonExpr( - AssertionInfo const &info, - ResultWas::OfType resultType, - AssertionReaction &reaction -) { - m_lastAssertionInfo = info; - - AssertionResultData data( resultType, LazyExpression( false ) ); - AssertionResult assertionResult{ info, data }; - assertionEnded( assertionResult ); - - if( !assertionResult.isOk() ) - populateReaction( reaction ); -} + AssertionResultData data( resultType, LazyExpression( false ) ); + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); -IResultCapture& getResultCapture() { - if (auto* capture = getCurrentContext().getResultCapture()) - return *capture; - else - CATCH_INTERNAL_ERROR("No result capture instance"); -} + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } -void seedRng(IConfig const& config) { - if (config.rngSeed() != 0) { - std::srand(config.rngSeed()); - rng().seed(config.rngSeed()); + IResultCapture& getResultCapture() { + if (auto* capture = getCurrentContext().getResultCapture()) + return *capture; + else + CATCH_INTERNAL_ERROR("No result capture instance"); } -} -unsigned int rngSeed() { - return getCurrentContext().getConfig()->rngSeed(); -} + void seedRng(IConfig const& config) { + if (config.rngSeed() != 0) { + std::srand(config.rngSeed()); + rng().seed(config.rngSeed()); + } + } + + unsigned int rngSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } } // end catch_run_context.cpp @@ -13168,27 +13168,27 @@ unsigned int rngSeed() { namespace Catch { -Section::Section( SectionInfo const& info ) - : m_info( info ), - m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) -{ - m_timer.start(); -} + Section::Section( SectionInfo const& info ) + : m_info( info ), + m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) + { + m_timer.start(); + } -Section::~Section() { - if( m_sectionIncluded ) { - SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; - if( uncaught_exceptions() ) - getResultCapture().sectionEndedEarly( endInfo ); - else - getResultCapture().sectionEnded( endInfo ); + Section::~Section() { + if( m_sectionIncluded ) { + SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; + if( uncaught_exceptions() ) + getResultCapture().sectionEndedEarly( endInfo ); + else + getResultCapture().sectionEnded( endInfo ); + } } -} -// This indicates whether the section should be executed or not -Section::operator bool() const { - return m_sectionIncluded; -} + // This indicates whether the section should be executed or not + Section::operator bool() const { + return m_sectionIncluded; + } } // end namespace Catch // end catch_section.cpp @@ -13196,12 +13196,12 @@ Section::operator bool() const { namespace Catch { -SectionInfo::SectionInfo + SectionInfo::SectionInfo ( SourceLineInfo const& _lineInfo, std::string const& _name ) - : name( _name ), - lineInfo( _lineInfo ) -{} + : name( _name ), + lineInfo( _lineInfo ) + {} } // end namespace Catch // end catch_section_info.cpp @@ -13213,46 +13213,46 @@ SectionInfo::SectionInfo namespace Catch { -class Session : NonCopyable { -public: + class Session : NonCopyable { + public: - Session(); - ~Session() override; + Session(); + ~Session() override; - void showHelp() const; - void libIdentify(); + void showHelp() const; + void libIdentify(); - int applyCommandLine( int argc, char const * const * argv ); -#if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) - int applyCommandLine( int argc, wchar_t const * const * argv ); -#endif + int applyCommandLine( int argc, char const * const * argv ); + #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) + int applyCommandLine( int argc, wchar_t const * const * argv ); + #endif - void useConfigData( ConfigData const& configData ); + void useConfigData( ConfigData const& configData ); - template - int run(int argc, CharT const * const argv[]) { - if (m_startupExceptions) - return 1; - int returnCode = applyCommandLine(argc, argv); - if (returnCode == 0) - returnCode = run(); - return returnCode; - } + template + int run(int argc, CharT const * const argv[]) { + if (m_startupExceptions) + return 1; + int returnCode = applyCommandLine(argc, argv); + if (returnCode == 0) + returnCode = run(); + return returnCode; + } - int run(); + int run(); - clara::Parser const& cli() const; - void cli( clara::Parser const& newParser ); - ConfigData& configData(); - Config& config(); -private: - int runInternal(); + clara::Parser const& cli() const; + void cli( clara::Parser const& newParser ); + ConfigData& configData(); + Config& config(); + private: + int runInternal(); - clara::Parser m_cli; - ConfigData m_configData; - std::shared_ptr m_config; - bool m_startupExceptions = false; -}; + clara::Parser m_cli; + ConfigData m_configData; + std::shared_ptr m_config; + bool m_startupExceptions = false; + }; } // end namespace Catch @@ -13263,28 +13263,28 @@ class Session : NonCopyable { namespace Catch { -// Versioning information -struct Version { - Version( Version const& ) = delete; - Version& operator=( Version const& ) = delete; - Version( unsigned int _majorVersion, - unsigned int _minorVersion, - unsigned int _patchNumber, - char const * const _branchName, - unsigned int _buildNumber ); - - unsigned int const majorVersion; - unsigned int const minorVersion; - unsigned int const patchNumber; - - // buildNumber is only used if branchName is not null - char const * const branchName; - unsigned int const buildNumber; - - friend std::ostream& operator << ( std::ostream& os, Version const& version ); -}; + // Versioning information + struct Version { + Version( Version const& ) = delete; + Version& operator=( Version const& ) = delete; + Version( unsigned int _majorVersion, + unsigned int _minorVersion, + unsigned int _patchNumber, + char const * const _branchName, + unsigned int _buildNumber ); + + unsigned int const majorVersion; + unsigned int const minorVersion; + unsigned int const patchNumber; + + // buildNumber is only used if branchName is not null + char const * const branchName; + unsigned int const buildNumber; + + friend std::ostream& operator << ( std::ostream& os, Version const& version ); + }; -Version const& libraryVersion(); + Version const& libraryVersion(); } // end catch_version.h @@ -13295,196 +13295,196 @@ Version const& libraryVersion(); namespace Catch { -namespace { -const int MaxExitCode = 255; + namespace { + const int MaxExitCode = 255; -IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) { - auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); - CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); + IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); + CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); - return reporter; -} + return reporter; + } -IStreamingReporterPtr makeReporter(std::shared_ptr const& config) { - if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) { - return createReporter(config->getReporterName(), config); - } + IStreamingReporterPtr makeReporter(std::shared_ptr const& config) { + if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) { + return createReporter(config->getReporterName(), config); + } - // On older platforms, returning std::unique_ptr - // when the return type is std::unique_ptr - // doesn't compile without a std::move call. However, this causes - // a warning on newer platforms. Thus, we have to work around - // it a bit and downcast the pointer manually. - auto ret = std::unique_ptr(new ListeningReporter); - auto& multi = static_cast(*ret); - auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); - for (auto const& listener : listeners) { - multi.addListener(listener->create(Catch::ReporterConfig(config))); - } - multi.addReporter(createReporter(config->getReporterName(), config)); - return ret; -} + // On older platforms, returning std::unique_ptr + // when the return type is std::unique_ptr + // doesn't compile without a std::move call. However, this causes + // a warning on newer platforms. Thus, we have to work around + // it a bit and downcast the pointer manually. + auto ret = std::unique_ptr(new ListeningReporter); + auto& multi = static_cast(*ret); + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); + for (auto const& listener : listeners) { + multi.addListener(listener->create(Catch::ReporterConfig(config))); + } + multi.addReporter(createReporter(config->getReporterName(), config)); + return ret; + } -class TestGroup { -public: - explicit TestGroup(std::shared_ptr const& config) + class TestGroup { + public: + explicit TestGroup(std::shared_ptr const& config) : m_config{config} , m_context{config, makeReporter(config)} - { - auto const& allTestCases = getAllTestCasesSorted(*m_config); - m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); - auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); - - if (m_matches.empty() && invalidArgs.empty()) { - for (auto const& test : allTestCases) - if (!test.isHidden()) - m_tests.emplace(&test); - } else { - for (auto const& match : m_matches) - m_tests.insert(match.tests.begin(), match.tests.end()); - } - } + { + auto const& allTestCases = getAllTestCasesSorted(*m_config); + m_matches = m_config->testSpec().matchesByFilter(allTestCases, *m_config); + auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + + if (m_matches.empty() && invalidArgs.empty()) { + for (auto const& test : allTestCases) + if (!test.isHidden()) + m_tests.emplace(&test); + } else { + for (auto const& match : m_matches) + m_tests.insert(match.tests.begin(), match.tests.end()); + } + } - Totals execute() { - auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); - Totals totals; - m_context.testGroupStarting(m_config->name(), 1, 1); - for (auto const& testCase : m_tests) { - if (!m_context.aborting()) - totals += m_context.runTest(*testCase); - else - m_context.reporter().skipTest(*testCase); - } + Totals execute() { + auto const& invalidArgs = m_config->testSpec().getInvalidArgs(); + Totals totals; + m_context.testGroupStarting(m_config->name(), 1, 1); + for (auto const& testCase : m_tests) { + if (!m_context.aborting()) + totals += m_context.runTest(*testCase); + else + m_context.reporter().skipTest(*testCase); + } - for (auto const& match : m_matches) { - if (match.tests.empty()) { - m_context.reporter().noMatchingTestCases(match.name); - totals.error = -1; - } - } + for (auto const& match : m_matches) { + if (match.tests.empty()) { + m_context.reporter().noMatchingTestCases(match.name); + totals.error = -1; + } + } - if (!invalidArgs.empty()) { - for (auto const& invalidArg: invalidArgs) - m_context.reporter().reportInvalidArguments(invalidArg); - } + if (!invalidArgs.empty()) { + for (auto const& invalidArg: invalidArgs) + m_context.reporter().reportInvalidArguments(invalidArg); + } - m_context.testGroupEnded(m_config->name(), totals, 1, 1); - return totals; - } + m_context.testGroupEnded(m_config->name(), totals, 1, 1); + return totals; + } -private: - using Tests = std::set; + private: + using Tests = std::set; - std::shared_ptr m_config; - RunContext m_context; - Tests m_tests; - TestSpec::Matches m_matches; -}; + std::shared_ptr m_config; + RunContext m_context; + Tests m_tests; + TestSpec::Matches m_matches; + }; -void applyFilenamesAsTags(Catch::IConfig const& config) { - auto& tests = const_cast&>(getAllTestCasesSorted(config)); - for (auto& testCase : tests) { - auto tags = testCase.tags; + void applyFilenamesAsTags(Catch::IConfig const& config) { + auto& tests = const_cast&>(getAllTestCasesSorted(config)); + for (auto& testCase : tests) { + auto tags = testCase.tags; - std::string filename = testCase.lineInfo.file; - auto lastSlash = filename.find_last_of("\\/"); - if (lastSlash != std::string::npos) { - filename.erase(0, lastSlash); - filename[0] = '#'; - } - else - { - filename.insert(0, "#"); - } + std::string filename = testCase.lineInfo.file; + auto lastSlash = filename.find_last_of("\\/"); + if (lastSlash != std::string::npos) { + filename.erase(0, lastSlash); + filename[0] = '#'; + } + else + { + filename.insert(0, "#"); + } - auto lastDot = filename.find_last_of('.'); - if (lastDot != std::string::npos) { - filename.erase(lastDot); - } + auto lastDot = filename.find_last_of('.'); + if (lastDot != std::string::npos) { + filename.erase(lastDot); + } - tags.push_back(std::move(filename)); - setTags(testCase, tags); - } -} + tags.push_back(std::move(filename)); + setTags(testCase, tags); + } + } -} // anon namespace + } // anon namespace -Session::Session() { - static bool alreadyInstantiated = false; - if( alreadyInstantiated ) { - CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } - CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); } - } + Session::Session() { + static bool alreadyInstantiated = false; + if( alreadyInstantiated ) { + CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } + CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); } + } - // There cannot be exceptions at startup in no-exception mode. + // There cannot be exceptions at startup in no-exception mode. #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); - if ( !exceptions.empty() ) { - config(); - getCurrentMutableContext().setConfig(m_config); - - m_startupExceptions = true; - Colour colourGuard( Colour::Red ); - Catch::cerr() << "Errors occurred during startup!" << '\n'; - // iterate over all exceptions and notify user - for ( const auto& ex_ptr : exceptions ) { - try { - std::rethrow_exception(ex_ptr); - } catch ( std::exception const& ex ) { - Catch::cerr() << Column( ex.what() ).indent(2) << '\n'; + const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); + if ( !exceptions.empty() ) { + config(); + getCurrentMutableContext().setConfig(m_config); + + m_startupExceptions = true; + Colour colourGuard( Colour::Red ); + Catch::cerr() << "Errors occurred during startup!" << '\n'; + // iterate over all exceptions and notify user + for ( const auto& ex_ptr : exceptions ) { + try { + std::rethrow_exception(ex_ptr); + } catch ( std::exception const& ex ) { + Catch::cerr() << Column( ex.what() ).indent(2) << '\n'; + } } } - } #endif - alreadyInstantiated = true; - m_cli = makeCommandLineParser( m_configData ); -} -Session::~Session() { - Catch::cleanUp(); -} + alreadyInstantiated = true; + m_cli = makeCommandLineParser( m_configData ); + } + Session::~Session() { + Catch::cleanUp(); + } -void Session::showHelp() const { - Catch::cout() - << "\nCatch v" << libraryVersion() << "\n" - << m_cli << std::endl - << "For more detailed usage please see the project docs\n" << std::endl; -} -void Session::libIdentify() { - Catch::cout() - << std::left << std::setw(16) << "description: " << "A Catch2 test executable\n" - << std::left << std::setw(16) << "category: " << "testframework\n" - << std::left << std::setw(16) << "framework: " << "Catch Test\n" - << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; -} + void Session::showHelp() const { + Catch::cout() + << "\nCatch v" << libraryVersion() << "\n" + << m_cli << std::endl + << "For more detailed usage please see the project docs\n" << std::endl; + } + void Session::libIdentify() { + Catch::cout() + << std::left << std::setw(16) << "description: " << "A Catch2 test executable\n" + << std::left << std::setw(16) << "category: " << "testframework\n" + << std::left << std::setw(16) << "framework: " << "Catch Test\n" + << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; + } -int Session::applyCommandLine( int argc, char const * const * argv ) { - if( m_startupExceptions ) - return 1; + int Session::applyCommandLine( int argc, char const * const * argv ) { + if( m_startupExceptions ) + return 1; - auto result = m_cli.parse( clara::Args( argc, argv ) ); - if( !result ) { - config(); - getCurrentMutableContext().setConfig(m_config); - Catch::cerr() + auto result = m_cli.parse( clara::Args( argc, argv ) ); + if( !result ) { + config(); + getCurrentMutableContext().setConfig(m_config); + Catch::cerr() << Colour( Colour::Red ) << "\nError(s) in input:\n" << Column( result.errorMessage() ).indent( 2 ) << "\n\n"; - Catch::cerr() << "Run with -? for usage\n" << std::endl; - return MaxExitCode; - } + Catch::cerr() << "Run with -? for usage\n" << std::endl; + return MaxExitCode; + } - if( m_configData.showHelp ) - showHelp(); - if( m_configData.libIdentify ) - libIdentify(); - m_config.reset(); - return 0; -} + if( m_configData.showHelp ) + showHelp(); + if( m_configData.libIdentify ) + libIdentify(); + m_config.reset(); + return 0; + } #if defined(CATCH_CONFIG_WCHAR) && defined(_WIN32) && defined(UNICODE) -int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { + int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { char **utf8Argv = new char *[ argc ]; @@ -13507,77 +13507,77 @@ int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { } #endif -void Session::useConfigData( ConfigData const& configData ) { - m_configData = configData; - m_config.reset(); -} - -int Session::run() { - if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { - Catch::cout() << "...waiting for enter/ return before starting" << std::endl; - static_cast(std::getchar()); + void Session::useConfigData( ConfigData const& configData ) { + m_configData = configData; + m_config.reset(); } - int exitCode = runInternal(); - if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) { - Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl; - static_cast(std::getchar()); + + int Session::run() { + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before starting" << std::endl; + static_cast(std::getchar()); + } + int exitCode = runInternal(); + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl; + static_cast(std::getchar()); + } + return exitCode; } - return exitCode; -} -clara::Parser const& Session::cli() const { - return m_cli; -} -void Session::cli( clara::Parser const& newParser ) { - m_cli = newParser; -} -ConfigData& Session::configData() { - return m_configData; -} -Config& Session::config() { - if( !m_config ) - m_config = std::make_shared( m_configData ); - return *m_config; -} + clara::Parser const& Session::cli() const { + return m_cli; + } + void Session::cli( clara::Parser const& newParser ) { + m_cli = newParser; + } + ConfigData& Session::configData() { + return m_configData; + } + Config& Session::config() { + if( !m_config ) + m_config = std::make_shared( m_configData ); + return *m_config; + } -int Session::runInternal() { - if( m_startupExceptions ) - return 1; + int Session::runInternal() { + if( m_startupExceptions ) + return 1; - if (m_configData.showHelp || m_configData.libIdentify) { - return 0; - } + if (m_configData.showHelp || m_configData.libIdentify) { + return 0; + } - CATCH_TRY { - config(); // Force config to be constructed + CATCH_TRY { + config(); // Force config to be constructed - seedRng( *m_config ); + seedRng( *m_config ); - if( m_configData.filenamesAsTags ) - applyFilenamesAsTags( *m_config ); + if( m_configData.filenamesAsTags ) + applyFilenamesAsTags( *m_config ); - // Handle list request - if( Option listed = list( m_config ) ) - return static_cast( *listed ); + // Handle list request + if( Option listed = list( m_config ) ) + return static_cast( *listed ); - TestGroup tests { m_config }; - auto const totals = tests.execute(); + TestGroup tests { m_config }; + auto const totals = tests.execute(); - if( m_config->warnAboutNoTests() && totals.error == -1 ) - return 2; + if( m_config->warnAboutNoTests() && totals.error == -1 ) + return 2; - // Note that on unices only the lower 8 bits are usually used, clamping - // the return value to 255 prevents false negative when some multiple - // of 256 tests has failed - return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast(totals.assertions.failed))); - } + // Note that on unices only the lower 8 bits are usually used, clamping + // the return value to 255 prevents false negative when some multiple + // of 256 tests has failed + return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast(totals.assertions.failed))); + } #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - catch( std::exception& ex ) { - Catch::cerr() << ex.what() << std::endl; - return MaxExitCode; - } + catch( std::exception& ex ) { + Catch::cerr() << ex.what() << std::endl; + return MaxExitCode; + } #endif -} + } } // end namespace Catch // end catch_session.cpp @@ -13587,27 +13587,27 @@ int Session::runInternal() { namespace Catch { -namespace { -static auto getSingletons() -> std::vector*& { - static std::vector* g_singletons = nullptr; - if( !g_singletons ) - g_singletons = new std::vector(); - return g_singletons; -} -} + namespace { + static auto getSingletons() -> std::vector*& { + static std::vector* g_singletons = nullptr; + if( !g_singletons ) + g_singletons = new std::vector(); + return g_singletons; + } + } -ISingleton::~ISingleton() {} + ISingleton::~ISingleton() {} -void addSingleton(ISingleton* singleton ) { - getSingletons()->push_back( singleton ); -} -void cleanupSingletons() { - auto& singletons = getSingletons(); - for( auto singleton : *singletons ) - delete singleton; - delete singletons; - singletons = nullptr; -} + void addSingleton(ISingleton* singleton ) { + getSingletons()->push_back( singleton ); + } + void cleanupSingletons() { + auto& singletons = getSingletons(); + for( auto singleton : *singletons ) + delete singleton; + delete singletons; + singletons = nullptr; + } } // namespace Catch // end catch_singletons.cpp @@ -13616,17 +13616,17 @@ void cleanupSingletons() { #if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) namespace Catch { void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { - CATCH_TRY { - m_exceptions.push_back(exception); - } CATCH_CATCH_ALL { - // If we run out of memory during start-up there's really not a lot more we can do about it - std::terminate(); + CATCH_TRY { + m_exceptions.push_back(exception); + } CATCH_CATCH_ALL { + // If we run out of memory during start-up there's really not a lot more we can do about it + std::terminate(); + } } -} -std::vector const& StartupExceptionRegistry::getExceptions() const noexcept { - return m_exceptions; -} + std::vector const& StartupExceptionRegistry::getExceptions() const noexcept { + return m_exceptions; + } } // end namespace Catch #endif @@ -13642,163 +13642,163 @@ std::vector const& StartupExceptionRegistry::getExceptions() namespace Catch { -Catch::IStream::~IStream() = default; + Catch::IStream::~IStream() = default; -namespace Detail { namespace { -template -class StreamBufImpl : public std::streambuf { - char data[bufferSize]; - WriterF m_writer; + namespace Detail { namespace { + template + class StreamBufImpl : public std::streambuf { + char data[bufferSize]; + WriterF m_writer; -public: - StreamBufImpl() { - setp( data, data + sizeof(data) ); - } + public: + StreamBufImpl() { + setp( data, data + sizeof(data) ); + } - ~StreamBufImpl() noexcept { - StreamBufImpl::sync(); - } + ~StreamBufImpl() noexcept { + StreamBufImpl::sync(); + } -private: - int overflow( int c ) override { - sync(); + private: + int overflow( int c ) override { + sync(); - if( c != EOF ) { - if( pbase() == epptr() ) - m_writer( std::string( 1, static_cast( c ) ) ); - else - sputc( static_cast( c ) ); - } - return 0; - } + if( c != EOF ) { + if( pbase() == epptr() ) + m_writer( std::string( 1, static_cast( c ) ) ); + else + sputc( static_cast( c ) ); + } + return 0; + } - int sync() override { - if( pbase() != pptr() ) { - m_writer( std::string( pbase(), static_cast( pptr() - pbase() ) ) ); - setp( pbase(), epptr() ); - } - return 0; - } -}; + int sync() override { + if( pbase() != pptr() ) { + m_writer( std::string( pbase(), static_cast( pptr() - pbase() ) ) ); + setp( pbase(), epptr() ); + } + return 0; + } + }; -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// -struct OutputDebugWriter { + struct OutputDebugWriter { - void operator()( std::string const&str ) { - writeToDebugConsole( str ); - } -}; + void operator()( std::string const&str ) { + writeToDebugConsole( str ); + } + }; -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// -class FileStream : public IStream { - mutable std::ofstream m_ofs; -public: - FileStream( StringRef filename ) { - m_ofs.open( filename.c_str() ); - CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); - } - ~FileStream() override = default; -public: // IStream - std::ostream& stream() const override { - return m_ofs; - } -}; + class FileStream : public IStream { + mutable std::ofstream m_ofs; + public: + FileStream( StringRef filename ) { + m_ofs.open( filename.c_str() ); + CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); + } + ~FileStream() override = default; + public: // IStream + std::ostream& stream() const override { + return m_ofs; + } + }; -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// -class CoutStream : public IStream { - mutable std::ostream m_os; -public: - // Store the streambuf from cout up-front because - // cout may get redirected when running tests - CoutStream() : m_os( Catch::cout().rdbuf() ) {} - ~CoutStream() override = default; + class CoutStream : public IStream { + mutable std::ostream m_os; + public: + // Store the streambuf from cout up-front because + // cout may get redirected when running tests + CoutStream() : m_os( Catch::cout().rdbuf() ) {} + ~CoutStream() override = default; -public: // IStream - std::ostream& stream() const override { return m_os; } -}; + public: // IStream + std::ostream& stream() const override { return m_os; } + }; -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// -class DebugOutStream : public IStream { - std::unique_ptr> m_streamBuf; - mutable std::ostream m_os; -public: - DebugOutStream() + class DebugOutStream : public IStream { + std::unique_ptr> m_streamBuf; + mutable std::ostream m_os; + public: + DebugOutStream() : m_streamBuf( new StreamBufImpl() ), m_os( m_streamBuf.get() ) - {} + {} - ~DebugOutStream() override = default; + ~DebugOutStream() override = default; -public: // IStream - std::ostream& stream() const override { return m_os; } -}; + public: // IStream + std::ostream& stream() const override { return m_os; } + }; -}} // namespace anon::detail + }} // namespace anon::detail -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// -auto makeStream( StringRef const &filename ) -> IStream const* { - if( filename.empty() ) - return new Detail::CoutStream(); - else if( filename[0] == '%' ) { - if( filename == "%debug" ) - return new Detail::DebugOutStream(); + auto makeStream( StringRef const &filename ) -> IStream const* { + if( filename.empty() ) + return new Detail::CoutStream(); + else if( filename[0] == '%' ) { + if( filename == "%debug" ) + return new Detail::DebugOutStream(); + else + CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); + } else - CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); + return new Detail::FileStream( filename ); } - else - return new Detail::FileStream( filename ); -} -// This class encapsulates the idea of a pool of ostringstreams that can be reused. -struct StringStreams { - std::vector> m_streams; - std::vector m_unused; - std::ostringstream m_referenceStream; // Used for copy state/ flags from + // This class encapsulates the idea of a pool of ostringstreams that can be reused. + struct StringStreams { + std::vector> m_streams; + std::vector m_unused; + std::ostringstream m_referenceStream; // Used for copy state/ flags from - auto add() -> std::size_t { - if( m_unused.empty() ) { - m_streams.push_back( std::unique_ptr( new std::ostringstream ) ); - return m_streams.size()-1; - } - else { - auto index = m_unused.back(); - m_unused.pop_back(); - return index; + auto add() -> std::size_t { + if( m_unused.empty() ) { + m_streams.push_back( std::unique_ptr( new std::ostringstream ) ); + return m_streams.size()-1; + } + else { + auto index = m_unused.back(); + m_unused.pop_back(); + return index; + } } - } - void release( std::size_t index ) { - m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state - m_unused.push_back(index); - } -}; + void release( std::size_t index ) { + m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state + m_unused.push_back(index); + } + }; -ReusableStringStream::ReusableStringStream() - : m_index( Singleton::getMutable().add() ), - m_oss( Singleton::getMutable().m_streams[m_index].get() ) -{} + ReusableStringStream::ReusableStringStream() + : m_index( Singleton::getMutable().add() ), + m_oss( Singleton::getMutable().m_streams[m_index].get() ) + {} -ReusableStringStream::~ReusableStringStream() { - static_cast( m_oss )->str(""); - m_oss->clear(); - Singleton::getMutable().release( m_index ); -} + ReusableStringStream::~ReusableStringStream() { + static_cast( m_oss )->str(""); + m_oss->clear(); + Singleton::getMutable().release( m_index ); + } -auto ReusableStringStream::str() const -> std::string { - return static_cast( m_oss )->str(); -} + auto ReusableStringStream::str() const -> std::string { + return static_cast( m_oss )->str(); + } -/////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////// #ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions -std::ostream& cout() { return std::cout; } -std::ostream& cerr() { return std::cerr; } -std::ostream& clog() { return std::clog; } + std::ostream& cout() { return std::cout; } + std::ostream& cerr() { return std::cerr; } + std::ostream& clog() { return std::clog; } #endif } // end catch_stream.cpp @@ -13812,95 +13812,95 @@ std::ostream& clog() { return std::clog; } namespace Catch { -namespace { -char toLowerCh(char c) { - return static_cast( std::tolower( static_cast(c) ) ); -} -} - -bool startsWith( std::string const& s, std::string const& prefix ) { - return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); -} -bool startsWith( std::string const& s, char prefix ) { - return !s.empty() && s[0] == prefix; -} -bool endsWith( std::string const& s, std::string const& suffix ) { - return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); -} -bool endsWith( std::string const& s, char suffix ) { - return !s.empty() && s[s.size()-1] == suffix; -} -bool contains( std::string const& s, std::string const& infix ) { - return s.find( infix ) != std::string::npos; -} -void toLowerInPlace( std::string& s ) { - std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); -} -std::string toLower( std::string const& s ) { - std::string lc = s; - toLowerInPlace( lc ); - return lc; -} -std::string trim( std::string const& str ) { - static char const* whitespaceChars = "\n\r\t "; - std::string::size_type start = str.find_first_not_of( whitespaceChars ); - std::string::size_type end = str.find_last_not_of( whitespaceChars ); - - return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); -} + namespace { + char toLowerCh(char c) { + return static_cast( std::tolower( static_cast(c) ) ); + } + } -StringRef trim(StringRef ref) { - const auto is_ws = [](char c) { - return c == ' ' || c == '\t' || c == '\n' || c == '\r'; - }; - size_t real_begin = 0; - while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; } - size_t real_end = ref.size(); - while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; } + bool startsWith( std::string const& s, std::string const& prefix ) { + return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); + } + bool startsWith( std::string const& s, char prefix ) { + return !s.empty() && s[0] == prefix; + } + bool endsWith( std::string const& s, std::string const& suffix ) { + return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); + } + bool endsWith( std::string const& s, char suffix ) { + return !s.empty() && s[s.size()-1] == suffix; + } + bool contains( std::string const& s, std::string const& infix ) { + return s.find( infix ) != std::string::npos; + } + void toLowerInPlace( std::string& s ) { + std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); + } + std::string toLower( std::string const& s ) { + std::string lc = s; + toLowerInPlace( lc ); + return lc; + } + std::string trim( std::string const& str ) { + static char const* whitespaceChars = "\n\r\t "; + std::string::size_type start = str.find_first_not_of( whitespaceChars ); + std::string::size_type end = str.find_last_not_of( whitespaceChars ); - return ref.substr(real_begin, real_end - real_begin); -} + return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); + } -bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { - bool replaced = false; - std::size_t i = str.find( replaceThis ); - while( i != std::string::npos ) { - replaced = true; - str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); - if( i < str.size()-withThis.size() ) - i = str.find( replaceThis, i+withThis.size() ); - else - i = std::string::npos; + StringRef trim(StringRef ref) { + const auto is_ws = [](char c) { + return c == ' ' || c == '\t' || c == '\n' || c == '\r'; + }; + size_t real_begin = 0; + while (real_begin < ref.size() && is_ws(ref[real_begin])) { ++real_begin; } + size_t real_end = ref.size(); + while (real_end > real_begin && is_ws(ref[real_end - 1])) { --real_end; } + + return ref.substr(real_begin, real_end - real_begin); + } + + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { + bool replaced = false; + std::size_t i = str.find( replaceThis ); + while( i != std::string::npos ) { + replaced = true; + str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); + if( i < str.size()-withThis.size() ) + i = str.find( replaceThis, i+withThis.size() ); + else + i = std::string::npos; + } + return replaced; } - return replaced; -} -std::vector splitStringRef( StringRef str, char delimiter ) { - std::vector subStrings; - std::size_t start = 0; - for(std::size_t pos = 0; pos < str.size(); ++pos ) { - if( str[pos] == delimiter ) { - if( pos - start > 1 ) - subStrings.push_back( str.substr( start, pos-start ) ); - start = pos+1; + std::vector splitStringRef( StringRef str, char delimiter ) { + std::vector subStrings; + std::size_t start = 0; + for(std::size_t pos = 0; pos < str.size(); ++pos ) { + if( str[pos] == delimiter ) { + if( pos - start > 1 ) + subStrings.push_back( str.substr( start, pos-start ) ); + start = pos+1; + } } + if( start < str.size() ) + subStrings.push_back( str.substr( start, str.size()-start ) ); + return subStrings; } - if( start < str.size() ) - subStrings.push_back( str.substr( start, str.size()-start ) ); - return subStrings; -} -pluralise::pluralise( std::size_t count, std::string const& label ) - : m_count( count ), - m_label( label ) -{} + pluralise::pluralise( std::size_t count, std::string const& label ) + : m_count( count ), + m_label( label ) + {} -std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { - os << pluraliser.m_count << ' ' << pluraliser.m_label; - if( pluraliser.m_count != 1 ) - os << 's'; - return os; -} + std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { + os << pluraliser.m_count << ' ' << pluraliser.m_label; + if( pluraliser.m_count != 1 ) + os << 's'; + return os; + } } // end catch_string_manip.cpp @@ -13912,59 +13912,59 @@ std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { #include namespace Catch { -StringRef::StringRef( char const* rawChars ) noexcept - : StringRef( rawChars, static_cast(std::strlen(rawChars) ) ) -{} + StringRef::StringRef( char const* rawChars ) noexcept + : StringRef( rawChars, static_cast(std::strlen(rawChars) ) ) + {} -auto StringRef::c_str() const -> char const* { - CATCH_ENFORCE(isNullTerminated(), "Called StringRef::c_str() on a non-null-terminated instance"); - return m_start; -} -auto StringRef::data() const noexcept -> char const* { - return m_start; -} + auto StringRef::c_str() const -> char const* { + CATCH_ENFORCE(isNullTerminated(), "Called StringRef::c_str() on a non-null-terminated instance"); + return m_start; + } + auto StringRef::data() const noexcept -> char const* { + return m_start; + } -auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { - if (start < m_size) { - return StringRef(m_start + start, (std::min)(m_size - start, size)); - } else { - return StringRef(); + auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { + if (start < m_size) { + return StringRef(m_start + start, (std::min)(m_size - start, size)); + } else { + return StringRef(); + } + } + auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { + return m_size == other.m_size + && (std::memcmp( m_start, other.m_start, m_size ) == 0); } -} -auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { - return m_size == other.m_size - && (std::memcmp( m_start, other.m_start, m_size ) == 0); -} -auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { - return os.write(str.data(), str.size()); -} + auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { + return os.write(str.data(), str.size()); + } -auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { - lhs.append(rhs.data(), rhs.size()); - return lhs; -} + auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + lhs.append(rhs.data(), rhs.size()); + return lhs; + } } // namespace Catch // end catch_stringref.cpp // start catch_tag_alias.cpp namespace Catch { -TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {} + TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {} } // end catch_tag_alias.cpp // start catch_tag_alias_autoregistrar.cpp namespace Catch { -RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { - CATCH_TRY { - getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); - } CATCH_CATCH_ALL { - // Do not throw when constructing global objects, instead register the exception to be processed later - getMutableRegistryHub().registerStartupException(); + RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { + CATCH_TRY { + getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } } -} } // end catch_tag_alias_autoregistrar.cpp @@ -13974,44 +13974,44 @@ RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* ta namespace Catch { -TagAliasRegistry::~TagAliasRegistry() {} + TagAliasRegistry::~TagAliasRegistry() {} -TagAlias const* TagAliasRegistry::find( std::string const& alias ) const { - auto it = m_registry.find( alias ); - if( it != m_registry.end() ) - return &(it->second); - else - return nullptr; -} + TagAlias const* TagAliasRegistry::find( std::string const& alias ) const { + auto it = m_registry.find( alias ); + if( it != m_registry.end() ) + return &(it->second); + else + return nullptr; + } -std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const { - std::string expandedTestSpec = unexpandedTestSpec; - for( auto const& registryKvp : m_registry ) { - std::size_t pos = expandedTestSpec.find( registryKvp.first ); - if( pos != std::string::npos ) { - expandedTestSpec = expandedTestSpec.substr( 0, pos ) + - registryKvp.second.tag + - expandedTestSpec.substr( pos + registryKvp.first.size() ); + std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const { + std::string expandedTestSpec = unexpandedTestSpec; + for( auto const& registryKvp : m_registry ) { + std::size_t pos = expandedTestSpec.find( registryKvp.first ); + if( pos != std::string::npos ) { + expandedTestSpec = expandedTestSpec.substr( 0, pos ) + + registryKvp.second.tag + + expandedTestSpec.substr( pos + registryKvp.first.size() ); + } } + return expandedTestSpec; } - return expandedTestSpec; -} -void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) { - CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'), - "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo ); + void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) { + CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'), + "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo ); - CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second, - "error: tag alias, '" << alias << "' already registered.\n" - << "\tFirst seen at: " << find(alias)->lineInfo << "\n" - << "\tRedefined at: " << lineInfo ); -} + CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second, + "error: tag alias, '" << alias << "' already registered.\n" + << "\tFirst seen at: " << find(alias)->lineInfo << "\n" + << "\tRedefined at: " << lineInfo ); + } -ITagAliasRegistry::~ITagAliasRegistry() {} + ITagAliasRegistry::~ITagAliasRegistry() {} -ITagAliasRegistry const& ITagAliasRegistry::get() { - return getRegistryHub().getTagAliasRegistry(); -} + ITagAliasRegistry const& ITagAliasRegistry::get() { + return getRegistryHub().getTagAliasRegistry(); + } } // end namespace Catch // end catch_tag_alias_registry.cpp @@ -14024,167 +14024,167 @@ ITagAliasRegistry const& ITagAliasRegistry::get() { namespace Catch { -namespace { -TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { - if( startsWith( tag, '.' ) || - tag == "!hide" ) - return TestCaseInfo::IsHidden; - else if( tag == "!throws" ) - return TestCaseInfo::Throws; - else if( tag == "!shouldfail" ) - return TestCaseInfo::ShouldFail; - else if( tag == "!mayfail" ) - return TestCaseInfo::MayFail; - else if( tag == "!nonportable" ) - return TestCaseInfo::NonPortable; - else if( tag == "!benchmark" ) - return static_cast( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden ); - else - return TestCaseInfo::None; -} -bool isReservedTag( std::string const& tag ) { - return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast(tag[0]) ); -} -void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { - CATCH_ENFORCE( !isReservedTag(tag), - "Tag name: [" << tag << "] is not allowed.\n" - << "Tag names starting with non alphanumeric characters are reserved\n" - << _lineInfo ); -} -} - -TestCase makeTestCase( ITestInvoker* _testCase, - std::string const& _className, - NameAndTags const& nameAndTags, - SourceLineInfo const& _lineInfo ) -{ - bool isHidden = false; - - // Parse out tags - std::vector tags; - std::string desc, tag; - bool inTag = false; - for (char c : nameAndTags.tags) { - if( !inTag ) { - if( c == '[' ) - inTag = true; + namespace { + TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { + if( startsWith( tag, '.' ) || + tag == "!hide" ) + return TestCaseInfo::IsHidden; + else if( tag == "!throws" ) + return TestCaseInfo::Throws; + else if( tag == "!shouldfail" ) + return TestCaseInfo::ShouldFail; + else if( tag == "!mayfail" ) + return TestCaseInfo::MayFail; + else if( tag == "!nonportable" ) + return TestCaseInfo::NonPortable; + else if( tag == "!benchmark" ) + return static_cast( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden ); else - desc += c; + return TestCaseInfo::None; } - else { - if( c == ']' ) { - TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); - if( ( prop & TestCaseInfo::IsHidden ) != 0 ) - isHidden = true; - else if( prop == TestCaseInfo::None ) - enforceNotReservedTag( tag, _lineInfo ); - - // Merged hide tags like `[.approvals]` should be added as - // `[.][approvals]`. The `[.]` is added at later point, so - // we only strip the prefix - if (startsWith(tag, '.') && tag.size() > 1) { - tag.erase(0, 1); - } - tags.push_back( tag ); - tag.clear(); - inTag = false; - } - else - tag += c; + bool isReservedTag( std::string const& tag ) { + return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast(tag[0]) ); + } + void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { + CATCH_ENFORCE( !isReservedTag(tag), + "Tag name: [" << tag << "] is not allowed.\n" + << "Tag names starting with non alphanumeric characters are reserved\n" + << _lineInfo ); } } - if( isHidden ) { - // Add all "hidden" tags to make them behave identically - tags.insert( tags.end(), { ".", "!hide" } ); - } - - TestCaseInfo info( static_cast(nameAndTags.name), _className, desc, tags, _lineInfo ); - return TestCase( _testCase, std::move(info) ); -} -void setTags( TestCaseInfo& testCaseInfo, std::vector tags ) { - std::sort(begin(tags), end(tags)); - tags.erase(std::unique(begin(tags), end(tags)), end(tags)); - testCaseInfo.lcaseTags.clear(); + TestCase makeTestCase( ITestInvoker* _testCase, + std::string const& _className, + NameAndTags const& nameAndTags, + SourceLineInfo const& _lineInfo ) + { + bool isHidden = false; + + // Parse out tags + std::vector tags; + std::string desc, tag; + bool inTag = false; + for (char c : nameAndTags.tags) { + if( !inTag ) { + if( c == '[' ) + inTag = true; + else + desc += c; + } + else { + if( c == ']' ) { + TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); + if( ( prop & TestCaseInfo::IsHidden ) != 0 ) + isHidden = true; + else if( prop == TestCaseInfo::None ) + enforceNotReservedTag( tag, _lineInfo ); + + // Merged hide tags like `[.approvals]` should be added as + // `[.][approvals]`. The `[.]` is added at later point, so + // we only strip the prefix + if (startsWith(tag, '.') && tag.size() > 1) { + tag.erase(0, 1); + } + tags.push_back( tag ); + tag.clear(); + inTag = false; + } + else + tag += c; + } + } + if( isHidden ) { + // Add all "hidden" tags to make them behave identically + tags.insert( tags.end(), { ".", "!hide" } ); + } - for( auto const& tag : tags ) { - std::string lcaseTag = toLower( tag ); - testCaseInfo.properties = static_cast( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); - testCaseInfo.lcaseTags.push_back( lcaseTag ); + TestCaseInfo info( static_cast(nameAndTags.name), _className, desc, tags, _lineInfo ); + return TestCase( _testCase, std::move(info) ); } - testCaseInfo.tags = std::move(tags); -} -TestCaseInfo::TestCaseInfo( std::string const& _name, - std::string const& _className, - std::string const& _description, - std::vector const& _tags, - SourceLineInfo const& _lineInfo ) - : name( _name ), - className( _className ), - description( _description ), - lineInfo( _lineInfo ), - properties( None ) -{ - setTags( *this, _tags ); -} + void setTags( TestCaseInfo& testCaseInfo, std::vector tags ) { + std::sort(begin(tags), end(tags)); + tags.erase(std::unique(begin(tags), end(tags)), end(tags)); + testCaseInfo.lcaseTags.clear(); -bool TestCaseInfo::isHidden() const { - return ( properties & IsHidden ) != 0; -} -bool TestCaseInfo::throws() const { - return ( properties & Throws ) != 0; -} -bool TestCaseInfo::okToFail() const { - return ( properties & (ShouldFail | MayFail ) ) != 0; -} -bool TestCaseInfo::expectedToFail() const { - return ( properties & (ShouldFail ) ) != 0; -} + for( auto const& tag : tags ) { + std::string lcaseTag = toLower( tag ); + testCaseInfo.properties = static_cast( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); + testCaseInfo.lcaseTags.push_back( lcaseTag ); + } + testCaseInfo.tags = std::move(tags); + } + + TestCaseInfo::TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector const& _tags, + SourceLineInfo const& _lineInfo ) + : name( _name ), + className( _className ), + description( _description ), + lineInfo( _lineInfo ), + properties( None ) + { + setTags( *this, _tags ); + } -std::string TestCaseInfo::tagsAsString() const { - std::string ret; - // '[' and ']' per tag - std::size_t full_size = 2 * tags.size(); - for (const auto& tag : tags) { - full_size += tag.size(); + bool TestCaseInfo::isHidden() const { + return ( properties & IsHidden ) != 0; + } + bool TestCaseInfo::throws() const { + return ( properties & Throws ) != 0; } - ret.reserve(full_size); - for (const auto& tag : tags) { - ret.push_back('['); - ret.append(tag); - ret.push_back(']'); + bool TestCaseInfo::okToFail() const { + return ( properties & (ShouldFail | MayFail ) ) != 0; + } + bool TestCaseInfo::expectedToFail() const { + return ( properties & (ShouldFail ) ) != 0; } - return ret; -} + std::string TestCaseInfo::tagsAsString() const { + std::string ret; + // '[' and ']' per tag + std::size_t full_size = 2 * tags.size(); + for (const auto& tag : tags) { + full_size += tag.size(); + } + ret.reserve(full_size); + for (const auto& tag : tags) { + ret.push_back('['); + ret.append(tag); + ret.push_back(']'); + } -TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {} + return ret; + } -TestCase TestCase::withName( std::string const& _newName ) const { - TestCase other( *this ); - other.name = _newName; - return other; -} + TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {} -void TestCase::invoke() const { - test->invoke(); -} + TestCase TestCase::withName( std::string const& _newName ) const { + TestCase other( *this ); + other.name = _newName; + return other; + } -bool TestCase::operator == ( TestCase const& other ) const { - return test.get() == other.test.get() && - name == other.name && - className == other.className; -} + void TestCase::invoke() const { + test->invoke(); + } -bool TestCase::operator < ( TestCase const& other ) const { - return name < other.name; -} + bool TestCase::operator == ( TestCase const& other ) const { + return test.get() == other.test.get() && + name == other.name && + className == other.className; + } -TestCaseInfo const& TestCase::getTestCaseInfo() const -{ - return *this; -} + bool TestCase::operator < ( TestCase const& other ) const { + return name < other.name; + } + + TestCaseInfo const& TestCase::getTestCaseInfo() const + { + return *this; + } } // end namespace Catch // end catch_test_case_info.cpp @@ -14195,155 +14195,155 @@ TestCaseInfo const& TestCase::getTestCaseInfo() const namespace Catch { -namespace { -struct TestHasher { - using hash_t = uint64_t; + namespace { + struct TestHasher { + using hash_t = uint64_t; - explicit TestHasher( hash_t hashSuffix ): - m_hashSuffix{ hashSuffix } {} + explicit TestHasher( hash_t hashSuffix ): + m_hashSuffix{ hashSuffix } {} - uint32_t operator()( TestCase const& t ) const { - // FNV-1a hash with multiplication fold. - const hash_t prime = 1099511628211u; - hash_t hash = 14695981039346656037u; - for ( const char c : t.name ) { - hash ^= c; - hash *= prime; - } - hash ^= m_hashSuffix; - hash *= prime; - const uint32_t low{ static_cast( hash ) }; - const uint32_t high{ static_cast( hash >> 32 ) }; - return low * high; - } + uint32_t operator()( TestCase const& t ) const { + // FNV-1a hash with multiplication fold. + const hash_t prime = 1099511628211u; + hash_t hash = 14695981039346656037u; + for ( const char c : t.name ) { + hash ^= c; + hash *= prime; + } + hash ^= m_hashSuffix; + hash *= prime; + const uint32_t low{ static_cast( hash ) }; + const uint32_t high{ static_cast( hash >> 32 ) }; + return low * high; + } -private: - hash_t m_hashSuffix; -}; -} // end unnamed namespace + private: + hash_t m_hashSuffix; + }; + } // end unnamed namespace -std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ) { - switch( config.runOrder() ) { - case RunTests::InDeclarationOrder: - // already in declaration order - break; + std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ) { + switch( config.runOrder() ) { + case RunTests::InDeclarationOrder: + // already in declaration order + break; - case RunTests::InLexicographicalOrder: { - std::vector sorted = unsortedTestCases; - std::sort( sorted.begin(), sorted.end() ); - return sorted; - } + case RunTests::InLexicographicalOrder: { + std::vector sorted = unsortedTestCases; + std::sort( sorted.begin(), sorted.end() ); + return sorted; + } - case RunTests::InRandomOrder: { - seedRng( config ); - TestHasher h{ config.rngSeed() }; + case RunTests::InRandomOrder: { + seedRng( config ); + TestHasher h{ config.rngSeed() }; - using hashedTest = std::pair; - std::vector indexed_tests; - indexed_tests.reserve( unsortedTestCases.size() ); + using hashedTest = std::pair; + std::vector indexed_tests; + indexed_tests.reserve( unsortedTestCases.size() ); - for (auto const& testCase : unsortedTestCases) { - indexed_tests.emplace_back(h(testCase), &testCase); - } + for (auto const& testCase : unsortedTestCases) { + indexed_tests.emplace_back(h(testCase), &testCase); + } - std::sort(indexed_tests.begin(), indexed_tests.end(), - [](hashedTest const& lhs, hashedTest const& rhs) { + std::sort(indexed_tests.begin(), indexed_tests.end(), + [](hashedTest const& lhs, hashedTest const& rhs) { if (lhs.first == rhs.first) { return lhs.second->name < rhs.second->name; } return lhs.first < rhs.first; - }); + }); - std::vector sorted; - sorted.reserve( indexed_tests.size() ); + std::vector sorted; + sorted.reserve( indexed_tests.size() ); - for (auto const& hashed : indexed_tests) { - sorted.emplace_back(*hashed.second); - } + for (auto const& hashed : indexed_tests) { + sorted.emplace_back(*hashed.second); + } - return sorted; + return sorted; + } } + return unsortedTestCases; } - return unsortedTestCases; -} -bool isThrowSafe( TestCase const& testCase, IConfig const& config ) { - return !testCase.throws() || config.allowThrows(); -} + bool isThrowSafe( TestCase const& testCase, IConfig const& config ) { + return !testCase.throws() || config.allowThrows(); + } -bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { - return testSpec.matches( testCase ) && isThrowSafe( testCase, config ); -} + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { + return testSpec.matches( testCase ) && isThrowSafe( testCase, config ); + } -void enforceNoDuplicateTestCases( std::vector const& functions ) { - std::set seenFunctions; - for( auto const& function : functions ) { - auto prev = seenFunctions.insert( function ); - CATCH_ENFORCE( prev.second, - "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n" - << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" - << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); + void enforceNoDuplicateTestCases( std::vector const& functions ) { + std::set seenFunctions; + for( auto const& function : functions ) { + auto prev = seenFunctions.insert( function ); + CATCH_ENFORCE( prev.second, + "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); + } } -} -std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ) { - std::vector filtered; - filtered.reserve( testCases.size() ); - for (auto const& testCase : testCases) { - if ((!testSpec.hasFilters() && !testCase.isHidden()) || - (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) { - filtered.push_back(testCase); + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ) { + std::vector filtered; + filtered.reserve( testCases.size() ); + for (auto const& testCase : testCases) { + if ((!testSpec.hasFilters() && !testCase.isHidden()) || + (testSpec.hasFilters() && matchTest(testCase, testSpec, config))) { + filtered.push_back(testCase); + } } + return filtered; + } + std::vector const& getAllTestCasesSorted( IConfig const& config ) { + return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); } - return filtered; -} -std::vector const& getAllTestCasesSorted( IConfig const& config ) { - return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); -} -void TestRegistry::registerTest( TestCase const& testCase ) { - std::string name = testCase.getTestCaseInfo().name; - if( name.empty() ) { - ReusableStringStream rss; - rss << "Anonymous test case " << ++m_unnamedCount; - return registerTest( testCase.withName( rss.str() ) ); + void TestRegistry::registerTest( TestCase const& testCase ) { + std::string name = testCase.getTestCaseInfo().name; + if( name.empty() ) { + ReusableStringStream rss; + rss << "Anonymous test case " << ++m_unnamedCount; + return registerTest( testCase.withName( rss.str() ) ); + } + m_functions.push_back( testCase ); } - m_functions.push_back( testCase ); -} -std::vector const& TestRegistry::getAllTests() const { - return m_functions; -} -std::vector const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { - if( m_sortedFunctions.empty() ) - enforceNoDuplicateTestCases( m_functions ); + std::vector const& TestRegistry::getAllTests() const { + return m_functions; + } + std::vector const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { + if( m_sortedFunctions.empty() ) + enforceNoDuplicateTestCases( m_functions ); - if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { - m_sortedFunctions = sortTests( config, m_functions ); - m_currentSortOrder = config.runOrder(); + if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { + m_sortedFunctions = sortTests( config, m_functions ); + m_currentSortOrder = config.runOrder(); + } + return m_sortedFunctions; } - return m_sortedFunctions; -} -/////////////////////////////////////////////////////////////////////////// -TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {} + /////////////////////////////////////////////////////////////////////////// + TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {} -void TestInvokerAsFunction::invoke() const { - m_testAsFunction(); -} + void TestInvokerAsFunction::invoke() const { + m_testAsFunction(); + } -std::string extractClassName( StringRef const& classOrQualifiedMethodName ) { - std::string className(classOrQualifiedMethodName); - if( startsWith( className, '&' ) ) - { - std::size_t lastColons = className.rfind( "::" ); - std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); - if( penultimateColons == std::string::npos ) - penultimateColons = 1; - className = className.substr( penultimateColons, lastColons-penultimateColons ); + std::string extractClassName( StringRef const& classOrQualifiedMethodName ) { + std::string className(classOrQualifiedMethodName); + if( startsWith( className, '&' ) ) + { + std::size_t lastColons = className.rfind( "::" ); + std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); + if( penultimateColons == std::string::npos ) + penultimateColons = 1; + className = className.substr( penultimateColons, lastColons-penultimateColons ); + } + return className; } - return className; -} } // end namespace Catch // end catch_test_case_registry_impl.cpp @@ -14363,218 +14363,218 @@ std::string extractClassName( StringRef const& classOrQualifiedMethodName ) { namespace Catch { namespace TestCaseTracking { -NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) - : name( _name ), - location( _location ) -{} + NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) + : name( _name ), + location( _location ) + {} -ITracker::~ITracker() = default; + ITracker::~ITracker() = default; -ITracker& TrackerContext::startRun() { - m_rootTracker = std::make_shared( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr ); - m_currentTracker = nullptr; - m_runState = Executing; - return *m_rootTracker; -} + ITracker& TrackerContext::startRun() { + m_rootTracker = std::make_shared( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr ); + m_currentTracker = nullptr; + m_runState = Executing; + return *m_rootTracker; + } -void TrackerContext::endRun() { - m_rootTracker.reset(); - m_currentTracker = nullptr; - m_runState = NotStarted; -} + void TrackerContext::endRun() { + m_rootTracker.reset(); + m_currentTracker = nullptr; + m_runState = NotStarted; + } -void TrackerContext::startCycle() { - m_currentTracker = m_rootTracker.get(); - m_runState = Executing; -} -void TrackerContext::completeCycle() { - m_runState = CompletedCycle; -} + void TrackerContext::startCycle() { + m_currentTracker = m_rootTracker.get(); + m_runState = Executing; + } + void TrackerContext::completeCycle() { + m_runState = CompletedCycle; + } -bool TrackerContext::completedCycle() const { - return m_runState == CompletedCycle; -} -ITracker& TrackerContext::currentTracker() { - return *m_currentTracker; -} -void TrackerContext::setCurrentTracker( ITracker* tracker ) { - m_currentTracker = tracker; -} + bool TrackerContext::completedCycle() const { + return m_runState == CompletedCycle; + } + ITracker& TrackerContext::currentTracker() { + return *m_currentTracker; + } + void TrackerContext::setCurrentTracker( ITracker* tracker ) { + m_currentTracker = tracker; + } -TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ): + TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ): ITracker(nameAndLocation), m_ctx( ctx ), m_parent( parent ) -{} + {} -bool TrackerBase::isComplete() const { - return m_runState == CompletedSuccessfully || m_runState == Failed; -} -bool TrackerBase::isSuccessfullyCompleted() const { - return m_runState == CompletedSuccessfully; -} -bool TrackerBase::isOpen() const { - return m_runState != NotStarted && !isComplete(); -} -bool TrackerBase::hasChildren() const { - return !m_children.empty(); -} + bool TrackerBase::isComplete() const { + return m_runState == CompletedSuccessfully || m_runState == Failed; + } + bool TrackerBase::isSuccessfullyCompleted() const { + return m_runState == CompletedSuccessfully; + } + bool TrackerBase::isOpen() const { + return m_runState != NotStarted && !isComplete(); + } + bool TrackerBase::hasChildren() const { + return !m_children.empty(); + } -void TrackerBase::addChild( ITrackerPtr const& child ) { - m_children.push_back( child ); -} + void TrackerBase::addChild( ITrackerPtr const& child ) { + m_children.push_back( child ); + } -ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) { - auto it = std::find_if( m_children.begin(), m_children.end(), - [&nameAndLocation]( ITrackerPtr const& tracker ){ - return - tracker->nameAndLocation().location == nameAndLocation.location && - tracker->nameAndLocation().name == nameAndLocation.name; - } ); - return( it != m_children.end() ) - ? *it - : nullptr; -} -ITracker& TrackerBase::parent() { - assert( m_parent ); // Should always be non-null except for root - return *m_parent; -} + ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) { + auto it = std::find_if( m_children.begin(), m_children.end(), + [&nameAndLocation]( ITrackerPtr const& tracker ){ + return + tracker->nameAndLocation().location == nameAndLocation.location && + tracker->nameAndLocation().name == nameAndLocation.name; + } ); + return( it != m_children.end() ) + ? *it + : nullptr; + } + ITracker& TrackerBase::parent() { + assert( m_parent ); // Should always be non-null except for root + return *m_parent; + } -void TrackerBase::openChild() { - if( m_runState != ExecutingChildren ) { - m_runState = ExecutingChildren; - if( m_parent ) - m_parent->openChild(); + void TrackerBase::openChild() { + if( m_runState != ExecutingChildren ) { + m_runState = ExecutingChildren; + if( m_parent ) + m_parent->openChild(); + } } -} -bool TrackerBase::isSectionTracker() const { return false; } -bool TrackerBase::isGeneratorTracker() const { return false; } + bool TrackerBase::isSectionTracker() const { return false; } + bool TrackerBase::isGeneratorTracker() const { return false; } -void TrackerBase::open() { - m_runState = Executing; - moveToThis(); - if( m_parent ) - m_parent->openChild(); -} + void TrackerBase::open() { + m_runState = Executing; + moveToThis(); + if( m_parent ) + m_parent->openChild(); + } -void TrackerBase::close() { + void TrackerBase::close() { - // Close any still open children (e.g. generators) - while( &m_ctx.currentTracker() != this ) - m_ctx.currentTracker().close(); + // Close any still open children (e.g. generators) + while( &m_ctx.currentTracker() != this ) + m_ctx.currentTracker().close(); - switch( m_runState ) { - case NeedsAnotherRun: - break; + switch( m_runState ) { + case NeedsAnotherRun: + break; - case Executing: - m_runState = CompletedSuccessfully; - break; - case ExecutingChildren: - if( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->isComplete(); }) ) + case Executing: m_runState = CompletedSuccessfully; - break; + break; + case ExecutingChildren: + if( std::all_of(m_children.begin(), m_children.end(), [](ITrackerPtr const& t){ return t->isComplete(); }) ) + m_runState = CompletedSuccessfully; + break; - case NotStarted: - case CompletedSuccessfully: - case Failed: - CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState ); + case NotStarted: + case CompletedSuccessfully: + case Failed: + CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState ); - default: - CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState ); + default: + CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState ); + } + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::fail() { + m_runState = Failed; + if( m_parent ) + m_parent->markAsNeedingAnotherRun(); + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::markAsNeedingAnotherRun() { + m_runState = NeedsAnotherRun; } - moveToParent(); - m_ctx.completeCycle(); -} -void TrackerBase::fail() { - m_runState = Failed; - if( m_parent ) - m_parent->markAsNeedingAnotherRun(); - moveToParent(); - m_ctx.completeCycle(); -} -void TrackerBase::markAsNeedingAnotherRun() { - m_runState = NeedsAnotherRun; -} -void TrackerBase::moveToParent() { - assert( m_parent ); - m_ctx.setCurrentTracker( m_parent ); -} -void TrackerBase::moveToThis() { - m_ctx.setCurrentTracker( this ); -} + void TrackerBase::moveToParent() { + assert( m_parent ); + m_ctx.setCurrentTracker( m_parent ); + } + void TrackerBase::moveToThis() { + m_ctx.setCurrentTracker( this ); + } -SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) - : TrackerBase( nameAndLocation, ctx, parent ), - m_trimmed_name(trim(nameAndLocation.name)) -{ - if( parent ) { - while( !parent->isSectionTracker() ) - parent = &parent->parent(); + SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ), + m_trimmed_name(trim(nameAndLocation.name)) + { + if( parent ) { + while( !parent->isSectionTracker() ) + parent = &parent->parent(); - SectionTracker& parentSection = static_cast( *parent ); - addNextFilters( parentSection.m_filters ); + SectionTracker& parentSection = static_cast( *parent ); + addNextFilters( parentSection.m_filters ); + } } -} -bool SectionTracker::isComplete() const { - bool complete = true; + bool SectionTracker::isComplete() const { + bool complete = true; - if (m_filters.empty() - || m_filters[0] == "" - || std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) { - complete = TrackerBase::isComplete(); + if (m_filters.empty() + || m_filters[0] == "" + || std::find(m_filters.begin(), m_filters.end(), m_trimmed_name) != m_filters.end()) { + complete = TrackerBase::isComplete(); + } + return complete; } - return complete; -} -bool SectionTracker::isSectionTracker() const { return true; } + bool SectionTracker::isSectionTracker() const { return true; } -SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { - std::shared_ptr section; + SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { + std::shared_ptr section; - ITracker& currentTracker = ctx.currentTracker(); - if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { - assert( childTracker ); - assert( childTracker->isSectionTracker() ); - section = std::static_pointer_cast( childTracker ); - } - else { - section = std::make_shared( nameAndLocation, ctx, ¤tTracker ); - currentTracker.addChild( section ); + ITracker& currentTracker = ctx.currentTracker(); + if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isSectionTracker() ); + section = std::static_pointer_cast( childTracker ); + } + else { + section = std::make_shared( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( section ); + } + if( !ctx.completedCycle() ) + section->tryOpen(); + return *section; } - if( !ctx.completedCycle() ) - section->tryOpen(); - return *section; -} -void SectionTracker::tryOpen() { - if( !isComplete() ) - open(); -} + void SectionTracker::tryOpen() { + if( !isComplete() ) + open(); + } -void SectionTracker::addInitialFilters( std::vector const& filters ) { - if( !filters.empty() ) { - m_filters.reserve( m_filters.size() + filters.size() + 2 ); - m_filters.emplace_back(""); // Root - should never be consulted - m_filters.emplace_back(""); // Test Case - not a section filter - m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); + void SectionTracker::addInitialFilters( std::vector const& filters ) { + if( !filters.empty() ) { + m_filters.reserve( m_filters.size() + filters.size() + 2 ); + m_filters.emplace_back(""); // Root - should never be consulted + m_filters.emplace_back(""); // Test Case - not a section filter + m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); + } + } + void SectionTracker::addNextFilters( std::vector const& filters ) { + if( filters.size() > 1 ) + m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() ); } -} -void SectionTracker::addNextFilters( std::vector const& filters ) { - if( filters.size() > 1 ) - m_filters.insert( m_filters.end(), filters.begin()+1, filters.end() ); -} -std::vector const& SectionTracker::getFilters() const { - return m_filters; -} + std::vector const& SectionTracker::getFilters() const { + return m_filters; + } -std::string const& SectionTracker::trimmedName() const { - return m_trimmed_name; -} + std::string const& SectionTracker::trimmedName() const { + return m_trimmed_name; + } } // namespace TestCaseTracking @@ -14592,28 +14592,28 @@ using TestCaseTracking::SectionTracker; namespace Catch { -auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { - return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); -} + auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { + return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); + } -NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} + NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} -AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { - CATCH_TRY { - getMutableRegistryHub() - .registerTest( + AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { + CATCH_TRY { + getMutableRegistryHub() + .registerTest( makeTestCase( - invoker, - extractClassName( classOrMethod ), - nameAndTags, - lineInfo)); - } CATCH_CATCH_ALL { - // Do not throw when constructing global objects, instead register the exception to be processed later - getMutableRegistryHub().registerStartupException(); + invoker, + extractClassName( classOrMethod ), + nameAndTags, + lineInfo)); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } } -} -AutoReg::~AutoReg() = default; + AutoReg::~AutoReg() = default; } // end catch_test_registry.cpp // start catch_test_spec.cpp @@ -14625,80 +14625,80 @@ AutoReg::~AutoReg() = default; namespace Catch { -TestSpec::Pattern::Pattern( std::string const& name ) - : m_name( name ) -{} + TestSpec::Pattern::Pattern( std::string const& name ) + : m_name( name ) + {} -TestSpec::Pattern::~Pattern() = default; + TestSpec::Pattern::~Pattern() = default; -std::string const& TestSpec::Pattern::name() const { - return m_name; -} + std::string const& TestSpec::Pattern::name() const { + return m_name; + } -TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString ) - : Pattern( filterString ) - , m_wildcardPattern( toLower( name ), CaseSensitive::No ) -{} + TestSpec::NamePattern::NamePattern( std::string const& name, std::string const& filterString ) + : Pattern( filterString ) + , m_wildcardPattern( toLower( name ), CaseSensitive::No ) + {} -bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { - return m_wildcardPattern.matches( testCase.name ); -} + bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { + return m_wildcardPattern.matches( testCase.name ); + } -TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) - : Pattern( filterString ) - , m_tag( toLower( tag ) ) -{} + TestSpec::TagPattern::TagPattern( std::string const& tag, std::string const& filterString ) + : Pattern( filterString ) + , m_tag( toLower( tag ) ) + {} -bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { - return std::find(begin(testCase.lcaseTags), - end(testCase.lcaseTags), - m_tag) != end(testCase.lcaseTags); -} + bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { + return std::find(begin(testCase.lcaseTags), + end(testCase.lcaseTags), + m_tag) != end(testCase.lcaseTags); + } -TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) - : Pattern( underlyingPattern->name() ) - , m_underlyingPattern( underlyingPattern ) -{} + TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) + : Pattern( underlyingPattern->name() ) + , m_underlyingPattern( underlyingPattern ) + {} -bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { - return !m_underlyingPattern->matches( testCase ); -} + bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { + return !m_underlyingPattern->matches( testCase ); + } -bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { - return std::all_of( m_patterns.begin(), m_patterns.end(), [&]( PatternPtr const& p ){ return p->matches( testCase ); } ); -} + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { + return std::all_of( m_patterns.begin(), m_patterns.end(), [&]( PatternPtr const& p ){ return p->matches( testCase ); } ); + } -std::string TestSpec::Filter::name() const { - std::string name; - for( auto const& p : m_patterns ) - name += p->name(); - return name; -} + std::string TestSpec::Filter::name() const { + std::string name; + for( auto const& p : m_patterns ) + name += p->name(); + return name; + } -bool TestSpec::hasFilters() const { - return !m_filters.empty(); -} + bool TestSpec::hasFilters() const { + return !m_filters.empty(); + } -bool TestSpec::matches( TestCaseInfo const& testCase ) const { - return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } ); -} + bool TestSpec::matches( TestCaseInfo const& testCase ) const { + return std::any_of( m_filters.begin(), m_filters.end(), [&]( Filter const& f ){ return f.matches( testCase ); } ); + } -TestSpec::Matches TestSpec::matchesByFilter( std::vector const& testCases, IConfig const& config ) const -{ - Matches matches( m_filters.size() ); - std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){ - std::vector currentMatches; - for( auto const& test : testCases ) - if( isThrowSafe( test, config ) && filter.matches( test ) ) - currentMatches.emplace_back( &test ); - return FilterMatch{ filter.name(), currentMatches }; - } ); - return matches; -} + TestSpec::Matches TestSpec::matchesByFilter( std::vector const& testCases, IConfig const& config ) const + { + Matches matches( m_filters.size() ); + std::transform( m_filters.begin(), m_filters.end(), matches.begin(), [&]( Filter const& filter ){ + std::vector currentMatches; + for( auto const& test : testCases ) + if( isThrowSafe( test, config ) && filter.matches( test ) ) + currentMatches.emplace_back( &test ); + return FilterMatch{ filter.name(), currentMatches }; + } ); + return matches; + } -const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ - return (m_invalidArgs); -} + const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ + return (m_invalidArgs); + } } // end catch_test_spec.cpp @@ -14706,40 +14706,40 @@ const TestSpec::vectorStrings& TestSpec::getInvalidArgs() const{ namespace Catch { -TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} - -TestSpecParser& TestSpecParser::parse( std::string const& arg ) { - m_mode = None; - m_exclusion = false; - m_arg = m_tagAliases->expandAliases( arg ); - m_escapeChars.clear(); - m_substring.reserve(m_arg.size()); - m_patternName.reserve(m_arg.size()); - m_realPatternPos = 0; - - for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) - //if visitChar fails - if( !visitChar( m_arg[m_pos] ) ){ - m_testSpec.m_invalidArgs.push_back(arg); - break; - } - endMode(); - return *this; -} -TestSpec TestSpecParser::testSpec() { - addFilter(); - return m_testSpec; -} -bool TestSpecParser::visitChar( char c ) { - if( (m_mode != EscapedName) && (c == '\\') ) { - escape(); - addCharToPattern(c); - return true; - }else if((m_mode != EscapedName) && (c == ',') ) { - return separate(); + TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} + + TestSpecParser& TestSpecParser::parse( std::string const& arg ) { + m_mode = None; + m_exclusion = false; + m_arg = m_tagAliases->expandAliases( arg ); + m_escapeChars.clear(); + m_substring.reserve(m_arg.size()); + m_patternName.reserve(m_arg.size()); + m_realPatternPos = 0; + + for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) + //if visitChar fails + if( !visitChar( m_arg[m_pos] ) ){ + m_testSpec.m_invalidArgs.push_back(arg); + break; + } + endMode(); + return *this; } + TestSpec TestSpecParser::testSpec() { + addFilter(); + return m_testSpec; + } + bool TestSpecParser::visitChar( char c ) { + if( (m_mode != EscapedName) && (c == '\\') ) { + escape(); + addCharToPattern(c); + return true; + }else if((m_mode != EscapedName) && (c == ',') ) { + return separate(); + } - switch( m_mode ) { + switch( m_mode ) { case None: if( processNoneChar( c ) ) return true; @@ -14757,19 +14757,19 @@ bool TestSpecParser::visitChar( char c ) { if( processOtherChar( c ) ) return true; break; - } + } - m_substring += c; - if( !isControlChar( c ) ) { - m_patternName += c; - m_realPatternPos++; + m_substring += c; + if( !isControlChar( c ) ) { + m_patternName += c; + m_realPatternPos++; + } + return true; } - return true; -} -// Two of the processing methods return true to signal the caller to return -// without adding the given character to the current pattern strings -bool TestSpecParser::processNoneChar( char c ) { - switch( c ) { + // Two of the processing methods return true to signal the caller to return + // without adding the given character to the current pattern strings + bool TestSpecParser::processNoneChar( char c ) { + switch( c ) { case ' ': return true; case '~': @@ -14784,29 +14784,29 @@ bool TestSpecParser::processNoneChar( char c ) { default: startNewMode( Name ); return false; + } } -} -void TestSpecParser::processNameChar( char c ) { - if( c == '[' ) { - if( m_substring == "exclude:" ) - m_exclusion = true; - else - endMode(); - startNewMode( Tag ); + void TestSpecParser::processNameChar( char c ) { + if( c == '[' ) { + if( m_substring == "exclude:" ) + m_exclusion = true; + else + endMode(); + startNewMode( Tag ); + } } -} -bool TestSpecParser::processOtherChar( char c ) { - if( !isControlChar( c ) ) - return false; - m_substring += c; - endMode(); - return true; -} -void TestSpecParser::startNewMode( Mode mode ) { - m_mode = mode; -} -void TestSpecParser::endMode() { - switch( m_mode ) { + bool TestSpecParser::processOtherChar( char c ) { + if( !isControlChar( c ) ) + return false; + m_substring += c; + endMode(); + return true; + } + void TestSpecParser::startNewMode( Mode mode ) { + m_mode = mode; + } + void TestSpecParser::endMode() { + switch( m_mode ) { case Name: case QuotedName: return addNamePattern(); @@ -14818,120 +14818,120 @@ void TestSpecParser::endMode() { case None: default: return startNewMode( None ); + } } -} -void TestSpecParser::escape() { - saveLastMode(); - m_mode = EscapedName; - m_escapeChars.push_back(m_realPatternPos); -} -bool TestSpecParser::isControlChar( char c ) const { - switch( m_mode ) { - default: - return false; - case None: - return c == '~'; - case Name: - return c == '['; - case EscapedName: - return true; - case QuotedName: - return c == '"'; - case Tag: - return c == '[' || c == ']'; + void TestSpecParser::escape() { + saveLastMode(); + m_mode = EscapedName; + m_escapeChars.push_back(m_realPatternPos); + } + bool TestSpecParser::isControlChar( char c ) const { + switch( m_mode ) { + default: + return false; + case None: + return c == '~'; + case Name: + return c == '['; + case EscapedName: + return true; + case QuotedName: + return c == '"'; + case Tag: + return c == '[' || c == ']'; + } } -} -void TestSpecParser::addFilter() { - if( !m_currentFilter.m_patterns.empty() ) { - m_testSpec.m_filters.push_back( m_currentFilter ); - m_currentFilter = TestSpec::Filter(); + void TestSpecParser::addFilter() { + if( !m_currentFilter.m_patterns.empty() ) { + m_testSpec.m_filters.push_back( m_currentFilter ); + m_currentFilter = TestSpec::Filter(); + } } -} -void TestSpecParser::saveLastMode() { - lastMode = m_mode; -} + void TestSpecParser::saveLastMode() { + lastMode = m_mode; + } -void TestSpecParser::revertBackToLastMode() { - m_mode = lastMode; -} + void TestSpecParser::revertBackToLastMode() { + m_mode = lastMode; + } + + bool TestSpecParser::separate() { + if( (m_mode==QuotedName) || (m_mode==Tag) ){ + //invalid argument, signal failure to previous scope. + m_mode = None; + m_pos = m_arg.size(); + m_substring.clear(); + m_patternName.clear(); + m_realPatternPos = 0; + return false; + } + endMode(); + addFilter(); + return true; //success + } + + std::string TestSpecParser::preprocessPattern() { + std::string token = m_patternName; + for (std::size_t i = 0; i < m_escapeChars.size(); ++i) + token = token.substr(0, m_escapeChars[i] - i) + token.substr(m_escapeChars[i] - i + 1); + m_escapeChars.clear(); + if (startsWith(token, "exclude:")) { + m_exclusion = true; + token = token.substr(8); + } -bool TestSpecParser::separate() { - if( (m_mode==QuotedName) || (m_mode==Tag) ){ - //invalid argument, signal failure to previous scope. - m_mode = None; - m_pos = m_arg.size(); - m_substring.clear(); m_patternName.clear(); m_realPatternPos = 0; - return false; - } - endMode(); - addFilter(); - return true; //success -} -std::string TestSpecParser::preprocessPattern() { - std::string token = m_patternName; - for (std::size_t i = 0; i < m_escapeChars.size(); ++i) - token = token.substr(0, m_escapeChars[i] - i) + token.substr(m_escapeChars[i] - i + 1); - m_escapeChars.clear(); - if (startsWith(token, "exclude:")) { - m_exclusion = true; - token = token.substr(8); + return token; } - m_patternName.clear(); - m_realPatternPos = 0; + void TestSpecParser::addNamePattern() { + auto token = preprocessPattern(); - return token; -} + if (!token.empty()) { + TestSpec::PatternPtr pattern = std::make_shared(token, m_substring); + if (m_exclusion) + pattern = std::make_shared(pattern); + m_currentFilter.m_patterns.push_back(pattern); + } + m_substring.clear(); + m_exclusion = false; + m_mode = None; + } -void TestSpecParser::addNamePattern() { - auto token = preprocessPattern(); + void TestSpecParser::addTagPattern() { + auto token = preprocessPattern(); - if (!token.empty()) { - TestSpec::PatternPtr pattern = std::make_shared(token, m_substring); - if (m_exclusion) - pattern = std::make_shared(pattern); - m_currentFilter.m_patterns.push_back(pattern); - } - m_substring.clear(); - m_exclusion = false; - m_mode = None; -} + if (!token.empty()) { + // If the tag pattern is the "hide and tag" shorthand (e.g. [.foo]) + // we have to create a separate hide tag and shorten the real one + if (token.size() > 1 && token[0] == '.') { + token.erase(token.begin()); + TestSpec::PatternPtr pattern = std::make_shared(".", m_substring); + if (m_exclusion) { + pattern = std::make_shared(pattern); + } + m_currentFilter.m_patterns.push_back(pattern); + } -void TestSpecParser::addTagPattern() { - auto token = preprocessPattern(); + TestSpec::PatternPtr pattern = std::make_shared(token, m_substring); - if (!token.empty()) { - // If the tag pattern is the "hide and tag" shorthand (e.g. [.foo]) - // we have to create a separate hide tag and shorten the real one - if (token.size() > 1 && token[0] == '.') { - token.erase(token.begin()); - TestSpec::PatternPtr pattern = std::make_shared(".", m_substring); if (m_exclusion) { pattern = std::make_shared(pattern); } m_currentFilter.m_patterns.push_back(pattern); } - - TestSpec::PatternPtr pattern = std::make_shared(token, m_substring); - - if (m_exclusion) { - pattern = std::make_shared(pattern); - } - m_currentFilter.m_patterns.push_back(pattern); + m_substring.clear(); + m_exclusion = false; + m_mode = None; } - m_substring.clear(); - m_exclusion = false; - m_mode = None; -} -TestSpec parseTestSpec( std::string const& arg ) { - return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); -} + TestSpec parseTestSpec( std::string const& arg ) { + return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); + } } // namespace Catch // end catch_test_spec_parser.cpp @@ -14943,61 +14943,61 @@ static const uint64_t nanosecondsInSecond = 1000000000; namespace Catch { -auto getCurrentNanosecondsSinceEpoch() -> uint64_t { - return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); -} + auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); + } -namespace { -auto estimateClockResolution() -> uint64_t { - uint64_t sum = 0; - static const uint64_t iterations = 1000000; + namespace { + auto estimateClockResolution() -> uint64_t { + uint64_t sum = 0; + static const uint64_t iterations = 1000000; - auto startTime = getCurrentNanosecondsSinceEpoch(); + auto startTime = getCurrentNanosecondsSinceEpoch(); - for( std::size_t i = 0; i < iterations; ++i ) { + for( std::size_t i = 0; i < iterations; ++i ) { - uint64_t ticks; - uint64_t baseTicks = getCurrentNanosecondsSinceEpoch(); - do { - ticks = getCurrentNanosecondsSinceEpoch(); - } while( ticks == baseTicks ); + uint64_t ticks; + uint64_t baseTicks = getCurrentNanosecondsSinceEpoch(); + do { + ticks = getCurrentNanosecondsSinceEpoch(); + } while( ticks == baseTicks ); + + auto delta = ticks - baseTicks; + sum += delta; - auto delta = ticks - baseTicks; - sum += delta; + // If we have been calibrating for over 3 seconds -- the clock + // is terrible and we should move on. + // TBD: How to signal that the measured resolution is probably wrong? + if (ticks > startTime + 3 * nanosecondsInSecond) { + return sum / ( i + 1u ); + } + } - // If we have been calibrating for over 3 seconds -- the clock - // is terrible and we should move on. - // TBD: How to signal that the measured resolution is probably wrong? - if (ticks > startTime + 3 * nanosecondsInSecond) { - return sum / ( i + 1u ); + // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers + // - and potentially do more iterations if there's a high variance. + return sum/iterations; } } + auto getEstimatedClockResolution() -> uint64_t { + static auto s_resolution = estimateClockResolution(); + return s_resolution; + } - // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers - // - and potentially do more iterations if there's a high variance. - return sum/iterations; -} -} -auto getEstimatedClockResolution() -> uint64_t { - static auto s_resolution = estimateClockResolution(); - return s_resolution; -} - -void Timer::start() { - m_nanoseconds = getCurrentNanosecondsSinceEpoch(); -} -auto Timer::getElapsedNanoseconds() const -> uint64_t { - return getCurrentNanosecondsSinceEpoch() - m_nanoseconds; -} -auto Timer::getElapsedMicroseconds() const -> uint64_t { - return getElapsedNanoseconds()/1000; -} -auto Timer::getElapsedMilliseconds() const -> unsigned int { - return static_cast(getElapsedMicroseconds()/1000); -} -auto Timer::getElapsedSeconds() const -> double { - return getElapsedMicroseconds()/1000000.0; -} + void Timer::start() { + m_nanoseconds = getCurrentNanosecondsSinceEpoch(); + } + auto Timer::getElapsedNanoseconds() const -> uint64_t { + return getCurrentNanosecondsSinceEpoch() - m_nanoseconds; + } + auto Timer::getElapsedMicroseconds() const -> uint64_t { + return getElapsedNanoseconds()/1000; + } + auto Timer::getElapsedMilliseconds() const -> unsigned int { + return static_cast(getElapsedMicroseconds()/1000); + } + auto Timer::getElapsedSeconds() const -> double { + return getElapsedMicroseconds()/1000000.0; + } } // namespace Catch // end catch_timer.cpp @@ -15021,39 +15021,39 @@ namespace Catch { namespace Detail { -const std::string unprintableString = "{?}"; + const std::string unprintableString = "{?}"; -namespace { -const int hexThreshold = 255; + namespace { + const int hexThreshold = 255; -struct Endianness { - enum Arch { Big, Little }; + struct Endianness { + enum Arch { Big, Little }; - static Arch which() { - int one = 1; - // If the lowest byte we read is non-zero, we can assume - // that little endian format is used. - auto value = *reinterpret_cast(&one); - return value ? Little : Big; + static Arch which() { + int one = 1; + // If the lowest byte we read is non-zero, we can assume + // that little endian format is used. + auto value = *reinterpret_cast(&one); + return value ? Little : Big; + } + }; } -}; -} -std::string rawMemoryToString( const void *object, std::size_t size ) { - // Reverse order for little endian architectures - int i = 0, end = static_cast( size ), inc = 1; - if( Endianness::which() == Endianness::Little ) { - i = end-1; - end = inc = -1; - } + std::string rawMemoryToString( const void *object, std::size_t size ) { + // Reverse order for little endian architectures + int i = 0, end = static_cast( size ), inc = 1; + if( Endianness::which() == Endianness::Little ) { + i = end-1; + end = inc = -1; + } - unsigned char const *bytes = static_cast(object); - ReusableStringStream rss; - rss << "0x" << std::setfill('0') << std::hex; - for( ; i != end; i += inc ) - rss << std::setw(2) << static_cast(bytes[i]); - return rss.str(); -} + unsigned char const *bytes = static_cast(object); + ReusableStringStream rss; + rss << "0x" << std::setfill('0') << std::hex; + for( ; i != end; i += inc ) + rss << std::setw(2) << static_cast(bytes[i]); + return rss.str(); + } } template @@ -15090,15 +15090,15 @@ std::string StringMaker::convert(const std::string& str) { std::string s("\""); for (char c : str) { switch (c) { - case '\n': - s.append("\\n"); - break; - case '\t': - s.append("\\t"); - break; - default: - s.push_back(c); - break; + case '\n': + s.append("\\n"); + break; + case '\t': + s.append("\\t"); + break; + default: + s.push_back(c); + break; } } s.append("\""); @@ -15257,54 +15257,54 @@ std::string ratio_string::symbol() { return "m"; } namespace Catch { -Counts Counts::operator - ( Counts const& other ) const { - Counts diff; - diff.passed = passed - other.passed; - diff.failed = failed - other.failed; - diff.failedButOk = failedButOk - other.failedButOk; - return diff; -} - -Counts& Counts::operator += ( Counts const& other ) { - passed += other.passed; - failed += other.failed; - failedButOk += other.failedButOk; - return *this; -} + Counts Counts::operator - ( Counts const& other ) const { + Counts diff; + diff.passed = passed - other.passed; + diff.failed = failed - other.failed; + diff.failedButOk = failedButOk - other.failedButOk; + return diff; + } -std::size_t Counts::total() const { - return passed + failed + failedButOk; -} -bool Counts::allPassed() const { - return failed == 0 && failedButOk == 0; -} -bool Counts::allOk() const { - return failed == 0; -} + Counts& Counts::operator += ( Counts const& other ) { + passed += other.passed; + failed += other.failed; + failedButOk += other.failedButOk; + return *this; + } -Totals Totals::operator - ( Totals const& other ) const { - Totals diff; - diff.assertions = assertions - other.assertions; - diff.testCases = testCases - other.testCases; - return diff; -} + std::size_t Counts::total() const { + return passed + failed + failedButOk; + } + bool Counts::allPassed() const { + return failed == 0 && failedButOk == 0; + } + bool Counts::allOk() const { + return failed == 0; + } -Totals& Totals::operator += ( Totals const& other ) { - assertions += other.assertions; - testCases += other.testCases; - return *this; -} + Totals Totals::operator - ( Totals const& other ) const { + Totals diff; + diff.assertions = assertions - other.assertions; + diff.testCases = testCases - other.testCases; + return diff; + } -Totals Totals::delta( Totals const& prevTotals ) const { - Totals diff = *this - prevTotals; - if( diff.assertions.failed > 0 ) - ++diff.testCases.failed; - else if( diff.assertions.failedButOk > 0 ) - ++diff.testCases.failedButOk; - else - ++diff.testCases.passed; - return diff; -} + Totals& Totals::operator += ( Totals const& other ) { + assertions += other.assertions; + testCases += other.testCases; + return *this; + } + + Totals Totals::delta( Totals const& prevTotals ) const { + Totals diff = *this - prevTotals; + if( diff.assertions.failed > 0 ) + ++diff.testCases.failed; + else if( diff.assertions.failedButOk > 0 ) + ++diff.testCases.failedButOk; + else + ++diff.testCases.passed; + return diff; + } } // end catch_totals.cpp @@ -15348,15 +15348,15 @@ Totals Totals::delta( Totals const& prevTotals ) const { #include namespace Catch { -bool uncaught_exceptions() { + bool uncaught_exceptions() { #if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) - return false; + return false; #elif defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) - return std::uncaught_exceptions() > 0; + return std::uncaught_exceptions() > 0; #else - return std::uncaught_exception(); + return std::uncaught_exception(); #endif -} + } } // end namespace Catch // end catch_uncaught_exceptions.cpp // start catch_version.cpp @@ -15365,35 +15365,35 @@ bool uncaught_exceptions() { namespace Catch { -Version::Version + Version::Version ( unsigned int _majorVersion, unsigned int _minorVersion, unsigned int _patchNumber, char const * const _branchName, unsigned int _buildNumber ) - : majorVersion( _majorVersion ), - minorVersion( _minorVersion ), - patchNumber( _patchNumber ), - branchName( _branchName ), - buildNumber( _buildNumber ) -{} - -std::ostream& operator << ( std::ostream& os, Version const& version ) { - os << version.majorVersion << '.' - << version.minorVersion << '.' - << version.patchNumber; - // branchName is never null -> 0th char is \0 if it is empty - if (version.branchName[0]) { - os << '-' << version.branchName - << '.' << version.buildNumber; - } - return os; -} + : majorVersion( _majorVersion ), + minorVersion( _minorVersion ), + patchNumber( _patchNumber ), + branchName( _branchName ), + buildNumber( _buildNumber ) + {} -Version const& libraryVersion() { - static Version version( 2, 13, 9, "", 0 ); - return version; -} + std::ostream& operator << ( std::ostream& os, Version const& version ) { + os << version.majorVersion << '.' + << version.minorVersion << '.' + << version.patchNumber; + // branchName is never null -> 0th char is \0 if it is empty + if (version.branchName[0]) { + os << '-' << version.branchName + << '.' << version.buildNumber; + } + return os; + } + + Version const& libraryVersion() { + static Version version( 2, 13, 9, "", 0 ); + return version; + } } // end catch_version.cpp @@ -15401,39 +15401,39 @@ Version const& libraryVersion() { namespace Catch { -WildcardPattern::WildcardPattern( std::string const& pattern, - CaseSensitive::Choice caseSensitivity ) - : m_caseSensitivity( caseSensitivity ), - m_pattern( normaliseString( pattern ) ) -{ - if( startsWith( m_pattern, '*' ) ) { - m_pattern = m_pattern.substr( 1 ); - m_wildcard = WildcardAtStart; - } - if( endsWith( m_pattern, '*' ) ) { - m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); - m_wildcard = static_cast( m_wildcard | WildcardAtEnd ); + WildcardPattern::WildcardPattern( std::string const& pattern, + CaseSensitive::Choice caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_pattern( normaliseString( pattern ) ) + { + if( startsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 1 ); + m_wildcard = WildcardAtStart; + } + if( endsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); + m_wildcard = static_cast( m_wildcard | WildcardAtEnd ); + } } -} -bool WildcardPattern::matches( std::string const& str ) const { - switch( m_wildcard ) { - case NoWildcard: - return m_pattern == normaliseString( str ); - case WildcardAtStart: - return endsWith( normaliseString( str ), m_pattern ); - case WildcardAtEnd: - return startsWith( normaliseString( str ), m_pattern ); - case WildcardAtBothEnds: - return contains( normaliseString( str ), m_pattern ); - default: - CATCH_INTERNAL_ERROR( "Unknown enum" ); + bool WildcardPattern::matches( std::string const& str ) const { + switch( m_wildcard ) { + case NoWildcard: + return m_pattern == normaliseString( str ); + case WildcardAtStart: + return endsWith( normaliseString( str ), m_pattern ); + case WildcardAtEnd: + return startsWith( normaliseString( str ), m_pattern ); + case WildcardAtBothEnds: + return contains( normaliseString( str ), m_pattern ); + default: + CATCH_INTERNAL_ERROR( "Unknown enum" ); + } } -} -std::string WildcardPattern::normaliseString( std::string const& str ) const { - return trim( m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str ); -} + std::string WildcardPattern::normaliseString( std::string const& str ) const { + return trim( m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str ); + } } // end catch_wildcard_pattern.cpp // start catch_xmlwriter.cpp @@ -15445,76 +15445,76 @@ namespace Catch { namespace { -size_t trailingBytes(unsigned char c) { - if ((c & 0xE0) == 0xC0) { - return 2; - } - if ((c & 0xF0) == 0xE0) { - return 3; - } - if ((c & 0xF8) == 0xF0) { - return 4; + size_t trailingBytes(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return 2; + } + if ((c & 0xF0) == 0xE0) { + return 3; + } + if ((c & 0xF8) == 0xF0) { + return 4; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); } - CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); -} -uint32_t headerValue(unsigned char c) { - if ((c & 0xE0) == 0xC0) { - return c & 0x1F; - } - if ((c & 0xF0) == 0xE0) { - return c & 0x0F; - } - if ((c & 0xF8) == 0xF0) { - return c & 0x07; + uint32_t headerValue(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return c & 0x1F; + } + if ((c & 0xF0) == 0xE0) { + return c & 0x0F; + } + if ((c & 0xF8) == 0xF0) { + return c & 0x07; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); } - CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); -} -void hexEscapeChar(std::ostream& os, unsigned char c) { - std::ios_base::fmtflags f(os.flags()); - os << "\\x" - << std::uppercase << std::hex << std::setfill('0') << std::setw(2) - << static_cast(c); - os.flags(f); -} + void hexEscapeChar(std::ostream& os, unsigned char c) { + std::ios_base::fmtflags f(os.flags()); + os << "\\x" + << std::uppercase << std::hex << std::setfill('0') << std::setw(2) + << static_cast(c); + os.flags(f); + } -bool shouldNewline(XmlFormatting fmt) { - return !!(static_cast::type>(fmt & XmlFormatting::Newline)); -} + bool shouldNewline(XmlFormatting fmt) { + return !!(static_cast::type>(fmt & XmlFormatting::Newline)); + } -bool shouldIndent(XmlFormatting fmt) { - return !!(static_cast::type>(fmt & XmlFormatting::Indent)); -} + bool shouldIndent(XmlFormatting fmt) { + return !!(static_cast::type>(fmt & XmlFormatting::Indent)); + } } // anonymous namespace -XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) { - return static_cast( + XmlFormatting operator | (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast( static_cast::type>(lhs) | static_cast::type>(rhs) - ); -} + ); + } -XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) { - return static_cast( + XmlFormatting operator & (XmlFormatting lhs, XmlFormatting rhs) { + return static_cast( static_cast::type>(lhs) & static_cast::type>(rhs) - ); -} + ); + } -XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) - : m_str( str ), - m_forWhat( forWhat ) -{} + XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) + : m_str( str ), + m_forWhat( forWhat ) + {} -void XmlEncode::encodeTo( std::ostream& os ) const { - // Apostrophe escaping not necessary if we always use " to write attributes - // (see: http://www.w3.org/TR/xml/#syntax) + void XmlEncode::encodeTo( std::ostream& os ) const { + // Apostrophe escaping not necessary if we always use " to write attributes + // (see: http://www.w3.org/TR/xml/#syntax) - for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) { - unsigned char c = m_str[idx]; - switch (c) { + for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) { + unsigned char c = m_str[idx]; + switch (c) { case '<': os << "<"; break; case '&': os << "&"; break; @@ -15580,14 +15580,14 @@ void XmlEncode::encodeTo( std::ostream& os ) const { if ( // Wrong bit pattern of following bytes - (!valid) || - // Overlong encodings - (value < 0x80) || - (0x80 <= value && value < 0x800 && encBytes > 2) || - (0x800 < value && value < 0x10000 && encBytes > 3) || - // Encoded value out of range - (value >= 0x110000) - ) { + (!valid) || + // Overlong encodings + (value < 0x80) || + (0x80 <= value && value < 0x800 && encBytes > 2) || + (0x800 < value && value < 0x10000 && encBytes > 3) || + // Encoded value out of range + (value >= 0x110000) + ) { hexEscapeChar(os, c); break; } @@ -15598,167 +15598,167 @@ void XmlEncode::encodeTo( std::ostream& os ) const { } idx += encBytes - 1; break; + } } } -} - -std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { - xmlEncode.encodeTo( os ); - return os; -} - -XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer, XmlFormatting fmt ) - : m_writer( writer ), - m_fmt(fmt) -{} - -XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept - : m_writer( other.m_writer ), - m_fmt(other.m_fmt) -{ - other.m_writer = nullptr; - other.m_fmt = XmlFormatting::None; -} -XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { - if ( m_writer ) { - m_writer->endElement(); - } - m_writer = other.m_writer; - other.m_writer = nullptr; - m_fmt = other.m_fmt; - other.m_fmt = XmlFormatting::None; - return *this; -} -XmlWriter::ScopedElement::~ScopedElement() { - if (m_writer) { - m_writer->endElement(m_fmt); + std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { + xmlEncode.encodeTo( os ); + return os; } -} -XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) { - m_writer->writeText( text, fmt ); - return *this; -} + XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer, XmlFormatting fmt ) + : m_writer( writer ), + m_fmt(fmt) + {} -XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) -{ - writeDeclaration(); -} + XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept + : m_writer( other.m_writer ), + m_fmt(other.m_fmt) + { + other.m_writer = nullptr; + other.m_fmt = XmlFormatting::None; + } + XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { + if ( m_writer ) { + m_writer->endElement(); + } + m_writer = other.m_writer; + other.m_writer = nullptr; + m_fmt = other.m_fmt; + other.m_fmt = XmlFormatting::None; + return *this; + } -XmlWriter::~XmlWriter() { - while (!m_tags.empty()) { - endElement(); + XmlWriter::ScopedElement::~ScopedElement() { + if (m_writer) { + m_writer->endElement(m_fmt); + } } - newlineIfNecessary(); -} -XmlWriter& XmlWriter::startElement( std::string const& name, XmlFormatting fmt ) { - ensureTagClosed(); - newlineIfNecessary(); - if (shouldIndent(fmt)) { - m_os << m_indent; - m_indent += " "; - } - m_os << '<' << name; - m_tags.push_back( name ); - m_tagIsOpen = true; - applyFormatting(fmt); - return *this; -} + XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, XmlFormatting fmt ) { + m_writer->writeText( text, fmt ); + return *this; + } -XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name, XmlFormatting fmt ) { - ScopedElement scoped( this, fmt ); - startElement( name, fmt ); - return scoped; -} + XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) + { + writeDeclaration(); + } -XmlWriter& XmlWriter::endElement(XmlFormatting fmt) { - m_indent = m_indent.substr(0, m_indent.size() - 2); + XmlWriter::~XmlWriter() { + while (!m_tags.empty()) { + endElement(); + } + newlineIfNecessary(); + } - if( m_tagIsOpen ) { - m_os << "/>"; - m_tagIsOpen = false; - } else { + XmlWriter& XmlWriter::startElement( std::string const& name, XmlFormatting fmt ) { + ensureTagClosed(); newlineIfNecessary(); if (shouldIndent(fmt)) { m_os << m_indent; + m_indent += " "; } - m_os << ""; + m_os << '<' << name; + m_tags.push_back( name ); + m_tagIsOpen = true; + applyFormatting(fmt); + return *this; } - m_os << std::flush; - applyFormatting(fmt); - m_tags.pop_back(); - return *this; -} -XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) { - if( !name.empty() && !attribute.empty() ) - m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; - return *this; -} + XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name, XmlFormatting fmt ) { + ScopedElement scoped( this, fmt ); + startElement( name, fmt ); + return scoped; + } -XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) { - m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; - return *this; -} + XmlWriter& XmlWriter::endElement(XmlFormatting fmt) { + m_indent = m_indent.substr(0, m_indent.size() - 2); + + if( m_tagIsOpen ) { + m_os << "/>"; + m_tagIsOpen = false; + } else { + newlineIfNecessary(); + if (shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << ""; + } + m_os << std::flush; + applyFormatting(fmt); + m_tags.pop_back(); + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) { + if( !name.empty() && !attribute.empty() ) + m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) { + m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeText( std::string const& text, XmlFormatting fmt) { + if( !text.empty() ){ + bool tagWasOpen = m_tagIsOpen; + ensureTagClosed(); + if (tagWasOpen && shouldIndent(fmt)) { + m_os << m_indent; + } + m_os << XmlEncode( text ); + applyFormatting(fmt); + } + return *this; + } -XmlWriter& XmlWriter::writeText( std::string const& text, XmlFormatting fmt) { - if( !text.empty() ){ - bool tagWasOpen = m_tagIsOpen; + XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) { ensureTagClosed(); - if (tagWasOpen && shouldIndent(fmt)) { + if (shouldIndent(fmt)) { m_os << m_indent; } - m_os << XmlEncode( text ); + m_os << ""; applyFormatting(fmt); + return *this; } - return *this; -} -XmlWriter& XmlWriter::writeComment( std::string const& text, XmlFormatting fmt) { - ensureTagClosed(); - if (shouldIndent(fmt)) { - m_os << m_indent; + void XmlWriter::writeStylesheetRef( std::string const& url ) { + m_os << "\n"; } - m_os << ""; - applyFormatting(fmt); - return *this; -} - -void XmlWriter::writeStylesheetRef( std::string const& url ) { - m_os << "\n"; -} -XmlWriter& XmlWriter::writeBlankLine() { - ensureTagClosed(); - m_os << '\n'; - return *this; -} + XmlWriter& XmlWriter::writeBlankLine() { + ensureTagClosed(); + m_os << '\n'; + return *this; + } -void XmlWriter::ensureTagClosed() { - if( m_tagIsOpen ) { - m_os << '>' << std::flush; - newlineIfNecessary(); - m_tagIsOpen = false; + void XmlWriter::ensureTagClosed() { + if( m_tagIsOpen ) { + m_os << '>' << std::flush; + newlineIfNecessary(); + m_tagIsOpen = false; + } } -} -void XmlWriter::applyFormatting(XmlFormatting fmt) { - m_needsNewline = shouldNewline(fmt); -} + void XmlWriter::applyFormatting(XmlFormatting fmt) { + m_needsNewline = shouldNewline(fmt); + } -void XmlWriter::writeDeclaration() { - m_os << "\n"; -} + void XmlWriter::writeDeclaration() { + m_os << "\n"; + } -void XmlWriter::newlineIfNecessary() { - if( m_needsNewline ) { - m_os << std::endl; - m_needsNewline = false; + void XmlWriter::newlineIfNecessary() { + if( m_needsNewline ) { + m_os << std::endl; + m_needsNewline = false; + } } } -} // end catch_xmlwriter.cpp // start catch_reporter_bases.cpp @@ -15769,68 +15769,68 @@ void XmlWriter::newlineIfNecessary() { #include namespace Catch { -void prepareExpandedExpression(AssertionResult& result) { - result.getExpandedExpression(); -} - -// Because formatting using c++ streams is stateful, drop down to C is required -// Alternatively we could use stringstream, but its performance is... not good. -std::string getFormattedDuration( double duration ) { - // Max exponent + 1 is required to represent the whole part - // + 1 for decimal point - // + 3 for the 3 decimal places - // + 1 for null terminator - const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; - char buffer[maxDoubleSize]; - - // Save previous errno, to prevent sprintf from overwriting it - ErrnoGuard guard; + void prepareExpandedExpression(AssertionResult& result) { + result.getExpandedExpression(); + } + + // Because formatting using c++ streams is stateful, drop down to C is required + // Alternatively we could use stringstream, but its performance is... not good. + std::string getFormattedDuration( double duration ) { + // Max exponent + 1 is required to represent the whole part + // + 1 for decimal point + // + 3 for the 3 decimal places + // + 1 for null terminator + const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + char buffer[maxDoubleSize]; + + // Save previous errno, to prevent sprintf from overwriting it + ErrnoGuard guard; #ifdef _MSC_VER - sprintf_s(buffer, "%.3f", duration); + sprintf_s(buffer, "%.3f", duration); #else - std::sprintf(buffer, "%.3f", duration); + std::sprintf(buffer, "%.3f", duration); #endif - return std::string(buffer); -} - -bool shouldShowDuration( IConfig const& config, double duration ) { - if ( config.showDurations() == ShowDurations::Always ) { - return true; + return std::string(buffer); } - if ( config.showDurations() == ShowDurations::Never ) { - return false; + + bool shouldShowDuration( IConfig const& config, double duration ) { + if ( config.showDurations() == ShowDurations::Always ) { + return true; + } + if ( config.showDurations() == ShowDurations::Never ) { + return false; + } + const double min = config.minDuration(); + return min >= 0 && duration >= min; } - const double min = config.minDuration(); - return min >= 0 && duration >= min; -} -std::string serializeFilters( std::vector const& container ) { - ReusableStringStream oss; - bool first = true; - for (auto&& filter : container) - { - if (!first) - oss << ' '; - else - first = false; + std::string serializeFilters( std::vector const& container ) { + ReusableStringStream oss; + bool first = true; + for (auto&& filter : container) + { + if (!first) + oss << ' '; + else + first = false; - oss << filter; + oss << filter; + } + return oss.str(); } - return oss.str(); -} -TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) + TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) :StreamingReporterBase(_config) {} -std::set TestEventListenerBase::getSupportedVerbosities() { - return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High }; -} + std::set TestEventListenerBase::getSupportedVerbosities() { + return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High }; + } -void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} + void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} -bool TestEventListenerBase::assertionEnded(AssertionStats const &) { - return false; -} + bool TestEventListenerBase::assertionEnded(AssertionStats const &) { + return false; + } } // end namespace Catch // end catch_reporter_bases.cpp @@ -15839,20 +15839,20 @@ bool TestEventListenerBase::assertionEnded(AssertionStats const &) { namespace { #ifdef CATCH_PLATFORM_MAC -const char* failedString() { return "FAILED"; } -const char* passedString() { return "PASSED"; } + const char* failedString() { return "FAILED"; } + const char* passedString() { return "PASSED"; } #else -const char* failedString() { return "failed"; } + const char* failedString() { return "failed"; } const char* passedString() { return "passed"; } #endif -// Colour::LightGrey -Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } + // Colour::LightGrey + Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } -std::string bothOrAll( std::size_t count ) { - return count == 1 ? std::string() : - count == 2 ? "both " : "all " ; -} + std::string bothOrAll( std::size_t count ) { + return count == 1 ? std::string() : + count == 2 ? "both " : "all " ; + } } // anon namespace @@ -15870,12 +15870,12 @@ void printTotals(std::ostream& out, const Totals& totals) { } else if (totals.testCases.failed == totals.testCases.total()) { Colour colour(Colour::ResultError); const std::string qualify_assertions_failed = - totals.assertions.failed == totals.assertions.total() ? - bothOrAll(totals.assertions.failed) : std::string(); + totals.assertions.failed == totals.assertions.total() ? + bothOrAll(totals.assertions.failed) : std::string(); out << "Failed " << bothOrAll(totals.testCases.failed) << pluralise(totals.testCases.failed, "test case") << ", " - "failed " << qualify_assertions_failed << + "failed " << qualify_assertions_failed << pluralise(totals.assertions.failed, "assertion") << '.'; } else if (totals.assertions.total() == 0) { out << @@ -15886,7 +15886,7 @@ void printTotals(std::ostream& out, const Totals& totals) { Colour colour(Colour::ResultError); out << "Failed " << pluralise(totals.testCases.failed, "test case") << ", " - "failed " << pluralise(totals.assertions.failed, "assertion") << '.'; + "failed " << pluralise(totals.assertions.failed, "assertion") << '.'; } else { Colour colour(Colour::ResultSuccess); out << @@ -15902,11 +15902,11 @@ class AssertionPrinter { AssertionPrinter& operator= (AssertionPrinter const&) = delete; AssertionPrinter(AssertionPrinter const&) = delete; AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) - : stream(_stream) - , result(_stats.assertionResult) - , messages(_stats.infoMessages) - , itMessage(_stats.infoMessages.begin()) - , printInfoMessages(_printInfoMessages) {} + : stream(_stream) + , result(_stats.assertionResult) + , messages(_stats.infoMessages) + , itMessage(_stats.infoMessages.begin()) + , printInfoMessages(_printInfoMessages) {} void print() { printSourceInfo(); @@ -15914,65 +15914,65 @@ class AssertionPrinter { itMessage = messages.begin(); switch (result.getResultType()) { - case ResultWas::Ok: - printResultType(Colour::ResultSuccess, passedString()); - printOriginalExpression(); - printReconstructedExpression(); - if (!result.hasExpression()) - printRemainingMessages(Colour::None); - else - printRemainingMessages(); - break; - case ResultWas::ExpressionFailed: - if (result.isOk()) - printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok")); - else - printResultType(Colour::Error, failedString()); - printOriginalExpression(); - printReconstructedExpression(); - printRemainingMessages(); - break; - case ResultWas::ThrewException: - printResultType(Colour::Error, failedString()); - printIssue("unexpected exception with message:"); - printMessage(); - printExpressionWas(); - printRemainingMessages(); - break; - case ResultWas::FatalErrorCondition: - printResultType(Colour::Error, failedString()); - printIssue("fatal error condition with message:"); - printMessage(); - printExpressionWas(); - printRemainingMessages(); - break; - case ResultWas::DidntThrowException: - printResultType(Colour::Error, failedString()); - printIssue("expected exception, got none"); - printExpressionWas(); - printRemainingMessages(); - break; - case ResultWas::Info: - printResultType(Colour::None, "info"); - printMessage(); - printRemainingMessages(); - break; - case ResultWas::Warning: - printResultType(Colour::None, "warning"); - printMessage(); + case ResultWas::Ok: + printResultType(Colour::ResultSuccess, passedString()); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else printRemainingMessages(); - break; - case ResultWas::ExplicitFailure: + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) + printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok")); + else printResultType(Colour::Error, failedString()); - printIssue("explicitly"); - printRemainingMessages(Colour::None); - break; - // These cases are here to prevent compiler warnings - case ResultWas::Unknown: - case ResultWas::FailureBit: - case ResultWas::Exception: - printResultType(Colour::Error, "** internal error **"); - break; + printOriginalExpression(); + printReconstructedExpression(); + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(Colour::Error, failedString()); + printIssue("unexpected exception with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(Colour::Error, failedString()); + printIssue("fatal error condition with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(Colour::Error, failedString()); + printIssue("expected exception, got none"); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType(Colour::None, "info"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType(Colour::None, "warning"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(Colour::Error, failedString()); + printIssue("explicitly"); + printRemainingMessages(Colour::None); + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + printResultType(Colour::Error, "** internal error **"); + break; } } @@ -16066,51 +16066,51 @@ class AssertionPrinter { } // anon namespace -std::string CompactReporter::getDescription() { - return "Reports test results on a single line, suitable for IDEs"; -} + std::string CompactReporter::getDescription() { + return "Reports test results on a single line, suitable for IDEs"; + } -void CompactReporter::noMatchingTestCases( std::string const& spec ) { - stream << "No test cases matched '" << spec << '\'' << std::endl; -} + void CompactReporter::noMatchingTestCases( std::string const& spec ) { + stream << "No test cases matched '" << spec << '\'' << std::endl; + } -void CompactReporter::assertionStarting( AssertionInfo const& ) {} + void CompactReporter::assertionStarting( AssertionInfo const& ) {} -bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { - AssertionResult const& result = _assertionStats.assertionResult; + bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { + AssertionResult const& result = _assertionStats.assertionResult; - bool printInfoMessages = true; + bool printInfoMessages = true; - // Drop out if result was successful and we're not printing those - if( !m_config->includeSuccessfulResults() && result.isOk() ) { - if( result.getResultType() != ResultWas::Warning ) - return false; - printInfoMessages = false; - } + // Drop out if result was successful and we're not printing those + if( !m_config->includeSuccessfulResults() && result.isOk() ) { + if( result.getResultType() != ResultWas::Warning ) + return false; + printInfoMessages = false; + } - AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); - printer.print(); + AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); + printer.print(); - stream << std::endl; - return true; -} + stream << std::endl; + return true; + } -void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { - double dur = _sectionStats.durationInSeconds; - if ( shouldShowDuration( *m_config, dur ) ) { - stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << std::endl; - } -} + void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { + double dur = _sectionStats.durationInSeconds; + if ( shouldShowDuration( *m_config, dur ) ) { + stream << getFormattedDuration( dur ) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + } -void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { - printTotals( stream, _testRunStats.totals ); - stream << '\n' << std::endl; - StreamingReporterBase::testRunEnded( _testRunStats ); -} + void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { + printTotals( stream, _testRunStats.totals ); + stream << '\n' << std::endl; + StreamingReporterBase::testRunEnded( _testRunStats ); + } -CompactReporter::~CompactReporter() {} + CompactReporter::~CompactReporter() {} -CATCH_REGISTER_REPORTER( "compact", CompactReporter ) + CATCH_REGISTER_REPORTER( "compact", CompactReporter ) } // end namespace Catch // end catch_reporter_compact.cpp @@ -16141,76 +16141,76 @@ class ConsoleAssertionPrinter { ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete; ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete; ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) - : stream(_stream), - stats(_stats), - result(_stats.assertionResult), - colour(Colour::None), - message(result.getMessage()), - messages(_stats.infoMessages), - printInfoMessages(_printInfoMessages) { + : stream(_stream), + stats(_stats), + result(_stats.assertionResult), + colour(Colour::None), + message(result.getMessage()), + messages(_stats.infoMessages), + printInfoMessages(_printInfoMessages) { switch (result.getResultType()) { - case ResultWas::Ok: - colour = Colour::Success; - passOrFail = "PASSED"; - //if( result.hasMessage() ) - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; - break; - case ResultWas::ExpressionFailed: - if (result.isOk()) { - colour = Colour::Success; - passOrFail = "FAILED - but was ok"; - } else { - colour = Colour::Error; - passOrFail = "FAILED"; - } - if (_stats.infoMessages.size() == 1) - messageLabel = "with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "with messages"; - break; - case ResultWas::ThrewException: - colour = Colour::Error; - passOrFail = "FAILED"; - messageLabel = "due to unexpected exception with "; - if (_stats.infoMessages.size() == 1) - messageLabel += "message"; - if (_stats.infoMessages.size() > 1) - messageLabel += "messages"; - break; - case ResultWas::FatalErrorCondition: - colour = Colour::Error; - passOrFail = "FAILED"; - messageLabel = "due to a fatal error condition"; - break; - case ResultWas::DidntThrowException: - colour = Colour::Error; - passOrFail = "FAILED"; - messageLabel = "because no exception was thrown where one was expected"; - break; - case ResultWas::Info: - messageLabel = "info"; - break; - case ResultWas::Warning: - messageLabel = "warning"; - break; - case ResultWas::ExplicitFailure: - passOrFail = "FAILED"; - colour = Colour::Error; - if (_stats.infoMessages.size() == 1) - messageLabel = "explicitly with message"; - if (_stats.infoMessages.size() > 1) - messageLabel = "explicitly with messages"; - break; - // These cases are here to prevent compiler warnings - case ResultWas::Unknown: - case ResultWas::FailureBit: - case ResultWas::Exception: - passOrFail = "** internal error **"; + case ResultWas::Ok: + colour = Colour::Success; + passOrFail = "PASSED"; + //if( result.hasMessage() ) + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) { + colour = Colour::Success; + passOrFail = "FAILED - but was ok"; + } else { colour = Colour::Error; - break; + passOrFail = "FAILED"; + } + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ThrewException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to unexpected exception with "; + if (_stats.infoMessages.size() == 1) + messageLabel += "message"; + if (_stats.infoMessages.size() > 1) + messageLabel += "messages"; + break; + case ResultWas::FatalErrorCondition: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to a fatal error condition"; + break; + case ResultWas::DidntThrowException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "because no exception was thrown where one was expected"; + break; + case ResultWas::Info: + messageLabel = "info"; + break; + case ResultWas::Warning: + messageLabel = "warning"; + break; + case ResultWas::ExplicitFailure: + passOrFail = "FAILED"; + colour = Colour::Error; + if (_stats.infoMessages.size() == 1) + messageLabel = "explicitly with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "explicitly with messages"; + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + passOrFail = "** internal error **"; + colour = Colour::Error; + break; } } @@ -16315,8 +16315,8 @@ class Duration { public: explicit Duration(double inNanoseconds, Unit units = Unit::Auto) - : m_inNanoseconds(inNanoseconds), - m_units(units) { + : m_inNanoseconds(inNanoseconds), + m_units(units) { if (m_units == Unit::Auto) { if (m_inNanoseconds < s_nanosecondsInAMicrosecond) m_units = Unit::Nanoseconds; @@ -16334,32 +16334,32 @@ class Duration { auto value() const -> double { switch (m_units) { - case Unit::Microseconds: - return m_inNanoseconds / static_cast(s_nanosecondsInAMicrosecond); - case Unit::Milliseconds: - return m_inNanoseconds / static_cast(s_nanosecondsInAMillisecond); - case Unit::Seconds: - return m_inNanoseconds / static_cast(s_nanosecondsInASecond); - case Unit::Minutes: - return m_inNanoseconds / static_cast(s_nanosecondsInAMinute); - default: - return m_inNanoseconds; + case Unit::Microseconds: + return m_inNanoseconds / static_cast(s_nanosecondsInAMicrosecond); + case Unit::Milliseconds: + return m_inNanoseconds / static_cast(s_nanosecondsInAMillisecond); + case Unit::Seconds: + return m_inNanoseconds / static_cast(s_nanosecondsInASecond); + case Unit::Minutes: + return m_inNanoseconds / static_cast(s_nanosecondsInAMinute); + default: + return m_inNanoseconds; } } auto unitsAsString() const -> std::string { switch (m_units) { - case Unit::Nanoseconds: - return "ns"; - case Unit::Microseconds: - return "us"; - case Unit::Milliseconds: - return "ms"; - case Unit::Seconds: - return "s"; - case Unit::Minutes: - return "m"; - default: - return "** internal error **"; + case Unit::Nanoseconds: + return "ns"; + case Unit::Microseconds: + return "us"; + case Unit::Milliseconds: + return "ms"; + case Unit::Seconds: + return "s"; + case Unit::Minutes: + return "m"; + default: + return "** internal error **"; } } @@ -16378,8 +16378,8 @@ class TablePrinter { public: TablePrinter( std::ostream& os, std::vector columnInfos ) - : m_os( os ), - m_columnInfos( std::move( columnInfos ) ) {} + : m_os( os ), + m_columnInfos( std::move( columnInfos ) ) {} auto columnInfos() const -> std::vector const& { return m_columnInfos; @@ -16390,13 +16390,13 @@ class TablePrinter { m_isOpen = true; *this << RowBreak(); - Columns headerCols; - Spacer spacer(2); - for (auto const& info : m_columnInfos) { - headerCols += Column(info.name).width(static_cast(info.width - 2)); - headerCols += spacer; - } - m_os << headerCols << '\n'; + Columns headerCols; + Spacer spacer(2); + for (auto const& info : m_columnInfos) { + headerCols += Column(info.name).width(static_cast(info.width - 2)); + headerCols += spacer; + } + m_os << headerCols << '\n'; m_os << Catch::getLineOfChars<'-'>() << '\n'; } @@ -16428,8 +16428,8 @@ class TablePrinter { auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; auto padding = (strSize + 1 < static_cast(colInfo.width)) - ? std::string(colInfo.width - (strSize + 1), ' ') - : std::string(); + ? std::string(colInfo.width - (strSize + 1), ' ') + : std::string(); if (colInfo.justification == ColumnInfo::Left) tp.m_os << colStr << padding << ' '; else @@ -16447,28 +16447,28 @@ class TablePrinter { }; ConsoleReporter::ConsoleReporter(ReporterConfig const& config) - : StreamingReporterBase(config), - m_tablePrinter(new TablePrinter(config.stream(), - [&config]() -> std::vector { - if (config.fullConfig()->benchmarkNoAnalysis()) - { - return{ - { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, ColumnInfo::Left }, - { " samples", 14, ColumnInfo::Right }, - { " iterations", 14, ColumnInfo::Right }, - { " mean", 14, ColumnInfo::Right } - }; - } - else - { - return{ - { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, ColumnInfo::Left }, - { "samples mean std dev", 14, ColumnInfo::Right }, - { "iterations low mean low std dev", 14, ColumnInfo::Right }, - { "estimated high mean high std dev", 14, ColumnInfo::Right } - }; - } - }())) {} + : StreamingReporterBase(config), + m_tablePrinter(new TablePrinter(config.stream(), + [&config]() -> std::vector { + if (config.fullConfig()->benchmarkNoAnalysis()) + { + return{ + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, ColumnInfo::Left }, + { " samples", 14, ColumnInfo::Right }, + { " iterations", 14, ColumnInfo::Right }, + { " mean", 14, ColumnInfo::Right } + }; + } + else + { + return{ + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 43, ColumnInfo::Left }, + { "samples mean std dev", 14, ColumnInfo::Right }, + { "iterations low mean low std dev", 14, ColumnInfo::Right }, + { "estimated high mean high std dev", 14, ColumnInfo::Right } + }; + } + }())) {} ConsoleReporter::~ConsoleReporter() = default; std::string ConsoleReporter::getDescription() { @@ -16623,8 +16623,8 @@ void ConsoleReporter::lazyPrintRunInfo() { stream << '\n' << getLineOfChars<'~'>() << '\n'; Colour colour(Colour::SecondaryText); stream << currentTestRunInfo->name - << " is a Catch v" << libraryVersion() << " host application.\n" - << "Run with -? for options\n\n"; + << " is a Catch v" << libraryVersion() << " host application.\n" + << "Run with -? for options\n\n"; if (m_config->rngSeed() != 0) stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; @@ -16645,8 +16645,8 @@ void ConsoleReporter::printTestCaseAndSectionHeader() { Colour colourGuard(Colour::Headers); auto - it = m_sectionStack.begin() + 1, // Skip first section (test case) - itEnd = m_sectionStack.end(); + it = m_sectionStack.begin() + 1, // Skip first section (test case) + itEnd = m_sectionStack.end(); for (; it != itEnd; ++it) printHeaderString(it->name, 2); } @@ -16685,8 +16685,8 @@ void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t struct SummaryColumn { SummaryColumn( std::string _label, Colour::Code _colour ) - : label( std::move( _label ) ), - colour( _colour ) {} + : label( std::move( _label ) ), + colour( _colour ) {} SummaryColumn addRow( std::size_t count ) { ReusableStringStream rss; rss << count; @@ -16713,24 +16713,24 @@ void ConsoleReporter::printTotals( Totals const& totals ) { } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { stream << Colour(Colour::ResultSuccess) << "All tests passed"; stream << " (" - << pluralise(totals.assertions.passed, "assertion") << " in " - << pluralise(totals.testCases.passed, "test case") << ')' - << '\n'; + << pluralise(totals.assertions.passed, "assertion") << " in " + << pluralise(totals.testCases.passed, "test case") << ')' + << '\n'; } else { std::vector columns; columns.push_back(SummaryColumn("", Colour::None) - .addRow(totals.testCases.total()) - .addRow(totals.assertions.total())); + .addRow(totals.testCases.total()) + .addRow(totals.assertions.total())); columns.push_back(SummaryColumn("passed", Colour::Success) - .addRow(totals.testCases.passed) - .addRow(totals.assertions.passed)); + .addRow(totals.testCases.passed) + .addRow(totals.assertions.passed)); columns.push_back(SummaryColumn("failed", Colour::ResultError) - .addRow(totals.testCases.failed) - .addRow(totals.assertions.failed)); + .addRow(totals.testCases.failed) + .addRow(totals.assertions.failed)); columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) - .addRow(totals.testCases.failedButOk) - .addRow(totals.assertions.failedButOk)); + .addRow(totals.testCases.failedButOk) + .addRow(totals.assertions.failedButOk)); printSummaryRow("test cases", columns, 0); printSummaryRow("assertions", columns, 1); @@ -16748,7 +16748,7 @@ void ConsoleReporter::printSummaryRow(std::string const& label, std::vector &tags) { - auto it = std::find_if(begin(tags), - end(tags), - [] (std::string const& tag) {return tag.front() == '#'; }); - if (it != tags.end()) - return it->substr(1); - return std::string(); -} + std::string fileNameTag(const std::vector &tags) { + auto it = std::find_if(begin(tags), + end(tags), + [] (std::string const& tag) {return tag.front() == '#'; }); + if (it != tags.end()) + return it->substr(1); + return std::string(); + } -// Formats the duration in seconds to 3 decimal places. -// This is done because some genius defined Maven Surefire schema -// in a way that only accepts 3 decimal places, and tools like -// Jenkins use that schema for validation JUnit reporter output. -std::string formatDuration( double seconds ) { - ReusableStringStream rss; - rss << std::fixed << std::setprecision( 3 ) << seconds; - return rss.str(); -} + // Formats the duration in seconds to 3 decimal places. + // This is done because some genius defined Maven Surefire schema + // in a way that only accepts 3 decimal places, and tools like + // Jenkins use that schema for validation JUnit reporter output. + std::string formatDuration( double seconds ) { + ReusableStringStream rss; + rss << std::fixed << std::setprecision( 3 ) << seconds; + return rss.str(); + } -} // anonymous namespace + } // anonymous namespace -JunitReporter::JunitReporter( ReporterConfig const& _config ) + JunitReporter::JunitReporter( ReporterConfig const& _config ) : CumulativeReporterBase( _config ), xml( _config.stream() ) -{ - m_reporterPrefs.shouldRedirectStdOut = true; - m_reporterPrefs.shouldReportAllAssertions = true; -} + { + m_reporterPrefs.shouldRedirectStdOut = true; + m_reporterPrefs.shouldReportAllAssertions = true; + } -JunitReporter::~JunitReporter() {} + JunitReporter::~JunitReporter() {} -std::string JunitReporter::getDescription() { - return "Reports test results in an XML format that looks like Ant's junitreport target"; -} + std::string JunitReporter::getDescription() { + return "Reports test results in an XML format that looks like Ant's junitreport target"; + } -void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {} + void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {} -void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) { - CumulativeReporterBase::testRunStarting( runInfo ); - xml.startElement( "testsuites" ); -} + void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) { + CumulativeReporterBase::testRunStarting( runInfo ); + xml.startElement( "testsuites" ); + } -void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) { - suiteTimer.start(); - stdOutForSuite.clear(); - stdErrForSuite.clear(); - unexpectedExceptions = 0; - CumulativeReporterBase::testGroupStarting( groupInfo ); -} + void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) { + suiteTimer.start(); + stdOutForSuite.clear(); + stdErrForSuite.clear(); + unexpectedExceptions = 0; + CumulativeReporterBase::testGroupStarting( groupInfo ); + } -void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) { - m_okToFail = testCaseInfo.okToFail(); -} + void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) { + m_okToFail = testCaseInfo.okToFail(); + } -bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) { - if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) - unexpectedExceptions++; - return CumulativeReporterBase::assertionEnded( assertionStats ); -} + bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) { + if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) + unexpectedExceptions++; + return CumulativeReporterBase::assertionEnded( assertionStats ); + } -void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - stdOutForSuite += testCaseStats.stdOut; - stdErrForSuite += testCaseStats.stdErr; - CumulativeReporterBase::testCaseEnded( testCaseStats ); -} + void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + stdOutForSuite += testCaseStats.stdOut; + stdErrForSuite += testCaseStats.stdErr; + CumulativeReporterBase::testCaseEnded( testCaseStats ); + } -void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - double suiteTime = suiteTimer.getElapsedSeconds(); - CumulativeReporterBase::testGroupEnded( testGroupStats ); - writeGroup( *m_testGroups.back(), suiteTime ); -} + void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + double suiteTime = suiteTimer.getElapsedSeconds(); + CumulativeReporterBase::testGroupEnded( testGroupStats ); + writeGroup( *m_testGroups.back(), suiteTime ); + } -void JunitReporter::testRunEndedCumulative() { - xml.endElement(); -} + void JunitReporter::testRunEndedCumulative() { + xml.endElement(); + } -void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) { - XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); - - TestGroupStats const& stats = groupNode.value; - xml.writeAttribute( "name", stats.groupInfo.name ); - xml.writeAttribute( "errors", unexpectedExceptions ); - xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions ); - xml.writeAttribute( "tests", stats.totals.assertions.total() ); - xml.writeAttribute( "hostname", "tbd" ); // !TBD - if( m_config->showDurations() == ShowDurations::Never ) - xml.writeAttribute( "time", "" ); - else - xml.writeAttribute( "time", formatDuration( suiteTime ) ); - xml.writeAttribute( "timestamp", getCurrentTimestamp() ); - - // Write properties if there are any - if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { - auto properties = xml.scopedElement("properties"); - if (m_config->hasTestFilters()) { - xml.scopedElement("property") + void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); + + TestGroupStats const& stats = groupNode.value; + xml.writeAttribute( "name", stats.groupInfo.name ); + xml.writeAttribute( "errors", unexpectedExceptions ); + xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions ); + xml.writeAttribute( "tests", stats.totals.assertions.total() ); + xml.writeAttribute( "hostname", "tbd" ); // !TBD + if( m_config->showDurations() == ShowDurations::Never ) + xml.writeAttribute( "time", "" ); + else + xml.writeAttribute( "time", formatDuration( suiteTime ) ); + xml.writeAttribute( "timestamp", getCurrentTimestamp() ); + + // Write properties if there are any + if (m_config->hasTestFilters() || m_config->rngSeed() != 0) { + auto properties = xml.scopedElement("properties"); + if (m_config->hasTestFilters()) { + xml.scopedElement("property") .writeAttribute("name", "filters") .writeAttribute("value", serializeFilters(m_config->getTestsOrTags())); - } - if (m_config->rngSeed() != 0) { - xml.scopedElement("property") + } + if (m_config->rngSeed() != 0) { + xml.scopedElement("property") .writeAttribute("name", "random-seed") .writeAttribute("value", m_config->rngSeed()); + } } + + // Write test cases + for( auto const& child : groupNode.children ) + writeTestCase( *child ); + + xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline ); + xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), XmlFormatting::Newline ); } - // Write test cases - for( auto const& child : groupNode.children ) - writeTestCase( *child ); + void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) { + TestCaseStats const& stats = testCaseNode.value; - xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), XmlFormatting::Newline ); - xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), XmlFormatting::Newline ); -} + // All test cases have exactly one section - which represents the + // test case itself. That section may have 0-n nested sections + assert( testCaseNode.children.size() == 1 ); + SectionNode const& rootSection = *testCaseNode.children.front(); -void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) { - TestCaseStats const& stats = testCaseNode.value; + std::string className = stats.testInfo.className; - // All test cases have exactly one section - which represents the - // test case itself. That section may have 0-n nested sections - assert( testCaseNode.children.size() == 1 ); - SectionNode const& rootSection = *testCaseNode.children.front(); + if( className.empty() ) { + className = fileNameTag(stats.testInfo.tags); + if ( className.empty() ) + className = "global"; + } - std::string className = stats.testInfo.className; + if ( !m_config->name().empty() ) + className = m_config->name() + "." + className; - if( className.empty() ) { - className = fileNameTag(stats.testInfo.tags); - if ( className.empty() ) - className = "global"; + writeSection( className, "", rootSection, stats.testInfo.okToFail() ); } - if ( !m_config->name().empty() ) - className = m_config->name() + "." + className; - - writeSection( className, "", rootSection, stats.testInfo.okToFail() ); -} + void JunitReporter::writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode, + bool testOkToFail) { + std::string name = trim( sectionNode.stats.sectionInfo.name ); + if( !rootName.empty() ) + name = rootName + '/' + name; -void JunitReporter::writeSection( std::string const& className, - std::string const& rootName, - SectionNode const& sectionNode, - bool testOkToFail) { - std::string name = trim( sectionNode.stats.sectionInfo.name ); - if( !rootName.empty() ) - name = rootName + '/' + name; - - if( !sectionNode.assertions.empty() || - !sectionNode.stdOut.empty() || - !sectionNode.stdErr.empty() ) { - XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); - if( className.empty() ) { - xml.writeAttribute( "classname", name ); - xml.writeAttribute( "name", "root" ); - } - else { - xml.writeAttribute( "classname", className ); - xml.writeAttribute( "name", name ); - } - xml.writeAttribute( "time", formatDuration( sectionNode.stats.durationInSeconds ) ); - // This is not ideal, but it should be enough to mimic gtest's - // junit output. - // Ideally the JUnit reporter would also handle `skipTest` - // events and write those out appropriately. - xml.writeAttribute( "status", "run" ); - - if (sectionNode.stats.assertions.failedButOk) { - xml.scopedElement("skipped") + if( !sectionNode.assertions.empty() || + !sectionNode.stdOut.empty() || + !sectionNode.stdErr.empty() ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); + if( className.empty() ) { + xml.writeAttribute( "classname", name ); + xml.writeAttribute( "name", "root" ); + } + else { + xml.writeAttribute( "classname", className ); + xml.writeAttribute( "name", name ); + } + xml.writeAttribute( "time", formatDuration( sectionNode.stats.durationInSeconds ) ); + // This is not ideal, but it should be enough to mimic gtest's + // junit output. + // Ideally the JUnit reporter would also handle `skipTest` + // events and write those out appropriately. + xml.writeAttribute( "status", "run" ); + + if (sectionNode.stats.assertions.failedButOk) { + xml.scopedElement("skipped") .writeAttribute("message", "TEST_CASE tagged with !mayfail"); - } + } - writeAssertions( sectionNode ); + writeAssertions( sectionNode ); - if( !sectionNode.stdOut.empty() ) - xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); - if( !sectionNode.stdErr.empty() ) - xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline ); + if( !sectionNode.stdOut.empty() ) + xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), XmlFormatting::Newline ); + if( !sectionNode.stdErr.empty() ) + xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), XmlFormatting::Newline ); + } + for( auto const& childNode : sectionNode.childSections ) + if( className.empty() ) + writeSection( name, "", *childNode, testOkToFail ); + else + writeSection( className, name, *childNode, testOkToFail ); } - for( auto const& childNode : sectionNode.childSections ) - if( className.empty() ) - writeSection( name, "", *childNode, testOkToFail ); - else - writeSection( className, name, *childNode, testOkToFail ); -} -void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { - for( auto const& assertion : sectionNode.assertions ) - writeAssertion( assertion ); -} + void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { + for( auto const& assertion : sectionNode.assertions ) + writeAssertion( assertion ); + } -void JunitReporter::writeAssertion( AssertionStats const& stats ) { - AssertionResult const& result = stats.assertionResult; - if( !result.isOk() ) { - std::string elementName; - switch( result.getResultType() ) { - case ResultWas::ThrewException: - case ResultWas::FatalErrorCondition: - elementName = "error"; - break; - case ResultWas::ExplicitFailure: - case ResultWas::ExpressionFailed: - case ResultWas::DidntThrowException: - elementName = "failure"; - break; + void JunitReporter::writeAssertion( AssertionStats const& stats ) { + AssertionResult const& result = stats.assertionResult; + if( !result.isOk() ) { + std::string elementName; + switch( result.getResultType() ) { + case ResultWas::ThrewException: + case ResultWas::FatalErrorCondition: + elementName = "error"; + break; + case ResultWas::ExplicitFailure: + case ResultWas::ExpressionFailed: + case ResultWas::DidntThrowException: + elementName = "failure"; + break; // We should never see these here: - case ResultWas::Info: - case ResultWas::Warning: - case ResultWas::Ok: - case ResultWas::Unknown: - case ResultWas::FailureBit: - case ResultWas::Exception: - elementName = "internalError"; - break; - } + case ResultWas::Info: + case ResultWas::Warning: + case ResultWas::Ok: + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + elementName = "internalError"; + break; + } - XmlWriter::ScopedElement e = xml.scopedElement( elementName ); + XmlWriter::ScopedElement e = xml.scopedElement( elementName ); - xml.writeAttribute( "message", result.getExpression() ); - xml.writeAttribute( "type", result.getTestMacroName() ); + xml.writeAttribute( "message", result.getExpression() ); + xml.writeAttribute( "type", result.getTestMacroName() ); - ReusableStringStream rss; - if (stats.totals.assertions.total() > 0) { - rss << "FAILED" << ":\n"; - if (result.hasExpression()) { - rss << " "; - rss << result.getExpressionInMacro(); + ReusableStringStream rss; + if (stats.totals.assertions.total() > 0) { + rss << "FAILED" << ":\n"; + if (result.hasExpression()) { + rss << " "; + rss << result.getExpressionInMacro(); + rss << '\n'; + } + if (result.hasExpandedExpression()) { + rss << "with expansion:\n"; + rss << Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } else { rss << '\n'; } - if (result.hasExpandedExpression()) { - rss << "with expansion:\n"; - rss << Column(result.getExpandedExpression()).indent(2) << '\n'; - } - } else { - rss << '\n'; - } - if( !result.getMessage().empty() ) - rss << result.getMessage() << '\n'; - for( auto const& msg : stats.infoMessages ) - if( msg.type == ResultWas::Info ) - rss << msg.message << '\n'; + if( !result.getMessage().empty() ) + rss << result.getMessage() << '\n'; + for( auto const& msg : stats.infoMessages ) + if( msg.type == ResultWas::Info ) + rss << msg.message << '\n'; - rss << "at " << result.getSourceInfo(); - xml.writeText( rss.str(), XmlFormatting::Newline ); + rss << "at " << result.getSourceInfo(); + xml.writeText( rss.str(), XmlFormatting::Newline ); + } } -} -CATCH_REGISTER_REPORTER( "junit", JunitReporter ) + CATCH_REGISTER_REPORTER( "junit", JunitReporter ) } // end namespace Catch // end catch_reporter_junit.cpp @@ -17090,45 +17090,45 @@ CATCH_REGISTER_REPORTER( "junit", JunitReporter ) namespace Catch { -ListeningReporter::ListeningReporter() { - // We will assume that listeners will always want all assertions - m_preferences.shouldReportAllAssertions = true; -} + ListeningReporter::ListeningReporter() { + // We will assume that listeners will always want all assertions + m_preferences.shouldReportAllAssertions = true; + } -void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { - m_listeners.push_back( std::move( listener ) ); -} + void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { + m_listeners.push_back( std::move( listener ) ); + } -void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { - assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); - m_reporter = std::move( reporter ); - m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; -} + void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { + assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); + m_reporter = std::move( reporter ); + m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; + } -ReporterPreferences ListeningReporter::getPreferences() const { - return m_preferences; -} + ReporterPreferences ListeningReporter::getPreferences() const { + return m_preferences; + } -std::set ListeningReporter::getSupportedVerbosities() { - return std::set{ }; -} + std::set ListeningReporter::getSupportedVerbosities() { + return std::set{ }; + } -void ListeningReporter::noMatchingTestCases( std::string const& spec ) { - for ( auto const& listener : m_listeners ) { - listener->noMatchingTestCases( spec ); + void ListeningReporter::noMatchingTestCases( std::string const& spec ) { + for ( auto const& listener : m_listeners ) { + listener->noMatchingTestCases( spec ); + } + m_reporter->noMatchingTestCases( spec ); } - m_reporter->noMatchingTestCases( spec ); -} -void ListeningReporter::reportInvalidArguments(std::string const&arg){ - for ( auto const& listener : m_listeners ) { - listener->reportInvalidArguments( arg ); + void ListeningReporter::reportInvalidArguments(std::string const&arg){ + for ( auto const& listener : m_listeners ) { + listener->reportInvalidArguments( arg ); + } + m_reporter->reportInvalidArguments( arg ); } - m_reporter->reportInvalidArguments( arg ); -} #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) -void ListeningReporter::benchmarkPreparing( std::string const& name ) { + void ListeningReporter::benchmarkPreparing( std::string const& name ) { for (auto const& listener : m_listeners) { listener->benchmarkPreparing(name); } @@ -17155,87 +17155,87 @@ void ListeningReporter::benchmarkPreparing( std::string const& name ) { } #endif // CATCH_CONFIG_ENABLE_BENCHMARKING -void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testRunStarting( testRunInfo ); + void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testRunStarting( testRunInfo ); + } + m_reporter->testRunStarting( testRunInfo ); } - m_reporter->testRunStarting( testRunInfo ); -} -void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testGroupStarting( groupInfo ); + void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupStarting( groupInfo ); + } + m_reporter->testGroupStarting( groupInfo ); } - m_reporter->testGroupStarting( groupInfo ); -} -void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { - for ( auto const& listener : m_listeners ) { - listener->testCaseStarting( testInfo ); + void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseStarting( testInfo ); + } + m_reporter->testCaseStarting( testInfo ); } - m_reporter->testCaseStarting( testInfo ); -} -void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { - for ( auto const& listener : m_listeners ) { - listener->sectionStarting( sectionInfo ); + void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->sectionStarting( sectionInfo ); + } + m_reporter->sectionStarting( sectionInfo ); } - m_reporter->sectionStarting( sectionInfo ); -} -void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { - for ( auto const& listener : m_listeners ) { - listener->assertionStarting( assertionInfo ); + void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->assertionStarting( assertionInfo ); + } + m_reporter->assertionStarting( assertionInfo ); } - m_reporter->assertionStarting( assertionInfo ); -} -// The return value indicates if the messages buffer should be cleared: -bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { - for( auto const& listener : m_listeners ) { - static_cast( listener->assertionEnded( assertionStats ) ); + // The return value indicates if the messages buffer should be cleared: + bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { + for( auto const& listener : m_listeners ) { + static_cast( listener->assertionEnded( assertionStats ) ); + } + return m_reporter->assertionEnded( assertionStats ); } - return m_reporter->assertionEnded( assertionStats ); -} -void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { - for ( auto const& listener : m_listeners ) { - listener->sectionEnded( sectionStats ); + void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { + for ( auto const& listener : m_listeners ) { + listener->sectionEnded( sectionStats ); + } + m_reporter->sectionEnded( sectionStats ); } - m_reporter->sectionEnded( sectionStats ); -} -void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - for ( auto const& listener : m_listeners ) { - listener->testCaseEnded( testCaseStats ); + void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseEnded( testCaseStats ); + } + m_reporter->testCaseEnded( testCaseStats ); } - m_reporter->testCaseEnded( testCaseStats ); -} -void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - for ( auto const& listener : m_listeners ) { - listener->testGroupEnded( testGroupStats ); + void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupEnded( testGroupStats ); + } + m_reporter->testGroupEnded( testGroupStats ); } - m_reporter->testGroupEnded( testGroupStats ); -} -void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { - for ( auto const& listener : m_listeners ) { - listener->testRunEnded( testRunStats ); + void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { + for ( auto const& listener : m_listeners ) { + listener->testRunEnded( testRunStats ); + } + m_reporter->testRunEnded( testRunStats ); } - m_reporter->testRunEnded( testRunStats ); -} -void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { - for ( auto const& listener : m_listeners ) { - listener->skipTest( testInfo ); + void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->skipTest( testInfo ); + } + m_reporter->skipTest( testInfo ); } - m_reporter->skipTest( testInfo ); -} -bool ListeningReporter::isMulti() const { - return true; -} + bool ListeningReporter::isMulti() const { + return true; + } } // end namespace Catch // end catch_reporter_listening.cpp @@ -17249,215 +17249,215 @@ bool ListeningReporter::isMulti() const { #endif namespace Catch { -XmlReporter::XmlReporter( ReporterConfig const& _config ) - : StreamingReporterBase( _config ), - m_xml(_config.stream()) -{ - m_reporterPrefs.shouldRedirectStdOut = true; - m_reporterPrefs.shouldReportAllAssertions = true; -} + XmlReporter::XmlReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ), + m_xml(_config.stream()) + { + m_reporterPrefs.shouldRedirectStdOut = true; + m_reporterPrefs.shouldReportAllAssertions = true; + } -XmlReporter::~XmlReporter() = default; + XmlReporter::~XmlReporter() = default; -std::string XmlReporter::getDescription() { - return "Reports test results as an XML document"; -} + std::string XmlReporter::getDescription() { + return "Reports test results as an XML document"; + } -std::string XmlReporter::getStylesheetRef() const { - return std::string(); -} + std::string XmlReporter::getStylesheetRef() const { + return std::string(); + } -void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) { - m_xml + void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) { + m_xml .writeAttribute( "filename", sourceInfo.file ) .writeAttribute( "line", sourceInfo.line ); -} + } -void XmlReporter::noMatchingTestCases( std::string const& s ) { - StreamingReporterBase::noMatchingTestCases( s ); -} + void XmlReporter::noMatchingTestCases( std::string const& s ) { + StreamingReporterBase::noMatchingTestCases( s ); + } -void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) { - StreamingReporterBase::testRunStarting( testInfo ); - std::string stylesheetRef = getStylesheetRef(); - if( !stylesheetRef.empty() ) - m_xml.writeStylesheetRef( stylesheetRef ); - m_xml.startElement( "Catch" ); - if( !m_config->name().empty() ) - m_xml.writeAttribute( "name", m_config->name() ); - if (m_config->testSpec().hasFilters()) - m_xml.writeAttribute( "filters", serializeFilters( m_config->getTestsOrTags() ) ); - if( m_config->rngSeed() != 0 ) - m_xml.scopedElement( "Randomness" ) + void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) { + StreamingReporterBase::testRunStarting( testInfo ); + std::string stylesheetRef = getStylesheetRef(); + if( !stylesheetRef.empty() ) + m_xml.writeStylesheetRef( stylesheetRef ); + m_xml.startElement( "Catch" ); + if( !m_config->name().empty() ) + m_xml.writeAttribute( "name", m_config->name() ); + if (m_config->testSpec().hasFilters()) + m_xml.writeAttribute( "filters", serializeFilters( m_config->getTestsOrTags() ) ); + if( m_config->rngSeed() != 0 ) + m_xml.scopedElement( "Randomness" ) .writeAttribute( "seed", m_config->rngSeed() ); -} + } -void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) { - StreamingReporterBase::testGroupStarting( groupInfo ); - m_xml.startElement( "Group" ) + void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) { + StreamingReporterBase::testGroupStarting( groupInfo ); + m_xml.startElement( "Group" ) .writeAttribute( "name", groupInfo.name ); -} + } -void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { - StreamingReporterBase::testCaseStarting(testInfo); - m_xml.startElement( "TestCase" ) + void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + StreamingReporterBase::testCaseStarting(testInfo); + m_xml.startElement( "TestCase" ) .writeAttribute( "name", trim( testInfo.name ) ) .writeAttribute( "description", testInfo.description ) .writeAttribute( "tags", testInfo.tagsAsString() ); - writeSourceInfo( testInfo.lineInfo ); + writeSourceInfo( testInfo.lineInfo ); - if ( m_config->showDurations() == ShowDurations::Always ) - m_testCaseTimer.start(); - m_xml.ensureTagClosed(); -} + if ( m_config->showDurations() == ShowDurations::Always ) + m_testCaseTimer.start(); + m_xml.ensureTagClosed(); + } -void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) { - StreamingReporterBase::sectionStarting( sectionInfo ); - if( m_sectionDepth++ > 0 ) { - m_xml.startElement( "Section" ) + void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) { + StreamingReporterBase::sectionStarting( sectionInfo ); + if( m_sectionDepth++ > 0 ) { + m_xml.startElement( "Section" ) .writeAttribute( "name", trim( sectionInfo.name ) ); - writeSourceInfo( sectionInfo.lineInfo ); - m_xml.ensureTagClosed(); + writeSourceInfo( sectionInfo.lineInfo ); + m_xml.ensureTagClosed(); + } } -} -void XmlReporter::assertionStarting( AssertionInfo const& ) { } + void XmlReporter::assertionStarting( AssertionInfo const& ) { } -bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { + bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { - AssertionResult const& result = assertionStats.assertionResult; + AssertionResult const& result = assertionStats.assertionResult; - bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); + bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); - if( includeResults || result.getResultType() == ResultWas::Warning ) { - // Print any info messages in tags. - for( auto const& msg : assertionStats.infoMessages ) { - if( msg.type == ResultWas::Info && includeResults ) { - m_xml.scopedElement( "Info" ) - .writeText( msg.message ); - } else if ( msg.type == ResultWas::Warning ) { - m_xml.scopedElement( "Warning" ) - .writeText( msg.message ); + if( includeResults || result.getResultType() == ResultWas::Warning ) { + // Print any info messages in tags. + for( auto const& msg : assertionStats.infoMessages ) { + if( msg.type == ResultWas::Info && includeResults ) { + m_xml.scopedElement( "Info" ) + .writeText( msg.message ); + } else if ( msg.type == ResultWas::Warning ) { + m_xml.scopedElement( "Warning" ) + .writeText( msg.message ); + } } } - } - // Drop out if result was successful but we're not printing them. - if( !includeResults && result.getResultType() != ResultWas::Warning ) - return true; + // Drop out if result was successful but we're not printing them. + if( !includeResults && result.getResultType() != ResultWas::Warning ) + return true; - // Print the expression if there is one. - if( result.hasExpression() ) { - m_xml.startElement( "Expression" ) + // Print the expression if there is one. + if( result.hasExpression() ) { + m_xml.startElement( "Expression" ) .writeAttribute( "success", result.succeeded() ) .writeAttribute( "type", result.getTestMacroName() ); - writeSourceInfo( result.getSourceInfo() ); + writeSourceInfo( result.getSourceInfo() ); - m_xml.scopedElement( "Original" ) + m_xml.scopedElement( "Original" ) .writeText( result.getExpression() ); - m_xml.scopedElement( "Expanded" ) + m_xml.scopedElement( "Expanded" ) .writeText( result.getExpandedExpression() ); - } + } - // And... Print a result applicable to each result type. - switch( result.getResultType() ) { - case ResultWas::ThrewException: - m_xml.startElement( "Exception" ); - writeSourceInfo( result.getSourceInfo() ); - m_xml.writeText( result.getMessage() ); - m_xml.endElement(); - break; - case ResultWas::FatalErrorCondition: - m_xml.startElement( "FatalErrorCondition" ); - writeSourceInfo( result.getSourceInfo() ); - m_xml.writeText( result.getMessage() ); - m_xml.endElement(); - break; - case ResultWas::Info: - m_xml.scopedElement( "Info" ) + // And... Print a result applicable to each result type. + switch( result.getResultType() ) { + case ResultWas::ThrewException: + m_xml.startElement( "Exception" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::FatalErrorCondition: + m_xml.startElement( "FatalErrorCondition" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::Info: + m_xml.scopedElement( "Info" ) .writeText( result.getMessage() ); - break; - case ResultWas::Warning: - // Warning will already have been written - break; - case ResultWas::ExplicitFailure: - m_xml.startElement( "Failure" ); - writeSourceInfo( result.getSourceInfo() ); - m_xml.writeText( result.getMessage() ); - m_xml.endElement(); - break; - default: - break; - } + break; + case ResultWas::Warning: + // Warning will already have been written + break; + case ResultWas::ExplicitFailure: + m_xml.startElement( "Failure" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + default: + break; + } - if( result.hasExpression() ) - m_xml.endElement(); + if( result.hasExpression() ) + m_xml.endElement(); - return true; -} + return true; + } -void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { - StreamingReporterBase::sectionEnded( sectionStats ); - if( --m_sectionDepth > 0 ) { - XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); - e.writeAttribute( "successes", sectionStats.assertions.passed ); - e.writeAttribute( "failures", sectionStats.assertions.failed ); - e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { + StreamingReporterBase::sectionEnded( sectionStats ); + if( --m_sectionDepth > 0 ) { + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes", sectionStats.assertions.passed ); + e.writeAttribute( "failures", sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); - if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); - m_xml.endElement(); + m_xml.endElement(); + } } -} -void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { - StreamingReporterBase::testCaseEnded( testCaseStats ); - XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); - e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); + void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + StreamingReporterBase::testCaseEnded( testCaseStats ); + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); + e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); - if ( m_config->showDurations() == ShowDurations::Always ) - e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); - if( !testCaseStats.stdOut.empty() ) - m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), XmlFormatting::Newline ); - if( !testCaseStats.stdErr.empty() ) - m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline ); + if( !testCaseStats.stdOut.empty() ) + m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), XmlFormatting::Newline ); + if( !testCaseStats.stdErr.empty() ) + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), XmlFormatting::Newline ); - m_xml.endElement(); -} + m_xml.endElement(); + } -void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { - StreamingReporterBase::testGroupEnded( testGroupStats ); - // TODO: Check testGroupStats.aborting and act accordingly. - m_xml.scopedElement( "OverallResults" ) + void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + StreamingReporterBase::testGroupEnded( testGroupStats ); + // TODO: Check testGroupStats.aborting and act accordingly. + m_xml.scopedElement( "OverallResults" ) .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); - m_xml.scopedElement( "OverallResultsCases") + m_xml.scopedElement( "OverallResultsCases") .writeAttribute( "successes", testGroupStats.totals.testCases.passed ) .writeAttribute( "failures", testGroupStats.totals.testCases.failed ) .writeAttribute( "expectedFailures", testGroupStats.totals.testCases.failedButOk ); - m_xml.endElement(); -} + m_xml.endElement(); + } -void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) { - StreamingReporterBase::testRunEnded( testRunStats ); - m_xml.scopedElement( "OverallResults" ) + void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) { + StreamingReporterBase::testRunEnded( testRunStats ); + m_xml.scopedElement( "OverallResults" ) .writeAttribute( "successes", testRunStats.totals.assertions.passed ) .writeAttribute( "failures", testRunStats.totals.assertions.failed ) .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); - m_xml.scopedElement( "OverallResultsCases") + m_xml.scopedElement( "OverallResultsCases") .writeAttribute( "successes", testRunStats.totals.testCases.passed ) .writeAttribute( "failures", testRunStats.totals.testCases.failed ) .writeAttribute( "expectedFailures", testRunStats.totals.testCases.failedButOk ); - m_xml.endElement(); -} + m_xml.endElement(); + } #if defined(CATCH_CONFIG_ENABLE_BENCHMARKING) -void XmlReporter::benchmarkPreparing(std::string const& name) { + void XmlReporter::benchmarkPreparing(std::string const& name) { m_xml.startElement("BenchmarkResults") .writeAttribute("name", name); } @@ -17501,7 +17501,7 @@ void XmlReporter::benchmarkPreparing(std::string const& name) { } #endif // CATCH_CONFIG_ENABLE_BENCHMARKING -CATCH_REGISTER_REPORTER( "xml", XmlReporter ) + CATCH_REGISTER_REPORTER( "xml", XmlReporter ) } // end namespace Catch @@ -17511,7 +17511,7 @@ CATCH_REGISTER_REPORTER( "xml", XmlReporter ) // end catch_reporter_xml.cpp namespace Catch { -LeakDetector leakDetector; + LeakDetector leakDetector; } #ifdef __clang__ @@ -17967,3 +17967,4 @@ using Catch::Detail::Approx; // end catch_reenable_warnings.h // end catch.hpp #endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED + diff --git a/test/plugins/test_testplugin.cpp b/test/plugins/test_testplugin.cpp index 9104115c..f09ec7a9 100755 --- a/test/plugins/test_testplugin.cpp +++ b/test/plugins/test_testplugin.cpp @@ -1599,9 +1599,10 @@ TEST_CASE( "Run errortest - test error reporting", "[plugins][TESTPLUGIN]" ) REQUIRE_THROWS_WITH( client.get("TESTPLUGIN::errortest(test=1)", ""), "[testplugin]: Test #1 of Error State Management\n[testplugin]: Test #1 of Error State Management\n" ); REQUIRE_THROWS_WITH( client.get("TESTPLUGIN::errortest(test=2)", ""), "[testplugin]: Test #2 of Error State Management\n[testplugin]: Test #2 of Error State Management\n" ); + #ifndef FATCLIENT // This test hard crashes the server code so can't be run in fat-client mode - REQUIRE_THROWS_WITH( client.get("TESTPLUGIN::errortest(test=3)", ""), "[idamClient]: Protocol 11 Error (Server Block #2)\n" ); + REQUIRE_THROWS_WITH( client.get("TESTPLUGIN::errortest(test=3)", ""), Catch::Contains("[idamClient]: Protocol 11 Error (Server Block #2)") ); #endif } From a02d419da731897431c57a2391855fe62a06e3bd Mon Sep 17 00:00:00 2001 From: sdixon Date: Fri, 13 Sep 2024 14:06:57 +0100 Subject: [PATCH 09/12] fixing c++ wrapper build for MSVC and also fixing the byte-ordering bug for double data in portablexdrlib for MSVC --- extlib/portablexdr-4.9.1/xdr_float.c | 4 ++-- extlib/portablexdr-4.9.1/xdr_stdio.c | 2 +- source/wrappers/c++/CMakeLists.txt | 2 +- source/wrappers/c++/structdata.hpp | 2 ++ 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/extlib/portablexdr-4.9.1/xdr_float.c b/extlib/portablexdr-4.9.1/xdr_float.c index 9dec57ed..fcd9e781 100644 --- a/extlib/portablexdr-4.9.1/xdr_float.c +++ b/extlib/portablexdr-4.9.1/xdr_float.c @@ -232,7 +232,7 @@ xdr_double(xdrs, dp) id.sign = vd.sign; lp = (long *)(void *)&id; #endif -#if defined(__CYGWIN32__) || defined(__MINGW32__) +#if defined(__CYGWIN32__) || defined(__MINGW32__) || defined(_WIN32) return (XDR_PUTLONG(xdrs, lp+1) && XDR_PUTLONG(xdrs, lp)); #else return (XDR_PUTLONG(xdrs, lp++) && XDR_PUTLONG(xdrs, lp)); @@ -241,7 +241,7 @@ xdr_double(xdrs, dp) case XDR_DECODE: #if !defined(vax) lp = (long *)dp; -#if defined(__CYGWIN32__) || defined(__MINGW32__) +#if defined(__CYGWIN32__) || defined(__MINGW32__) || defined(_WIN32) return (XDR_GETLONG(xdrs, lp+1) && XDR_GETLONG(xdrs, lp)); #else return (XDR_GETLONG(xdrs, lp++) && XDR_GETLONG(xdrs, lp)); diff --git a/extlib/portablexdr-4.9.1/xdr_stdio.c b/extlib/portablexdr-4.9.1/xdr_stdio.c index 390aea30..194e795d 100644 --- a/extlib/portablexdr-4.9.1/xdr_stdio.c +++ b/extlib/portablexdr-4.9.1/xdr_stdio.c @@ -54,7 +54,7 @@ static char sccsid[] = "@(#)xdr_stdio.c 1.16 87/08/11 Copyr 1984 Sun Micro"; #include "byteswap.h" -#if defined(__CYGWIN32__) || defined(__MINGW32__) +#if defined(__CYGWIN32__) || defined(__MINGW32__) || defined(_WIN32) #include #include unsigned int _CRT_fmode = _O_BINARY; diff --git a/source/wrappers/c++/CMakeLists.txt b/source/wrappers/c++/CMakeLists.txt index 90146495..8bf3ebe1 100755 --- a/source/wrappers/c++/CMakeLists.txt +++ b/source/wrappers/c++/CMakeLists.txt @@ -76,7 +76,7 @@ if( WIN32 OR MINGW ) if( MINGW ) set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dlfcn-win32::dl Iconv::Iconv liblzma::liblzma ZLIB::ZLIB crypt32 stdc++ ) else() - set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 dlfcn-win32::dl ) + set( LINK_LIB ${LINK_LIB} ${XDR_LIBRARIES} ws2_32 crypt32 dlfcn-win32::dl ) endif() elseif( TIRPC_FOUND ) set( LINK_LIB ${LINK_LIB} ${TIRPC_LIBRARIES} ) diff --git a/source/wrappers/c++/structdata.hpp b/source/wrappers/c++/structdata.hpp index 72ec506f..6a3c1019 100755 --- a/source/wrappers/c++/structdata.hpp +++ b/source/wrappers/c++/structdata.hpp @@ -35,6 +35,8 @@ class LIBRARY_API StructData { std::string tname = typeid(T).name(); #ifdef __GNUC__ std::string demangled_name(abi::__cxa_demangle(tname.c_str(), nullptr, nullptr, &status)); +#elif _MSC_VER && !__INTEL_COMPILER + std::string demangled_name = tname; #else char demangled[1024]; UnDecorateSymbolName(tname, demangled, sizeof(demangled), UNDNAME_COMPLETE); From 61a277c5be6a0c19696868f497d27acbd1285221 Mon Sep 17 00:00:00 2001 From: Jonathan Hollocombe Date: Tue, 17 Sep 2024 14:23:43 +0100 Subject: [PATCH 10/12] Fixing compilation issue in bytes plugin. --- source/plugins/bytes/bytesPlugin.cpp | 90 ++++++++++++++-------------- 1 file changed, 45 insertions(+), 45 deletions(-) diff --git a/source/plugins/bytes/bytesPlugin.cpp b/source/plugins/bytes/bytesPlugin.cpp index b6c2b232..78fd060d 100644 --- a/source/plugins/bytes/bytesPlugin.cpp +++ b/source/plugins/bytes/bytesPlugin.cpp @@ -20,30 +20,30 @@ namespace filesystem = std::filesystem; #include -static int do_help(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); +static int do_help(IDAM_PLUGIN_INTERFACE* plugin_interface); -static int do_version(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); +static int do_version(IDAM_PLUGIN_INTERFACE* plugin_interface); -static int do_builddate(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); +static int do_builddate(IDAM_PLUGIN_INTERFACE* plugin_interface); -static int do_defaultmethod(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); +static int do_defaultmethod(IDAM_PLUGIN_INTERFACE* plugin_interface); -static int do_maxinterfaceversion(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); +static int do_maxinterfaceversion(IDAM_PLUGIN_INTERFACE* plugin_interface); -static int do_read(IDAM_PLUGIN_INTERFACE* idam_plugin_interface); +static int do_read(IDAM_PLUGIN_INTERFACE* plugin_interface); -int bytesPlugin(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) +int bytesPlugin(IDAM_PLUGIN_INTERFACE* plugin_interface) { static int init = 0; //---------------------------------------------------------------------------------------- // Standard v1 Plugin Interface - if (idam_plugin_interface->interfaceVersion > THISPLUGIN_MAX_INTERFACE_VERSION) { + if (plugin_interface->interfaceVersion > THISPLUGIN_MAX_INTERFACE_VERSION) { RAISE_PLUGIN_ERROR("Plugin Interface Version Unknown to this plugin: Unable to execute the request!"); } - idam_plugin_interface->pluginVersion = THISPLUGIN_VERSION; + plugin_interface->pluginVersion = THISPLUGIN_VERSION; //---------------------------------------------------------------------------------------- // Heap Housekeeping @@ -59,9 +59,9 @@ int bytesPlugin(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) // A list must be maintained to register these plugin calls to manage housekeeping. // Calls to plugins must also respect access policy and user authentication policy - REQUEST_DATA* request = idam_plugin_interface->request_data; + REQUEST_DATA* request = plugin_interface->request_data; - if (idam_plugin_interface->housekeeping || STR_IEQUALS(request->function, "reset")) { + if (plugin_interface->housekeeping || STR_IEQUALS(request->function, "reset")) { if (!init) return 0; // Not previously initialised: Nothing to do! // Free Heap & reset counters init = 0; @@ -87,17 +87,17 @@ int bytesPlugin(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) // Standard methods: version, builddate, defaultmethod, maxinterfaceversion if (STR_IEQUALS(request->function, "help")) { - return do_help(idam_plugin_interface); + return do_help(plugin_interface); } else if (STR_IEQUALS(request->function, "version")) { - return do_version(idam_plugin_interface); + return do_version(plugin_interface); } else if (STR_IEQUALS(request->function, "builddate")) { - return do_builddate(idam_plugin_interface); + return do_builddate(plugin_interface); } else if (STR_IEQUALS(request->function, "defaultmethod")) { - return do_defaultmethod(idam_plugin_interface); + return do_defaultmethod(plugin_interface); } else if (STR_IEQUALS(request->function, "maxinterfaceversion")) { - return do_maxinterfaceversion(idam_plugin_interface); + return do_maxinterfaceversion(plugin_interface); } else if (STR_IEQUALS(request->function, "read")) { - return do_read(idam_plugin_interface); + return do_read(plugin_interface); } else { RAISE_PLUGIN_ERROR("Unknown function requested!"); } @@ -105,55 +105,55 @@ int bytesPlugin(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) /** * Help: A Description of library functionality - * @param idam_plugin_interface + * @param plugin_interface * @return */ -int do_help(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) +int do_help(IDAM_PLUGIN_INTERFACE* plugin_interface) { const char* help = "\nbytes: data reader to access files as a block of bytes without interpretation\n\n"; const char* desc = "bytes: help = description of this plugin"; - return setReturnDataString(idam_plugin_interface->data_block, help, desc); + return setReturnDataString(plugin_interface->data_block, help, desc); } /** * Plugin version - * @param idam_plugin_interface + * @param plugin_interface * @return */ -int do_version(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) +int do_version(IDAM_PLUGIN_INTERFACE* plugin_interface) { - return setReturnDataIntScalar(idam_plugin_interface->data_block, THISPLUGIN_VERSION, "Plugin version number"); + return setReturnDataIntScalar(plugin_interface->data_block, THISPLUGIN_VERSION, "Plugin version number"); } /** * Plugin Build Date - * @param idam_plugin_interface + * @param plugin_interface * @return */ -int do_builddate(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) +int do_builddate(IDAM_PLUGIN_INTERFACE* plugin_interface) { - return setReturnDataString(idam_plugin_interface->data_block, __DATE__, "Plugin build date"); + return setReturnDataString(plugin_interface->data_block, __DATE__, "Plugin build date"); } /** * Plugin Default Method - * @param idam_plugin_interface + * @param plugin_interface * @return */ -int do_defaultmethod(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) +int do_defaultmethod(IDAM_PLUGIN_INTERFACE* plugin_interface) { - return setReturnDataString(idam_plugin_interface->data_block, THISPLUGIN_DEFAULT_METHOD, "Plugin default method"); + return setReturnDataString(plugin_interface->data_block, THISPLUGIN_DEFAULT_METHOD, "Plugin default method"); } /** * Plugin Maximum Interface Version - * @param idam_plugin_interface + * @param plugin_interface * @return */ -int do_maxinterfaceversion(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) +int do_maxinterfaceversion(IDAM_PLUGIN_INTERFACE* plugin_interface) { - return setReturnDataIntScalar(idam_plugin_interface->data_block, THISPLUGIN_MAX_INTERFACE_VERSION, "Maximum Interface Version"); + return setReturnDataIntScalar(plugin_interface->data_block, THISPLUGIN_MAX_INTERFACE_VERSION, "Maximum Interface Version"); } //---------------------------------------------------------------------------------------- @@ -169,14 +169,15 @@ int check_allowed_path(const char* expandedPath) { UDA_LOG(UDA_LOG_DEBUG, "Filepath [%s] not found! Error: %s\n", full_path.c_str(), e.what()); RAISE_PLUGIN_ERROR("Provided File Path Not Found!\n"); } - char* env_str = std::getenv("UDA_BYTES_PLUGIN_ALLOWED_PATHS"); + const char* env_str = std::getenv("UDA_BYTES_PLUGIN_ALLOWED_PATHS"); std::vector allowed_paths; - if (env_str) { // gotta check if environment variable exists before using it - boost::split(allowed_paths, std::getenv("UDA_BYTES_PLUGIN_ALLOWED_PATHS"), boost::is_any_of(";")); + if (env_str) { + // gotta check if environment variable exists before using it + boost::split(allowed_paths, env_str, boost::is_any_of(";")); } bool good_path = false; - for (std::string allowed_path : allowed_paths) { - if (full_path.rfind(allowed_path.c_str(), 0) != std::string::npos) { + for (const auto& allowed_path : allowed_paths) { + if (full_path.rfind(allowed_path, 0) != std::string::npos) { good_path = true; break; } @@ -188,21 +189,20 @@ int check_allowed_path(const char* expandedPath) { return 0; } - -int do_read(IDAM_PLUGIN_INTERFACE* idam_plugin_interface) +int do_read(IDAM_PLUGIN_INTERFACE* plugin_interface) { - DATA_SOURCE* data_source = idam_plugin_interface->data_source; - SIGNAL_DESC* signal_desc = idam_plugin_interface->signal_desc; - DATA_BLOCK* data_block = idam_plugin_interface->data_block; + DATA_SOURCE* data_source = plugin_interface->data_source; + SIGNAL_DESC* signal_desc = plugin_interface->signal_desc; + DATA_BLOCK* data_block = plugin_interface->data_block; const char* path; - FIND_REQUIRED_STRING_VALUE(idam_plugin_interface->request_data->nameValueList, path); + FIND_REQUIRED_STRING_VALUE(plugin_interface->request_data->nameValueList, path); StringCopy(data_source->path, path, MAXPATH); - UDA_LOG(UDA_LOG_DEBUG, "expandEnvironmentvariables! \n"); + UDA_LOG(UDA_LOG_DEBUG, "expand_environment_variables! \n"); expand_environment_variables(data_source->path); check_allowed_path(data_source->path); - return readBytes(*data_source, *signal_desc, data_block, idam_plugin_interface->environment); + return readBytes(*data_source, *signal_desc, data_block, plugin_interface->environment); } From 90dce779008dd154d2f231d79fdd82f5bbe7f32b Mon Sep 17 00:00:00 2001 From: stephen-dixon <68229525+stephen-dixon@users.noreply.github.com> Date: Fri, 18 Oct 2024 15:48:05 +0100 Subject: [PATCH 11/12] Updating Docs (#48) * initial notes added to docs for installing clients * completing manual build instructions for the uda client for all platformsv of interest in the documentation * removing some old build instructions from readme.md and instead referencing updated instructions in the docs * updating readme * adding a new page 'api_changes' to the documentation * Fix typos in api_changes.md * Update client_installation.md --- README.md | 235 +++++------------------ docs/api_changes.md | 82 ++++++++ docs/client_installation.md | 347 +++++++++++++++++++++++++++++++++- docs/creating_plugins.md | 3 +- docs/development.md | 1 + docs/server_installation.md | 7 +- source/client/legacy_accAPI.h | 6 +- 7 files changed, 490 insertions(+), 191 deletions(-) create mode 100644 docs/api_changes.md diff --git a/README.md b/README.md index ebd7c986..1e2866fa 100755 --- a/README.md +++ b/README.md @@ -13,10 +13,6 @@ See LICENCE.txt for details. ## Getting UDA -UDA binaries can be downloaded from: - - - The source code can be downloaded from: https://github.com/ukaea/UDA/releases/ @@ -25,7 +21,17 @@ The UDA git repository can be cloned: git clone git@github.com:ukaea/UDA.git -## Building from source +## Getting the UDA client + +The easiest way to obtain the client is to pip install the python wrapper (pyuda), wheels are uploaded for every tagged release from version 2.7.6. Further details are available on [pypi](https://pypi.org/project/uda/). + +```sh +pip install uda +``` + +For any other use cases please see the documentation to build from source [here](https://ukaea.github.io/UDA/client_installation/). + +## Building UDA Server from source ### Dependencies @@ -35,184 +41,47 @@ UDA requires the following to avail in order to build: | --- | --- | --- | | cmake | \> 3.0 | | | OpenSSL | | | -| PostgreSQL | | | | LibXml2 | | | -| LibMemcached | | to enable caching | -| swig | 3.0.0 | Python & HTTP wrappers | -| python | \> 3.0 | Python & HTTP wrappers | +| libfmt | | | +| spdlog | | | +| capnproto | | | | boost | | C++, Python & HTTP wrappers | -| java | | Java wrapper | -| hdf5 | | hdf5 plugin | -| netcdf | | netcdf plugin | -| MDSplus | | MDS+ plugin | - -#### Windows - -> Note: If you want to use Visual Studio 2019 to compile UDA, please refer to sections [Visual Studio](#visual-studio) and [vcpkg](#vcpkg) below - -Building extlibs (running in Powershell): - - cd extlib - mkdir build - cd build - cmake.exe .. -G"MinGW Makefiles" -DBUILD_SHARED_LIBS=ON - mingw32-make.exe - cd .. - .\install.bat - -Building extlibs (running in MinGW64 Shell): - - cd extlib/portablexdr-4.9.1 - ./configure - make - cd .. - ./install.sh - -Building extlibs (running in VS2019 x64 Native Tools): - - cd extlib - mkdir build - cd build - cmake.exe .. -G"Visual Studio 16 2019" - msbuild.exe ALL_BUILD.vcxproj /p:configuration=release /p:platform=x64 - cd .. - install.bat - -Tested and built on Windows 10 (built using MinGW 64-bit, running in Powershell): - - mkdir build - cd build - ..\scripts\cmake-win.bat - mingw32-make.exe - mingw32-make.exe install - -Tested and built on Windows 10 (built using MinGW 64-bit, running in MinGW64 Shell): - - mkdir build - cd build - cmake .. -G"Unix Makefiles" -DBUILD_SHARED_LIBS=ON -DTARGET_TYPE=OTHER - make - make install - -Tested and built on Windows 10 (built using VS2019 x64 Native Tools): - - mkdir build - cd build - cmake.exe .. -G"Visual Studio 16 2019" -DCMAKE_TOOLCHAIN_FILE="C:\vcpkg\scripts\buildsystems\vcpkg.cmake" -DNO_MODULES=ON -DTARGET_TYPE=OTHER -DBUILD_SHARED_LIBS=ON - msbuild ALL_BUILD.vcxproj /p:configuration=release /p:platform=x64 - msbuild INSTALL.vcxproj /p:configuration=release /p:platform=x64 - -Running Python client: - - $python_dir = (Get-Item (Get-Command python).Source).DirectoryName - rm $python_dir\Lib\site-packages\pyuda - copy -Recurse .\include\pyuda $python_dir\Lib\site-packages\ - cp .\extlib\lib\libxdr.dll $python_dir\Lib\site-packages\pyuda\ - - Set-Item -Path env:UDA_HOST -Value "idam3.mast.ccfe.ac.uk" - Set-Item -Path env:UDA_HOST -Value "56565" - python - -#### CentOS - -Packages needed for CentOS - - $ LANG=C sudo yum -y groupinstall 'Development Tools' - $ sudo yum -y install openssl-devel boost-devel swig-devel python-devel \ - postgresql-devel libxml2-devel gsl-devel libgcrypt-devel bzip2-devel \ - java-1.8.0-openjdk-devel - -#### Ubuntu - - sudo apt-get install git python3-dev libssl-dev libboost-dev python3-numpy python3-matplotlib - -#### OSX - -### Running cmake configuration - -To configure the UDA build you first need to run cmake: - - cmake -B -H. -DTARGET_TYPE:STRING= - -Where `` is the build directory to create and `` is the target specific configuration to use. The -different targets available are `MAST`, `ITER` and `OTHER`. These are available in the `cmake/Config` directory with -the file name `target-.cmake`. To add a new target simply copy one of these files and rename to the desired target name. - -An example configuration command is: - - cmake -Bbuild -H. -DTARGET_TYPE:STRING=OTHER - -By default UDA will configure to build in client-server mode with both the client and server being built. - -To only build the client use: - - cmake -DCLIENT_ONLY:BOOL=TRUE ... - -To build UDA in fat-client mode use: - - cmake -DFAT_BUILD:BOOL=TRUE ... - -### Building - - make -C - -### Installing - - make -C install - -### Packaging - -On Linux system: - - make -C package - -On Windows system (MinGW): - - make -C package - -On Windows system (VS2019): - - msbuild.exe INSTALL.vcxproj /p:configuration=release /p:platform=x64 - -## Visual Studio - -UDA can be compiled with Visaul Studio 2019. -To do that, Vidual Studio need to be iunstalled witrh at least the following packages: - -- C++ Desktop development tools -- CMake tools -- Python 3.7 -- MFC and ATL libraries -- English language pack (even if you choose another language) -- Windows 10 SDK v10.0.17134.0 - -## vcpkg - -vcpkg if a library manager designed by Microsoft to procure standard libraries for Visual Studio. - -It supports CMake toolchain, easily usable with UDA CMakeList.txt files. - -To use vcpkg, follow theses steps: - - git clone https://github.com/Microsoft/vcpkg - cd vcpkg - bootstrap-vcpkg.bat - -After that, vcpkg tool is ready to acquire libraries. -For UDA, severals libraries are mandatory, the following command download, compile and install them : - - vcpkg install libxml2:x64-windows openssl:x64-windows boost:x64-windows python3:x64-windows dlfcn-win32:x64-windows libpq:x64-windows netcdf-c:x64-windows blitz:x64-windows - -## Other Notes - -Ninja installation for CentOS: - - git clone https://github.com/ninja-build/ninja.git - - cd ninja - ./configure.py --bootstrap - export PATH="${HOME}/ninja:${PATH}" - -Add the following to your .bashrc file: +| LibMemcached | | to enable caching | +| python | \> 3.0 | Python wrapper | + +An example installation for ubuntu 22.10 would be as follows. + +Start by install all system-level dependencies. +```sh +sudo apt update && sudo apt install -y +git +libboost-dev +libboost-program-options-dev +libssl-dev +cmake +build-essential +pkg-config +libxml2-dev +libspdlog-dev +ninja-build +capnproto +libcapnp-dev +python3-dev +python3-pip +python3-venv +``` + +Configure the cmake project. +```sh +cmake -G Ninja -B build . \ +-DBUILD_SHARED_LIBS=ON \ +-DSSLAUTHENTICATION=ON \ +-DCLIENT_ONLY=OFF \ +-DENABLE_CAPNP=ON \ +-DCMAKE_INSTALL_PREFIX=install +``` + +```sh +cmake --build build -j --config Release --target install +``` - export PYTHONPATH=/usr/local/include diff --git a/docs/api_changes.md b/docs/api_changes.md new file mode 100644 index 00000000..17a15629 --- /dev/null +++ b/docs/api_changes.md @@ -0,0 +1,82 @@ +--- +layout: default +title: API changes +nav_order: 6 +--- + +# API changes + +This page aims to detail specific changes to the UDA client API, as well as describing how deprecations will be managed. + + +## Notable release history + +| UDA version | Description of API changes | +|:------------|:---------------------------| +| 2.7.0 | Some accidental breaking api changes are introduced, including some name changes from idam to uda, and the introduction of a new `client_flags` argument to some functions | +| 2.7.6 | A legacy mapping header is introduced which reintroduces the syntax that was lost in 2.7.0, while keeping the option to use new updated names (such as udaFree instead of idamFree) | +| (planned) 3.0.0 | Removal of all references to legacy "idam" name in all api functions. Imposing consistent naming convention in all API functions. Legacy API mapping header to be updated to permit continued use of old names for a more forgiving deprecation of old syntax | + + +## The legacy api headers + +Where old functions names are deprecated the old syntax may still be available in a header file mapping the old syntax to the new. This will allow codes to continue to build against newer UDA library versions until they are ready to update. + +The naming convention for these header files is that they mirror the existing headers they correspond to but with the word legacy added. For example to create a name mapping for a function which is declared in the `client.h` file, such as `udaFree`, the new header will be called `legacy_client.h`. To make use of a previous API function signature that is being replaced, client code simply needs to include the corresponding legacy header. + +The full set of existing legacy api header files will be described below. + +### legacy_client.h +This header contains the mappings for all functions from `client/client.h` The format of the file is as shown below and simply provides a mapping from the new names (`udaFree`) back to the deprecated syntax (`idamFree`). By including this header in client code, the old names are made available again. + +```c++ +LIBRARY_API inline void idamFree(int handle) +{ + udaFree(handle); +} + +LIBRARY_API inline void idamFreeAll() +{ + udaFreeAll(); +} + +``` + +### legacy_accAPI.h +This header contains the mappings for all functions from `clent/accAPI.h` whose definitions were changed in release 2.7.0. Note that to implement this header some API functions had to be changed to pre-empt the new v3.0 syntax (such as `udaUnlockThread` instead of `unlockUdaThread` ). It's also worth being aware of the two options available: either to enable the interface using the extra `client_flags` argument or the one without. The version without `client_flags` is the default and the other behaviour can be enabled by setting a compile flag called `UDA_CLIENT_FLAGS_API`. + +```c++ +#ifdef UDA_CLIENT_FLAGS_API + + LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags) + { + return udaGetCurrentDataBlock(); + } + + LIBRARY_API inline void unlockUdaThread(CLIENT_FLAGS* client_flags) + { + udaUnlockThread(); + } + + LIBRARY_API inline void freeIdamThread(CLIENT_FLAGS* client_flags) + { + udaFreeThread(); + } + +#else + + LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock() + { + return udaGetCurrentDataBlock(); + } + + LIBRARY_API inline void unlockUdaThread() + { + udaUnlockThread(); + } + + LIBRARY_API inline void freeIdamThread() + { + udaFreeThread(); + } +``` diff --git a/docs/client_installation.md b/docs/client_installation.md index 06b67cf2..1318dd3a 100644 --- a/docs/client_installation.md +++ b/docs/client_installation.md @@ -1,6 +1,351 @@ --- layout: default title: Installing a UDA client +nav_order: 3 --- -TODO: Instructions for installing UDA client \ No newline at end of file +# UDA client installation +{:.no_toc} + +To access data from any remote site hosting an UDA server you will only need to have the UDA client installed on your local machine. +The client-only build is supported on Linux, MacOS, and Windows. + +The UDA client is a C library which exposes a number of API functions for requesting and unpacking data from a remote UDA server. +There are a number of client wrappers which provide an UDA interface in different programming languages, such as Python and C++, +often with a more user-friendly, object-oriented layer over the basic C-API. + +In general, the underlying UDA client library must be fully built and then any number of additional language wrappers can +be built on-top. With the exception on the python wrapper, building any additional wrappers is completely handled by the +project CMake configuration. It's worth noting, however, that pre-built Docker images or python wheels may already be +available for your platform. + +For python specifically, wheels are built for a range of architecure/OS/python-version combinations and all tagged releases +past version 2.7.6 are available to pip install through pypi [here](https://pypi.org/project/uda/). Windows is supported +from version 2.8.0. + +The range of available dockerfiles are stored in the UDA repository [here](https://github.com/ukaea/UDA/tree/main/docker), +although no pre-built images are hosted publicly yet. + +Please raise an [issue](https://github.com/ukaea/uda/issues) on the UDA github repository for feature requests to support +additional client wrapper langauges or additinal platforms for python wheels or docker images. + +## Contents +{:.no_toc} +1. TOC +{:toc} + +## Installing the python pyuda client from pypi + +```sh +python3 -m venv venv +source venv/bin/activate +python -m pip install --upgrade pip +python -m pip install uda +``` + +The python syntax to request a data item would then be: +```py +import pyuda +pyuda.Client.port = 56565 # or custom server port number +pyuda.Client.server = + +client = pyuda.Client() +data_object = client.get('signal-name', source) + +``` + +## Building a docker image + +```sh +wget https://github.com/ukaea/UDA/archive/refs/tags/2.7.6.tar.gz +tar -xzf 2.7.6.tar.gz +cd UDA-2.7.6/docker +docker build -t -f client.ubuntu.22.04.dockerfile +``` + +## Building the client from source + +The following sections describe the installation procedure for the main operating systems supported. +Alternatively see the [CI scripts](https://github.com/ukaea/UDA/blob/main/.github/workflows/cmake.yml) in the UDA +repository for the latest build instructions used to test each release on ubuntu, MacOS, and Windows. +The [docker files](https://github.com/ukaea/UDA/tree/main/docker) can also be a useful reference for other Linux flavours. + +### Ubuntu + +Install dependencies from system package manager. +```sh +sudo apt update && sudo apt install -y \ +git \ +libboost-dev \ +libboost-program-options-dev \ +libssl-dev \ +cmake \ +build-essential \ +libxml2-dev \ +libspdlog-dev \ +ninja-build \ +capnproto \ +libcapnp-dev \ +python3-dev \ +python3-pip \ +python3-venv \ +``` + +Configure the cmake project with desired options. +```sh +cmake -G Ninja -B build . \ + -DBUILD_SHARED_LIBS=ON \ + -DSSLAUTHENTICATION=ON \ + -DCLIENT_ONLY=ON \ + -DENABLE_CAPNP=ON \ + -DCMAKE_INSTALL_PREFIX=install +``` + +Build and install +```sh +cmake --build build -j --config Release --target install +``` + +### Alma + +```sh + dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && \ + dnf install -y \ + boost-devel \ + openssl-devel \ + libxml2-devel \ + libtirpc-devel \ + fmt fmt-devel \ + spdlog spdlog-devel \ + capnproto capnproto-devel +``` + +Configure the cmake project with desired options +```sh +cmake -B build . \ + -DBUILD_SHARED_LIBS=ON \ + -DSSLAUTHENTICATION=ON \ + -DCLIENT_ONLY=ON \ + -DENABLE_CAPNP=ON \ + -DCMAKE_INSTALL_PREFIX=install +``` + +Build and install +```sh +cmake --build build -j --config Release --target install +``` + +### Centos-7 + +```sh +yum update -y && +yum install -y wget openssl-devel libxml2-devel libtirpc-devel +``` +Build additional dependencies from source +```sh +cd /tmp + +# libfmt +wget https://github.com/fmtlib/fmt/archive/refs/tags/10.0.0.tar.gz +tar xzf 10.0.0.tar.gz +cd fmt-10.0.0 +cmake -Bbuild -H. -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON +cmake --build build -j --config Release --target install + +# spdlog +wget https://github.com/gabime/spdlog/archive/refs/tags/v1.11.0.tar.gz +tar xzf v1.11.0.tar.gz +cd spdlog-1.11.0 +cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON +cmake --build build -j --config Release --target install + +# capnproto +wget https://github.com/capnproto/capnproto/archive/refs/tags/v0.10.4.tar.gz +tar xzf v0.10.4.tar.gz +cd capnproto-0.10.4 +cmake -Bbuild -H. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DBUILD_SHARED_LIBS=ON +cmake --build build +cmake --install build + +# boost +wget https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.gz +tar xzf boost_1_80_0.tar.gz +cd boost_1_80_0 +./bootstrap.sh --prefix=/usr/local +./b2 --without-python --prefix=/usr/local install +``` + +Configure the cmake project with desired options +```sh +cmake -B build . \ + -DBUILD_SHARED_LIBS=ON \ + -DSSLAUTHENTICATION=ON \ + -DCLIENT_ONLY=ON \ + -DENABLE_CAPNP=ON \ + -DCMAKE_INSTALL_PREFIX=install +``` + +Build and install +```sh +cmake --build build -j --config Release --target install +``` + + +### MacOS +install dependencies using homebrew + +```sh +brew update-reset && brew install \ +git \ +boost \ +openssl \ +cmake \ +pkg-config \ +libxml2 \ +spdlog \ +ninja \ +capnp \ +``` + +Configure the cmake project with desired options +```sh +cmake -G Ninja -B build . \ + -DBUILD_SHARED_LIBS=ON \ + -DSSLAUTHENTICATION=ON \ + -DCLIENT_ONLY=ON \ + -DENABLE_CAPNP=ON \ + -DCMAKE_INSTALL_PREFIX=install +``` + +Build and install +```sh +cmake --build build -j --config Release --target install +``` + +### Windows (MSVC) +install dependencies using vcpkg +```sh +vcpkg install --triplet x64-windows-static-md ` +libxml2 ` +capnproto ` +boost-program-options ` +boost-format ` +boost-algorithm ` +boost-multi-array ` +openssl ` +dlfcn-win32 ` +spdlog +``` + +build the xdr/rpc library bundled with uda for windows +```sh +cmake -Bextlib/build ./extlib ` +-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake ` +-DVCPKG_TARGET_TRIPLET="x64-windows-static-md" ` +-DVCPKG_HOST_TRIPLET="x64-windows-static-md" ` +-DCMAKE_GENERATOR_PLATFORM=x64 ` +-DBUILD_SHARED_LIBS=OFF ` +-DCMAKE_INSTALL_PREFIX=extlib/install + +cmake --build extlib/build -j --config Release --target install +``` + +configure the cmake project +```sh +$Env:XDR_ROOT = 'extlib/install' +$Env:CMAKE_PREFIX_PATH = 'C:/vcpkg/installed/x64-windows-static-md' +$Env:Boost_DIR = 'C:/vcpkg/installed/x64-windows-static-md/share/boost' +$Env:LibXml2_DIR = 'C:/vcpkg/installed/x64-windows-static-md/share/libxml2' +$Env:CapnProto_DIR = 'C:/vcpkg/installed/x64-windows-static-md/share/capnproto' +$Env:fmt_DIR = 'C:/vcpkg/installed/x64-windows-static-md/share/fmt' + +cmake -Bbuild . ` +-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake ` +-DVCPKG_TARGET_TRIPLET="x64-windows-static-md" ` +-DVCPKG_HOST_TRIPLET="x64-windows-static-md" ` +-DCMAKE_GENERATOR_PLATFORM=x64 ` +-DBUILD_SHARED_LIBS=ON ` +-DSSLAUTHENTICATION=ON ` +-DCLIENT_ONLY=ON ` +-DENABLE_CAPNP=ON ` +-DNO_JAVA_WRAPPER=ON ` +-DNO_CXX_WRAPPER=ON ` +-DNO_IDL_WRAPPER=ON ` +-DNO_CLI=ON ` +-DNO_MEMCACHE=ON ` +-DCMAKE_INSTALL_PREFIX=install +``` + +Build and install +```sh +cmake --build build -j --config Release --target install +``` + +### Windows (MinGW) + +Install dependencies using vcpkg +```sh +vcpkg install --triplet x64-mingw-static ` +libxml2 ` +capnproto ` +boost-program-options ` +boost-format ` +boost-algorithm ` +boost-multi-array ` +openssl ` +dlfcn-win32 ` +spdlog ` +``` + +build the xdr/rpc library bundled with uda for windows +```sh +cd extlib +cmake -B build -G "MinGW Makefiles" . ` +-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake ` +-DCMAKE_INSTALL_PREFIX=install +cmake --build build -j --config Release --target install + +``` + +Configure the cmake project with desired options +```sh +$Env:XDR_ROOT = 'extlib/install' +cmake -B build . ` + -DBUILD_SHARED_LIBS=ON ` + -DSSLAUTHENTICATION=ON ` + -DCLIENT_ONLY=ON ` + -DENABLE_CAPNP=ON ` + -DCMAKE_INSTALL_PREFIX=install + +``` + +Build and install +```sh +cmake --build build -j --config Release --target install +``` + + + +## Testing client build using the UDA CLI + +```sh +cd /bin +./uda_cli --host --port 56565 --request "help::help()" --source "" +``` + +## Building the pyuda python wrapper + +After successful client library build there will be a directory called `python_installer` from which you can pip install pyuda, this command will also compile the cython part of the pyuda module. + +```sh +cd /python_installer +python3 -m venv venv +source venv/bin/activate +python3 -m pip install --upgrade pip wheel +python3 -m pip install "numpy<2" cython six +python3 -m pip install . + +# test +python3 -c 'import pyuda; print(pyuda.__version__)' +``` + diff --git a/docs/creating_plugins.md b/docs/creating_plugins.md index bc56a98c..8a0da05d 100644 --- a/docs/creating_plugins.md +++ b/docs/creating_plugins.md @@ -1,6 +1,7 @@ --- layout: default title: Creating a UDA plugin +nav_order: 2 --- ## UDA plugin @@ -125,4 +126,4 @@ requests. The plugin object is static as data can be cached between calls to avo for example holding onto file handles to avoid re-opening files. You can use the structure as provided or implement the functionality however you desire as long as each call -to the entry function handles the function requested and returns an error code accordingly. \ No newline at end of file +to the entry function handles the function requested and returns an error code accordingly. diff --git a/docs/development.md b/docs/development.md index 730d5827..1b893136 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,6 +1,7 @@ --- layout: default title: UDA Development +nav_order: 5 --- TODO: UDA Development instructions diff --git a/docs/server_installation.md b/docs/server_installation.md index 8620ed75..bd92dc99 100644 --- a/docs/server_installation.md +++ b/docs/server_installation.md @@ -1,13 +1,14 @@ --- layout: default title: Server Installation +nav_order: 4 --- ## Prerequisites | Name | Minimum Version | |-------------------|--------------------------| -| C++ compiler | c++11 compliant compiler | +| C++ compiler | c++17 compliant compiler | | CMake | 3.0 | | Boost | 1.65 | | OpenSSL version 1 | 1.1 | @@ -17,7 +18,7 @@ title: Server Installation ## Supported OSs -UDA has been build on Linux, macOS and Windows. +The UDA server can been build on Linux and macOS. Note that the server will not run on Windows; only the client installation is supported. ## Builing UDA @@ -54,4 +55,4 @@ cmake --build build ```bash cmake --install build -``` \ No newline at end of file +``` diff --git a/source/client/legacy_accAPI.h b/source/client/legacy_accAPI.h index 0e285133..4cad3ae0 100644 --- a/source/client/legacy_accAPI.h +++ b/source/client/legacy_accAPI.h @@ -12,7 +12,7 @@ extern "C" { #ifdef UDA_CLIENT_FLAGS_API // #warning "Using legacy API names with redundant \"client_flags\" arguments, these will be deprecated in future" - LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags) + LIBRARY_API inline DATA_BLOCK* acc_getCurrentDataBlock(CLIENT_FLAGS* client_flags) { return udaGetCurrentDataBlock(); } @@ -59,7 +59,7 @@ extern "C" { LIBRARY_API inline void resetIdamProperties(CLIENT_FLAGS* client_flags) { - udaResetProperties(); + udaResetProperties(); } CLIENT_BLOCK saveIdamProperties(const CLIENT_FLAGS* client_flags) @@ -141,7 +141,7 @@ extern "C" { LIBRARY_API inline void resetIdamProperties() { - udaResetProperties(); + udaResetProperties(); } LIBRARY_API inline CLIENT_BLOCK saveIdamProperties() From 83e73fa76146a4ddbcbb8ca2c3a21ccbfae6948b Mon Sep 17 00:00:00 2001 From: sdixon Date: Wed, 23 Oct 2024 18:21:31 +0100 Subject: [PATCH 12/12] updating readme --- README.md | 22 ++++++++++++++++------ docs/server_installation.md | 32 ++++++++++++++++++++++++-------- 2 files changed, 40 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 1e2866fa..a6228ea5 100755 --- a/README.md +++ b/README.md @@ -9,7 +9,11 @@ remote server, or as fat-client API where both the client access and plugin func ## Licence -See LICENCE.txt for details. +UDA is licenced under an Apache 2.0 licence. See [LICENCE.txt](https://github.com/ukaea/UDA/blob/main/LICENCE.txt) for details. + +## documentation + +See the github pages for current [Docs](https://ukaea.github.io/UDA/) ## Getting UDA @@ -17,7 +21,7 @@ The source code can be downloaded from: https://github.com/ukaea/UDA/releases/ -The UDA git repository can be cloned: +The UDA git repository can be cloned from: git clone git@github.com:ukaea/UDA.git @@ -33,9 +37,15 @@ For any other use cases please see the documentation to build from source [here] ## Building UDA Server from source +There are some notes available [here](https://ukaea.github.io/UDA/server_installation/) in the documentation. + +Note that the most up-to-date build script will be the one used for testing in the github CI tests [here](https://github.com/ukaea/UDA/blob/release/2.8.0/.github/workflows/cmake.yml). This will contain the relevant buld steps for Ubuntu and MacOS. There are also some dockerfiles available [here](https://github.com/ukaea/UDA/tree/release/2.8.0/docker) which will show the build steps for some other Linux flavours. + +An example installation for ubuntu 22.10 would be as follows. + ### Dependencies -UDA requires the following to avail in order to build: +UDA requires the following to packages in order to build: | Name | Version | Required For | | --- | --- | --- | @@ -49,9 +59,8 @@ UDA requires the following to avail in order to build: | LibMemcached | | to enable caching | | python | \> 3.0 | Python wrapper | -An example installation for ubuntu 22.10 would be as follows. -Start by install all system-level dependencies. +Start by installing all system-level dependencies. ```sh sudo apt update && sudo apt install -y git @@ -71,7 +80,7 @@ python3-pip python3-venv ``` -Configure the cmake project. +Configure the cmake project ```sh cmake -G Ninja -B build . \ -DBUILD_SHARED_LIBS=ON \ @@ -81,6 +90,7 @@ cmake -G Ninja -B build . \ -DCMAKE_INSTALL_PREFIX=install ``` +build and install ```sh cmake --build build -j --config Release --target install ``` diff --git a/docs/server_installation.md b/docs/server_installation.md index bd92dc99..31d96140 100644 --- a/docs/server_installation.md +++ b/docs/server_installation.md @@ -14,7 +14,7 @@ nav_order: 4 | OpenSSL version 1 | 1.1 | | pkg-config | 0.29 | | libXML2 | 2.10 | - | Capnproto | 0.10 | +| Capnproto | 0.10 | ## Supported OSs @@ -22,6 +22,8 @@ The UDA server can been build on Linux and macOS. Note that the server will not ## Builing UDA +Note that the most up-to-date build script will be the one used for testing in the github CI tests [here](https://github.com/ukaea/UDA/blob/release/2.8.0/.github/workflows/cmake.yml). This will contain the relevant buld steps for Ubuntu and MacOS. There are also some dockerfiles available [here](https://github.com/ukaea/UDA/tree/release/2.8.0/docker) which will show the build steps for some other Linux flavours. + **Clone the repo** ```bash @@ -32,13 +34,27 @@ git clone git@github.com:ukaea/UDA.git Cmake configuration options -| Options | Description | -|----------------------|-------------| -| BUILD_SHARED_LIBS | | -| OPENSSL_ROOT_DIR | | -| BOOST_ROOT | | -| CMAKE_INSTALL_PREFIX | | -| CMAKE_BUILD_TYPE | | +|Option | Defaullt | Description | +|------|-----------|-------------| +|BUILD_SHARED_LIBS:BOOL | ON | Build shared libraries| +|CMAKE_INSTALL_PREFIX:PATH | /usr/local | Install path prefix, prepended onto install directories.| +|CMAKE_BUILD_TYPE:STRING | Debug | Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel ...| +|UDA_SERVER_HOST:STRING | `hostname` | define hostname in server configuration files| +|UDA_SERVER_PORT:STRING | 56565 | define port number in server configuration files| +|CLIENT_ONLY:BOOL | ON | Only build UDA client| +|SERVER_ONLY:BOOL | OFF | Only build UDA server| +|ENABLE_CAPNP:BOOL | ON | Enable Cap’n Proto serialisation| +|NO_MEMCACHE:BOOL | ON | Do not attempt to build with libmemcached support| +|NO_WRAPPERS:BOOL | OFF | Don't build any UDA client wrappers| +|NO_CLI:BOOL | OFF | Don't build UDA CLI| +|UDA_CLI_BOOST_STATIC:BOOL | OFF | compile commandline interface with static boost libraries| +|NO_CXX_WRAPPER:BOOL | OFF | Don't build C++ wrapper| +|NO_IDL_WRAPPER:BOOL | OFF | Don't build IDL wrapper| +|FAT_IDL:BOOL | OFF | Build IDL wrapper using fat-client| +|NO_JAVA_WRAPPER:BOOL | OFF | Don't build Java wrapper| +|NO_PYTHON_WRAPPER:BOOL | OFF | Don't build Python wrapper| + + ```bash export UDA_ROOT=/usr/local