You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Robert Lazarski (Jira)" <ji...@apache.org> on 2026/01/29 13:18:00 UTC
[jira] [Comment Edited] (AXIS2C-1545) Undeclared variable in generated c code
[ https://issues.apache.org/jira/browse/AXIS2C-1545?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18055170#comment-18055170 ]
Robert Lazarski edited comment on AXIS2C-1545 at 1/29/26 1:17 PM:
------------------------------------------------------------------
The new native generator for 2.0.0 does NOT have the same bug because:
1. Different architecture: It generates C code directly via fprintf() statements, not
through XSL template matching with conditional blocks
2. No condition mismatch: Variables are declared unconditionally at the start of each
serialization function, then used unconditionally. There's no scenario where a declaration
condition differs from a usage condition.
3. The original bug was XSL-specific: The XSL bug was that <xsl:if test="@type or $isUnion">
controlled declarations, but <xsl:if test="count(property[@attribute])!=0 or @type">
controlled usage. If a schema had attributes but no @type, variables weren't declared but
were still used. This kind of template condition mismatch can't happen in the native generator's direct C code emission.
was (Author: robertlazarski):
The new native generator for 2.0.0 does NOT have the same bug because:
1. Different architecture: It generates C code directly via fprintf() statements, not
through XSL template matching with conditional blocks
2. No condition mismatch: Variables are declared unconditionally at the start of each
serialization function, then used unconditionally. There's no scenario where a declaration
condition differs from a usage condition.
3. The original bug was XSL-specific: The XSL bug was that <xsl:if test="@type or $isUnion">
controlled declarations, but <xsl:if test="count(property[@attribute])!=0 or @type">
controlled usage. If a schema had attributes but no @type, variables weren't declared but
were still used. This kind of template condition mismatch can't happen in the native
gene
> Undeclared variable in generated c code
> ---------------------------------------
>
> Key: AXIS2C-1545
> URL: https://issues.apache.org/jira/browse/AXIS2C-1545
> Project: Axis2-C
> Issue Type: Bug
> Components: code generation
> Affects Versions: 1.7.0
> Environment: Windows XP
> Reporter: Carl Lefrançois
> Priority: Major
> Labels: patch
> Original Estimate: 1h
> Remaining Estimate: 1h
>
> The variables xsi_prefix, type_attrib, xsi_ns, and xsi_type_attri are sometimes not declared even when a code block later uses them. The condition controlling their generation is not the same as the condition of a block that uses them.
> CADBBeanTemplateSource.xsl revision 909680
> declaration blocks:
> lines 3650, 3653:
> <xsl:if test="@type or $isUnion">
> <xsl:if test="@type">
> used in block:
> line 4149
> <xsl:if test="count(property[@attribute])!=0 or @type">
> Possible patch is to add 'count(property[@attribute])!=0' condition to the declaration tests. This change worked in at least one case but no run-time test done yet.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: c-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: c-dev-help@axis.apache.org