-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BSLS_REVIEW uses plink symbols GUID where available (with size fix) (…
…#4768)
- Loading branch information
1 parent
9e77574
commit b535eb1
Showing
5 changed files
with
304 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// bsls_stackaddressutil_plinktimestamp.cpp -*-C++-*- | ||
#include <bsls_stackaddressutil_plinktimestamp.h> | ||
|
||
#include <bsls_ident.h> | ||
BSLS_IDENT("$Id$ $CSID$") | ||
|
||
#include <bsls_platform.h> | ||
|
||
// BDE_VERIFY pragma: -AQb01 | ||
// BDE_VERIFY pragma: -TR04 | ||
|
||
// plink_timestamp___ : | ||
const char *plink_timestamp___[6]={0}; | ||
|
||
// Note that the size of plink_timestamp___ must match the other weak linker | ||
// symbol in sysutil_pwhat.c, which is 6. | ||
|
||
#if defined(BSLS_PLATFORM_OS_AIX) || \ | ||
defined(BSLS_PLATFORM_CMP_GNU) || \ | ||
defined(BSLS_PLATFORM_CMP_SUN) | ||
|
||
#pragma weak plink_timestamp___ | ||
|
||
#endif | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Copyright 2024 Bloomberg Finance L.P. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ----------------------------- END-OF-FILE ---------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// bsls_stackaddressutil_plinktimestamp.h -*-C++-*- | ||
#ifndef INCLUDED_BSLS_STACKADDRESSUTIL_PLINKTIMESTAMP | ||
#define INCLUDED_BSLS_STACKADDRESSUTIL_PLINKTIMESTAMP | ||
|
||
#include <bsls_ident.h> | ||
BSLS_IDENT("$Id: $") | ||
|
||
//@PURPOSE: Declare and weakly define a 'plink_timestamp___' global variable. | ||
// | ||
//@DESCRIPTION: This component provides a weak definition of the Bloomberg | ||
// standard 'plink_timestamp__' variable, which is normally generated by any | ||
// program that is built with the Bloomberg 'plink' build system. This array | ||
// of null-terminated strings, ending in a '0', normally contains data useful | ||
// in identifying when and how a particular task was built. | ||
// | ||
// The definition provided by this component is an array containing a single | ||
// '0' value with 'weak' linkage, which should cause it to be only linked into | ||
// an application in build systems that don't generate a definition for this | ||
// variable themselves. Note that "dummy" definitions of this symbol | ||
// occasional use an array of empty strings, but that that would crash | ||
// 'sysutil_pwhat_getvar' if it ended up actually linking together and being | ||
// called. | ||
|
||
extern "C" const char *plink_timestamp___[]; | ||
|
||
#endif | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Copyright 2024 Bloomberg Finance L.P. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ----------------------------- END-OF-FILE ---------------------------------- |
138 changes: 138 additions & 0 deletions
138
groups/bsl/bsls/bsls_stackaddressutil_plinktimestamp.t.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
// bsls_stackaddressutil_plinktimestamp.t.cpp -*-C++-*- | ||
|
||
#include <bsls_stackaddressutil_plinktimestamp.h> | ||
|
||
#include <bsls_bsltestutil.h> | ||
#include <cstdio> // 'fprintf' | ||
#include <cstdlib> // 'atoi' | ||
|
||
using namespace BloombergLP; | ||
using namespace std; | ||
|
||
//============================================================================= | ||
// TEST PLAN | ||
//----------------------------------------------------------------------------- | ||
// Overview | ||
// -------- | ||
// This component will verify that the 'plink_timestamp___' defined by this | ||
// component is an array containing a single 0 value. Note that this is only | ||
// testing the fallback case of a task linked without "pwhat strings." Tests | ||
// for the interesting case have build dependencies which cannot be satisfied | ||
// in this repo. | ||
//----------------------------------------------------------------------------- | ||
// [1] plink_timestamp___ | ||
//----------------------------------------------------------------------------- | ||
|
||
// ============================================================================ | ||
// STANDARD BSL ASSERT TEST FUNCTION | ||
// ---------------------------------------------------------------------------- | ||
|
||
namespace { | ||
|
||
int testStatus = 0; | ||
|
||
void aSsErT(bool condition, const char *message, int line) | ||
{ | ||
if (condition) { | ||
printf("Error " __FILE__ "(%d): %s (failed)\n", line, message); | ||
|
||
if (0 <= testStatus && testStatus <= 100) { | ||
++testStatus; | ||
} | ||
} | ||
} | ||
|
||
} // close unnamed namespace | ||
|
||
// ============================================================================ | ||
// STANDARD BSL TEST DRIVER MACRO ABBREVIATIONS | ||
// ---------------------------------------------------------------------------- | ||
|
||
#define ASSERT BSLS_BSLTESTUTIL_ASSERT | ||
#define ASSERTV BSLS_BSLTESTUTIL_ASSERTV | ||
|
||
#define LOOP_ASSERT BSLS_BSLTESTUTIL_LOOP_ASSERT | ||
#define LOOP0_ASSERT BSLS_BSLTESTUTIL_LOOP0_ASSERT | ||
#define LOOP1_ASSERT BSLS_BSLTESTUTIL_LOOP1_ASSERT | ||
#define LOOP2_ASSERT BSLS_BSLTESTUTIL_LOOP2_ASSERT | ||
#define LOOP3_ASSERT BSLS_BSLTESTUTIL_LOOP3_ASSERT | ||
#define LOOP4_ASSERT BSLS_BSLTESTUTIL_LOOP4_ASSERT | ||
#define LOOP5_ASSERT BSLS_BSLTESTUTIL_LOOP5_ASSERT | ||
#define LOOP6_ASSERT BSLS_BSLTESTUTIL_LOOP6_ASSERT | ||
|
||
#define Q BSLS_BSLTESTUTIL_Q // Quote identifier literally. | ||
#define P BSLS_BSLTESTUTIL_P // Print identifier and value. | ||
#define P_ BSLS_BSLTESTUTIL_P_ // P(X) without '\n'. | ||
#define T_ BSLS_BSLTESTUTIL_T_ // Print a tab (w/o newline). | ||
#define L_ BSLS_BSLTESTUTIL_L_ // current Line number | ||
|
||
//============================================================================= | ||
// GLOBAL CONSTANTS FOR TESTING | ||
//----------------------------------------------------------------------------- | ||
|
||
bool globalVerbose = false; | ||
bool globalVeryVerbose = false; | ||
bool globalVeryVeryVerbose = false; | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
int test = argc > 1 ? atoi(argv[1]) : 0; | ||
int verbose = argc > 2; | ||
int veryVerbose = argc > 3; | ||
int veryVeryVerbose = argc > 4; | ||
|
||
globalVerbose = verbose; | ||
globalVeryVerbose = veryVerbose; | ||
globalVeryVeryVerbose = veryVeryVerbose; | ||
|
||
printf( "TEST %s CASE %d\n", __FILE__, test); | ||
|
||
switch (test) { case 0: // zero is always the leading case | ||
case 1: { | ||
// -------------------------------------------------------------------- | ||
// PLINK_TIMESTAMP CONTENTS | ||
// | ||
// Concerns: | ||
//: 1 The global variable 'plink_timestamp___' should start with a '0' | ||
//: value. | ||
// | ||
// Plan: | ||
//: 1 Check the value of 'plink_timestamp___'. | ||
// | ||
// Testing: | ||
// plink_timestamp___ | ||
// -------------------------------------------------------------------- | ||
|
||
if (verbose) printf( "\nPLINK_TIMESTAMP CONTENTS" | ||
"\n========================\n" ); | ||
|
||
ASSERT(0 == plink_timestamp___[0]); | ||
} break; | ||
default: { | ||
fprintf( stderr, "WARNING: CASE `%d` NOT FOUND.\n" , test); | ||
testStatus = -1; | ||
} | ||
} | ||
|
||
if (testStatus > 0) { | ||
fprintf( stderr, "Error, non-zero test status = %d.\n", testStatus ); | ||
} | ||
|
||
return testStatus; | ||
} | ||
|
||
// ---------------------------------------------------------------------------- | ||
// Copyright 2024 Bloomberg Finance L.P. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// ----------------------------- END-OF-FILE ---------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters