Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Packetdrill_tarr_ext
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Stefan Gense
Packetdrill_tarr_ext
Commits
64d13632
Commit
64d13632
authored
6 years ago
by
Michael Tüxen
Browse files
Options
Downloads
Patches
Plain Diff
Add support for #ifdef Apple.
parent
a7e08295
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gtests/net/packetdrill/lexer.l
+20
-19
20 additions, 19 deletions
gtests/net/packetdrill/lexer.l
with
20 additions
and
19 deletions
gtests/net/packetdrill/lexer.l
+
20
−
19
View file @
64d13632
...
@@ -104,7 +104,7 @@ static s64 hextol(const char *s)
...
@@ -104,7 +104,7 @@ static s64 hextol(const char *s)
}
}
enum ifdef_os {
enum ifdef_os {
Linux_IFDEF = 1, FreeBSD_IFDEF, NetBSD_IFDEF, OpenBSD_IFDEF, Omnet_IFDEF
Linux_IFDEF = 1, FreeBSD_IFDEF, NetBSD_IFDEF, OpenBSD_IFDEF, Omnet_IFDEF
, Apple_IFDEF
};
};
#define MAX_IFDEF_DEPTH 1
#define MAX_IFDEF_DEPTH 1
...
@@ -123,34 +123,35 @@ static inline int get_os_name_length(enum ifdef_os os) {
...
@@ -123,34 +123,35 @@ static inline int get_os_name_length(enum ifdef_os os) {
return strlen("OpenBSD");
return strlen("OpenBSD");
case Omnet_IFDEF:
case Omnet_IFDEF:
return strlen("Omnet");
return strlen("Omnet");
case Apple_IFDEF:
return strlen("Apple");
default:
default:
return -1;
return -1;
}
}
}
}
static inline bool ignore_ifdef(enum ifdef_os os) {
static inline bool ignore_ifdef(enum ifdef_os os) {
switch (os) {
#ifdef linux
#ifdef linux
if (os == Linux_IFDEF) {
case Linux_IFDEF:
return false;
}
#endif
#endif
#ifdef __FreeBSD__
#ifdef __FreeBSD__
if (os == FreeBSD_IFDEF) {
case FreeBSD_IFDEF:
return false;
}
#endif
#endif
#ifdef __OpenBSD__
#ifdef __OpenBSD__
if (os == OpenBSD_IFDEF) {
case OpenBSD_IFDEF:
return false;
}
#endif
#endif
#ifdef __NetBSD__
#ifdef __NetBSD__
if (os == NetBSD_IFDEF) {
case NetBSD_IFDEF:
return false;
#endif
}
#ifdef __APPLE__
case Apple_IFDEF:
#endif
#endif
/* no need to handle Omnet here */
/* no need to handle Omnet here */
return true;
return false;
default:
return true;
}
}
}
static inline char* remove_ifdef_start_and_endtag(char *code, int os_name_length) {
static inline char* remove_ifdef_start_and_endtag(char *code, int os_name_length) {
...
@@ -187,11 +188,11 @@ static void handle_ifdef(enum ifdef_os os, const char *s) {
...
@@ -187,11 +188,11 @@ static void handle_ifdef(enum ifdef_os os, const char *s) {
}
}
code = strdup(s);
code = strdup(s);
// keep track of the current value of yylineno, because we need to restore it later (see EOF-Condition),
// keep track of the current value of yylineno, because we need to restore it later (see EOF-Condition),
// otherwise all ifdefs that were interpreted will count twice in yylineno,
// otherwise all ifdefs that were interpreted will count twice in yylineno,
// which will mess up the value in yylineno.
// which will mess up the value in yylineno.
old_yylineno = yylineno;
old_yylineno = yylineno;
code_without_ifdef = remove_ifdef_start_and_endtag(code, os_name_length);
code_without_ifdef = remove_ifdef_start_and_endtag(code, os_name_length);
ifdef_stack[ifdef_stack_ptr++] = YY_CURRENT_BUFFER;
ifdef_stack[ifdef_stack_ptr++] = YY_CURRENT_BUFFER;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment