Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
69922c67
Commit
69922c67
authored
Oct 11, 2012
by
Matteo Bruni
Committed by
Alexandre Julliard
Oct 11, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3dcompiler: Add some checks to function definitions.
parent
6897f9aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
1 deletion
+57
-1
d3dcompiler_private.h
dlls/d3dcompiler_43/d3dcompiler_private.h
+1
-0
hlsl.y
dlls/d3dcompiler_43/hlsl.y
+55
-0
utils.c
dlls/d3dcompiler_43/utils.c
+1
-1
No files found.
dlls/d3dcompiler_43/d3dcompiler_private.h
View file @
69922c67
...
...
@@ -1109,6 +1109,7 @@ struct hlsl_type *clone_hlsl_type(struct hlsl_type *old) DECLSPEC_HIDDEN;
struct
hlsl_type
*
get_type
(
struct
hlsl_scope
*
scope
,
const
char
*
name
,
BOOL
recursive
)
DECLSPEC_HIDDEN
;
BOOL
find_function
(
const
char
*
name
)
DECLSPEC_HIDDEN
;
unsigned
int
components_count_type
(
struct
hlsl_type
*
type
)
DECLSPEC_HIDDEN
;
BOOL
compare_hlsl_types
(
const
struct
hlsl_type
*
t1
,
const
struct
hlsl_type
*
t2
)
DECLSPEC_HIDDEN
;
BOOL
compatible_data_types
(
struct
hlsl_type
*
s1
,
struct
hlsl_type
*
s2
)
DECLSPEC_HIDDEN
;
struct
hlsl_ir_expr
*
new_expr
(
enum
hlsl_ir_expr_op
op
,
struct
hlsl_ir_node
**
operands
,
struct
source_location
*
loc
)
DECLSPEC_HIDDEN
;
...
...
dlls/d3dcompiler_43/hlsl.y
View file @
69922c67
...
...
@@ -808,6 +808,29 @@ static BOOL add_typedef(DWORD modifiers, struct hlsl_type *orig_type, struct lis
return TRUE;
}
static const struct hlsl_ir_function_decl *get_overloaded_func(struct wine_rb_tree *funcs, char *name,
struct list *params, BOOL exact_signature)
{
struct hlsl_ir_function *func;
struct wine_rb_entry *entry;
entry = wine_rb_get(funcs, name);
if (entry)
{
func = WINE_RB_ENTRY_VALUE(entry, struct hlsl_ir_function, entry);
entry = wine_rb_get(&func->overloads, params);
if (!entry)
{
if (!exact_signature)
FIXME("No exact match, search for a compatible overloaded function (if any).\n");
return NULL;
}
return WINE_RB_ENTRY_VALUE(entry, struct hlsl_ir_function_decl, entry);
}
return NULL;
}
%}
%locations
...
...
@@ -1000,6 +1023,38 @@ hlsl_prog: /* empty */
}
| hlsl_prog func_declaration
{
const struct hlsl_ir_function_decl *decl;
decl = get_overloaded_func(&hlsl_ctx.functions, $2.name, $2.decl->parameters, TRUE);
if (decl && !decl->func->intrinsic)
{
if (decl->body && $2.decl->body)
{
hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
$2.decl->node.loc.col, HLSL_LEVEL_ERROR,
"redefinition of function %s", debugstr_a($2.name));
return 1;
}
else if (!compare_hlsl_types(decl->node.data_type, $2.decl->node.data_type))
{
hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
$2.decl->node.loc.col, HLSL_LEVEL_ERROR,
"redefining function %s with a different return type",
debugstr_a($2.name));
hlsl_report_message(decl->node.loc.file, decl->node.loc.line, decl->node.loc.col, HLSL_LEVEL_NOTE,
"%s previously declared here",
debugstr_a($2.name));
return 1;
}
}
if ($2.decl->node.data_type->base_type == HLSL_TYPE_VOID && $2.decl->semantic)
{
hlsl_report_message($2.decl->node.loc.file, $2.decl->node.loc.line,
$2.decl->node.loc.col, HLSL_LEVEL_ERROR,
"void function with a semantic");
}
TRACE("Adding function '%s' to the function list.\n", $2.name);
add_function_decl(&hlsl_ctx.functions, $2.name, $2.decl, FALSE);
}
...
...
dlls/d3dcompiler_43/utils.c
View file @
69922c67
...
...
@@ -907,7 +907,7 @@ unsigned int components_count_type(struct hlsl_type *type)
return
count
;
}
static
BOOL
compare_hlsl_types
(
const
struct
hlsl_type
*
t1
,
const
struct
hlsl_type
*
t2
)
BOOL
compare_hlsl_types
(
const
struct
hlsl_type
*
t1
,
const
struct
hlsl_type
*
t2
)
{
if
(
t1
==
t2
)
return
TRUE
;
...
...
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