mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: bad '#line' directives for dynamicCode (fixes #1282)
- now suppress any '#line' if the input number number is invalid (ie, an empty set of tokens)
This commit is contained in:
committed by
Andrew Heather
parent
53d01c8a0a
commit
cd7748f8e4
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -124,11 +124,16 @@ Foam::dynamicCodeContext::dynamicCodeContext(const dictionary& dict)
|
|||||||
void Foam::dynamicCodeContext::addLineDirective
|
void Foam::dynamicCodeContext::addLineDirective
|
||||||
(
|
(
|
||||||
string& code,
|
string& code,
|
||||||
const label lineNum,
|
label lineNum,
|
||||||
const fileName& name
|
const fileName& name
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
code = "#line " + Foam::name(lineNum + 1) + " \"" + name + "\"\n" + code;
|
++lineNum; // Change from 0-based to 1-based
|
||||||
|
|
||||||
|
if (lineNum > 0 && !name.empty())
|
||||||
|
{
|
||||||
|
code = "#line " + Foam::name(lineNum) + " \"" + name + "\"\n" + code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd |
|
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
| Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from a dictionary
|
//- Construct from a dictionary
|
||||||
dynamicCodeContext(const dictionary&);
|
dynamicCodeContext(const dictionary& dict);
|
||||||
|
|
||||||
|
|
||||||
// Member functions
|
// Member functions
|
||||||
@ -128,10 +128,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
//- Helper: add \#line directive
|
//- Helper: add \#line directive
|
||||||
|
// The lineNum is 0-based. No-op if the lineNum is negative.
|
||||||
static void addLineDirective
|
static void addLineDirective
|
||||||
(
|
(
|
||||||
string&,
|
string& code,
|
||||||
const label lineNum,
|
label lineNum,
|
||||||
const fileName& name
|
const fileName& name
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user