Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
3d663ac3
Commit
3d663ac3
authored
Nov 19, 2015
by
Francis Dupont
Browse files
[4203] Added new fatal class method for yy_fatal_error fix
parent
e58c97a7
Changes
3
Show whitespace changes
Inline
Side-by-side
src/lib/eval/eval_context.cc
View file @
3d663ac3
...
@@ -50,3 +50,9 @@ EvalContext::error (const std::string& what)
...
@@ -50,3 +50,9 @@ EvalContext::error (const std::string& what)
{
{
isc_throw
(
EvalParseError
,
what
);
isc_throw
(
EvalParseError
,
what
);
}
}
void
EvalContext
::
fatal
(
const
std
::
string
&
what
)
{
isc_throw
(
Unexpected
,
what
);
}
src/lib/eval/eval_context.h
View file @
3d663ac3
...
@@ -81,6 +81,11 @@ public:
...
@@ -81,6 +81,11 @@ public:
/// cases when the EvalParser is not able to handle the packet.
/// cases when the EvalParser is not able to handle the packet.
void
error
(
const
std
::
string
&
what
);
void
error
(
const
std
::
string
&
what
);
/// @brief Fatal error handler
///
/// This is for should not happen but fatal errors
static
void
fatal
(
const
std
::
string
&
what
);
private:
private:
/// @brief Flag determining scanner debugging.
/// @brief Flag determining scanner debugging.
bool
trace_scanning_
;
bool
trace_scanning_
;
...
...
src/lib/eval/lexer.ll
View file @
3d663ac3
...
@@ -31,6 +31,9 @@
...
@@ -31,6 +31,9 @@
//
The
location
of
the
current
token
.
The
lexer
will
keep
updating
it
.
This
//
The
location
of
the
current
token
.
The
lexer
will
keep
updating
it
.
This
//
variable
will
be
useful
for
logging
errors
.
//
variable
will
be
useful
for
logging
errors
.
static
isc:
:
eval:
:location
loc
;
static
isc:
:
eval:
:location
loc
;
//
To
avoid
the
call
to
exit
...
oops
!
#
define
YY_FATAL_ERROR
(
msg
)
isc:
:
eval:
:
EvalContext:
:fatal
(
msg
)
%
}
%
}
/
*
noyywrap
disables
automatic
rewinding
for
the
next
file
to
parse
.
Since
we
/
*
noyywrap
disables
automatic
rewinding
for
the
next
file
to
parse
.
Since
we
...
@@ -144,8 +147,8 @@ EvalContext::scanStringBegin()
...
@@ -144,8 +147,8 @@ EvalContext::scanStringBegin()
YY_BUFFER_STATE
buffer
;
YY_BUFFER_STATE
buffer
;
buffer
=
yy_scan_bytes
(
string_
.
c_str
(),
string_
.
size
())
;
buffer
=
yy_scan_bytes
(
string_
.
c_str
(),
string_
.
size
())
;
if
(
!buffer
)
{
if
(
!buffer
)
{
error
(
"cannot scan string"
)
;
fatal
(
"cannot scan string"
)
;
//
error
throws
an
exception
so
this
can't
be
reached
//
fatal
()
throws
an
exception
so
this
can't
be
reached
}
}
}
}
...
@@ -154,3 +157,10 @@ EvalContext::scanStringEnd()
...
@@ -154,3 +157,10 @@ EvalContext::scanStringEnd()
{
{
yy_delete_buffer
(
YY_CURRENT_BUFFER
)
;
yy_delete_buffer
(
YY_CURRENT_BUFFER
)
;
}
}
namespace
{
///
To
avoid
unused
function
error
class
Dummy
{
void
dummy
()
{
yy_fatal_error
(
"Fix me: how to disable its definition?"
)
; }
}
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment