which fixes bug #543481
* support/regression/tests/bug-751703.c: fixed comments left from a
cut and paste error
* src/SDCCdwarf2.c (dwCloseFile): don't explicitly close a temp file
* src/SDCCdwarf2.c (dwTagFromType): added bitfield support
* src/SDCCdwarf2.c (dwWriteSymbolInternal): handle extern within local
scopes
* src/SDCCdwarf2.c (dwWriteLineNumber): line number deltas are signed
* src/SDCCmain.c (processFile, parseCmdLine): non-alphanumeric chars
are now changed to underscores in moduleName
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3317
4a8a32a2-be11-0410-ad9d-
d568d2c75423
+2004-05-17 Erik Petrich <epetrich AT ivorytower.norman.ok.us>
+
+ * src/SDCCval.c (valForArray): applied Maarteen Brock's patch #947682
+ which fixes bug #543481
+ * support/regression/tests/bug-751703.c: fixed comments left from a
+ cut and paste error
+ * src/SDCCdwarf2.c (dwCloseFile): don't explicitly close a temp file
+ * src/SDCCdwarf2.c (dwTagFromType): added bitfield support
+ * src/SDCCdwarf2.c (dwWriteSymbolInternal): handle extern within local
+ scopes
+ * src/SDCCdwarf2.c (dwWriteLineNumber): line number deltas are signed
+ * src/SDCCmain.c (processFile, parseCmdLine): non-alphanumeric chars
+ are now changed to underscores in moduleName
+
2004-05-15 Jesus Calvino-Fraga <jesusc AT ece.ubc.ca>
* as/mcs51/lkmem.c: better fix for bug #954173
curOffset = lp->offset;
dwWriteByte (NULL, DW_LNS_advance_line, NULL);
- dwWriteULEB128 (NULL, lp->line - 1, NULL);
+ dwWriteSLEB128 (NULL, lp->line - 1, NULL);
curLine = lp->line;
dwWriteByte (NULL, DW_LNS_copy, NULL);
curOffset = lp->offset;
dwWriteByte (NULL, DW_LNS_advance_line, NULL);
- dwWriteULEB128 (NULL, deltaLine, NULL);
+ dwWriteSLEB128 (NULL, deltaLine, NULL);
curLine = lp->line;
dwWriteByte (NULL, DW_LNS_copy, NULL);
{
dwtag * memtp;
dwloc * lp;
-
+
+ if (IS_BITFIELD (field->type) && !SPEC_BLEN(field->type))
+ {
+ field = field->next;
+ continue;
+ }
+
memtp = dwNewTag (DW_TAG_member);
if (*(field->name))
dwAddTagAttr (memtp, dwNewAttrString (DW_AT_name,
field->name));
- subtp = dwTagFromType (field->type, tp);
- dwAddTagAttr (memtp, dwNewAttrTagRef (DW_AT_type, subtp));
- if (!subtp->parent)
- dwAddTagChild (parent, subtp);
+ if (IS_BITFIELD (field->type))
+ {
+ int blen = SPEC_BLEN (field->type);
+ int bstr = SPEC_BSTR (field->type);
+ sym_link * type;
+
+ dwAddTagAttr (memtp,
+ dwNewAttrConst (DW_AT_byte_size,
+ (blen+7)/8));
+ dwAddTagAttr (memtp,
+ dwNewAttrConst (DW_AT_bit_size, blen));
+ dwAddTagAttr (memtp,
+ dwNewAttrConst (DW_AT_bit_offset,
+ ((blen+7) & ~7)
+ - (blen+bstr)));
+ if (blen < 8)
+ type = typeFromStr ("uc");
+ else
+ type = typeFromStr ("ui");
+ subtp = dwTagFromType (type, tp);
+ dwAddTagAttr (memtp, dwNewAttrTagRef (DW_AT_type, subtp));
+ }
+ else
+ {
+ subtp = dwTagFromType (field->type, tp);
+ dwAddTagAttr (memtp, dwNewAttrTagRef (DW_AT_type, subtp));
+ if (!subtp->parent)
+ dwAddTagChild (parent, subtp);
+ }
lp = dwNewLoc (DW_OP_plus_uconst, NULL, field->offset);
dwAddTagAttr (memtp,
{
if(!dwarf2FilePtr) return 0;
- fclose(dwarf2FilePtr);
+ /* Don't explicitly close the file; this will be done automatically */
+ dwarf2FilePtr = NULL;
return 1;
}
dwattr * funcap;
int inregs = 0;
- if (!sym->level)
+ if (!sym->level || IS_EXTERN (sym->etype))
scopetp = dwRootTag;
else
{
char *dstFileName; /* destination file name without extension */
char *dstPath = ""; /* path for the output files; */
/* "" is equivalent with cwd */
-char *moduleName; /* module name is source file without path and extension */
+char *moduleNameBase; /* module name base is source file without path and extension */
/* can be NULL while linking without compiling */
+char *moduleName; /* module name is same as module name base, but with all */
+ /* non-alphanumeric characters replaced with underscore */
int currRegBank = 0;
int RegBankUsed[4] = {1, 0, 0, 0}; /*JCF: Reg Bank 0 used by default*/
struct optimize optimize;
fext--;
}
#endif
+ moduleNameBase = Safe_strdup ( fext );
moduleName = Safe_strdup ( fext );
+
+ for (fext = moduleName; *fext; fext++)
+ if (!isalnum (*fext))
+ *fext = '_';
return;
}
/* use the modulename from the C-source */
if (fullSrcFileName)
{
- size_t bufSize = strlen (dstPath) + strlen (moduleName) + 1;
+ size_t bufSize = strlen (dstPath) + strlen (moduleNameBase) + 1;
dstFileName = Safe_alloc (bufSize);
strncpyz (dstFileName, dstPath, bufSize);
- strncatz (dstFileName, moduleName, bufSize);
+ strncatz (dstFileName, moduleNameBase, bufSize);
}
/* use the modulename from the first object file */
else if ((s = peekSet(relFilesSet)) != NULL)
DCL_TYPE (val->type) = EEPPOINTER;
else
DCL_TYPE (val->type) = POINTER;
- val->type->next = arrExpr->left->ftype;
+ val->type->next = arrExpr->left->ftype->next;
val->etype = getSpec (val->type);
return val;
}
/* bug-751703.c
- If test_index is char, loses high bit when indexes table
- workaround is to use [(unsigned int) test_index]
+ Make sure extern within local scope binds to global
+ scope and is not optimized inappropriately.
*/
-#include <testfwk.h>
+
+#include "testfwk.h"
int x = 1;
int y = 2;