From 5532372b59bbef8f17ee85991a5a187654796ac1 Mon Sep 17 00:00:00 2001 From: Dionna Glaze Date: Thu, 9 Jan 2025 20:11:14 +0000 Subject: [PATCH 1/3] BaseTools: Remove trailing whitespace Minor cleanup Signed-off-by: Dionna Glaze --- BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h b/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h index d25b8d69392c..8532f8fa72a0 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h +++ b/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h @@ -55,7 +55,7 @@ class DllExportPCCTS ParserBlackBox { // no copy assignment allowed ParserBlackBox & operator=(ParserBlackBox const &); - + protected: DLGFileInput *in; Lexer *scan; @@ -65,7 +65,7 @@ class DllExportPCCTS ParserBlackBox { FILE *file; int openByBlackBox; /* MR21 Don't close what we haven't opened */ public: - + ParserBlackBox(FILE *f) : in(0) , scan(0) @@ -77,7 +77,7 @@ class DllExportPCCTS ParserBlackBox { { if (f == NULL) { - cerr << "invalid file pointer\n"; + cerr << "invalid file pointer\n"; } else { @@ -118,7 +118,7 @@ class DllExportPCCTS ParserBlackBox { _parser->init(); } } - + ~ParserBlackBox() { delete in; delete scan; delete pipe; delete _parser; delete tok; From d508f6874c0542f484a228341673e9239b9263a4 Mon Sep 17 00:00:00 2001 From: Dionna Glaze Date: Thu, 9 Jan 2025 20:13:27 +0000 Subject: [PATCH 2/3] BaseTools: Qualify cerr in header file Minor cleanup using namespace std in a header is infectious and therefore not best practice. The declaration build preprocessor may be disabled, which causes these error commands to cause build errors. Signed-off-by: Dionna Glaze --- BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h b/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h index 8532f8fa72a0..a993dfeacb7d 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h +++ b/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h @@ -77,7 +77,7 @@ class DllExportPCCTS ParserBlackBox { { if (f == NULL) { - cerr << "invalid file pointer\n"; + std::cerr << "invalid file pointer\n"; } else { @@ -104,7 +104,7 @@ class DllExportPCCTS ParserBlackBox { FILE *f = fopen(fname, "r"); if ( f==NULL ) { openByBlackBox = 0; - cerr << "cannot open " << fname << "\n"; return; + std::cerr << "cannot open " << fname << "\n"; return; } else { openByBlackBox = 1; From 64fa43fec8cc9871cff7440ed0cd48d3b3ae1bc2 Mon Sep 17 00:00:00 2001 From: Dionna Glaze Date: Thu, 9 Jan 2025 22:27:48 +0000 Subject: [PATCH 3/3] BaseTools: use iostream directly in PBlackBox This header is not included in any c program, and its use should not be dependent on whether the build is using namespace std. Signed-off-by: Dionna Glaze --- BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h b/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h index a993dfeacb7d..149c27208184 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h +++ b/BaseTools/Source/C/VfrCompile/Pccts/h/PBlackBox.h @@ -33,9 +33,7 @@ #include "pcctscfg.h" -#include "pccts_iostream.h" - -PCCTS_NAMESPACE_STD +#include // MR20 Added #include for "DLexerBase.h" @@ -67,7 +65,7 @@ class DllExportPCCTS ParserBlackBox { public: ParserBlackBox(FILE *f) - : in(0) + : in(0) , scan(0) , tok(0) , pipe(0) @@ -101,7 +99,7 @@ class DllExportPCCTS ParserBlackBox { , file(0) , openByBlackBox(0) { - FILE *f = fopen(fname, "r"); + FILE *f = std::fopen(fname, "r"); if ( f==NULL ) { openByBlackBox = 0; std::cerr << "cannot open " << fname << "\n"; return; @@ -123,7 +121,7 @@ class DllExportPCCTS ParserBlackBox { { delete in; delete scan; delete pipe; delete _parser; delete tok; if (1 == openByBlackBox) { - fclose(file); + std::fclose(file); } }