2004-03-09 Bernhard Held <bernhard AT bernhardheld.de>
* device/lib/time.c (mktime): fixed bug reported by Bert Thomas
+ * sdcc.spec: updated and split sdcc into 3 rpms
+ * src/SDCCast.c (decorateType): &|^ don't need addCast(); addCast() is
+ needed for literals of LEFT_OP and '+'
+ * src/SDCCicode.c (geniCodeLogic): I must have been braindead when I
+ introduced RESULT_TYPE_NOPROM
+ * src/SDCCsymt.c (computeType): op is int; added RESULT_TYPE_OTHER;
+ limited promotion to int only for '*'
+ * src/SDCCsymt.h (computeType): op is int, removed RESULT_TYPE_NOPROM
2004-03-09 Hans Dorn <hjdorn AT users.sourceforge.net>
Name: sdcc
Requires: /bin/sh
-License: GPL, LGPL
+License: GPL
Group: Applications/Engineering
-Provides: sdcc
Summary: Small Device C Compiler
-Version: 2.3.7
-Release: 4
+Requires: sdcc-common
+Version: 2.4.0
+Release: 1
Source: %{name}-%{version}.tar.bz2
URL: http://sdcc.sourceforge.net/
-Packager: Bernhard Held <bernhard@bernhardheld.de>
+Packager: Bernhard Held <bernhard AT bernhardheld.de>
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
simulator and a core library. The processors supported (to a varying
degree) include the 8051, ds390, z80, hc08, and PIC.
+%package common
+License: GPL, LGPL
+Group: Application/Engineering
+Summary: Libraries and Header Files for the SDCC C compiler
+Requires: sdcc
+
+%description common
+SDCC is a C compiler for 8051 class and similar microcontrollers.
+The package includes the compiler, assemblers and linkers, a device
+simulator and a core library. The processors supported (to a varying
+degree) include the 8051, ds390, z80, hc08, and PIC.
+
+%package doc
+License: GPL
+Group: Applications/Engineering
+Summary: Documentation for the SDCC C compiler
+
+%description doc
+SDCC is a C compiler for 8051 class and similar microcontrollers.
+The package includes the compiler, assemblers and linkers, a device
+simulator and a core library. The processors supported (to a varying
+degree) include the 8051, ds390, z80, hc08, and PIC.
+
%prep
%setup -n sdcc
cd ..
%install
-rm -rf $RPM_BUILD_ROOT/usr
+rm -rf $RPM_BUILD_ROOT
make prefix=$RPM_BUILD_ROOT/usr install
cd doc
make install
cd ..
+%clean
+rm -rf $RPM_BUILD_ROOT
+
%files
%defattr(-,root,root)
/usr/bin
+
+%files common
+%defattr(-,root,root)
/usr/share/sdcc/include
/usr/share/sdcc/lib
+
+%files doc
+%defattr(-,root,root)
%doc %{_defaultdocdir}
%changelog
-* Sun Jan 04 2004 - bernhard@bernhardheld.de
+* Tue Mar 09 2004 - bernhard AT bernhardheld.de
+- split into two packages
+* Wed Feb 26 2004 - bernhard AT bernhardheld.de
+- version updated
+* Sun Jan 04 2004 - bernhard AT bernhardheld.de
- updated
-* Sat Apr 27 2002 - steve@icarus.com
+* Sat Apr 27 2002 - steve AT icarus.com
- first version from Stephen Williams
return decorateType (otree, RESULT_CHECK);
}
- tree->left = addCast (tree->left, resultType, FALSE);
- tree->right = addCast (tree->right, resultType, FALSE);
TTYPE (tree) = computeType (LTYPE (tree),
RTYPE (tree),
resultType,
}
LRVAL (tree) = RRVAL (tree) = 1;
- tree->left = addCast (tree->left, resultType, FALSE);
- tree->right = addCast (tree->right, resultType, FALSE);
TETYPE (tree) = getSpec (TTYPE (tree) =
computeType (LTYPE (tree),
RTYPE (tree),
if (IS_LITERAL (RTYPE (tree)) && IS_LITERAL (LTYPE (tree)))
{
tree->type = EX_VALUE;
+ tree->left = addCast (tree->left, resultType, TRUE);
+ tree->right = addCast (tree->right, resultType, TRUE);
tree->opval.val = valPlus (valFromType (LETYPE (tree)),
valFromType (RETYPE (tree)));
tree->right = tree->left = NULL;
if (IS_LITERAL (RTYPE (tree)) && IS_LITERAL (LTYPE (tree)))
{
tree->type = EX_VALUE;
+ tree->left = addCast (tree->left, resultType, TRUE);
+ tree->right = addCast (tree->right, resultType, TRUE);
tree->opval.val = valMinus (valFromType (LETYPE (tree)),
valFromType (RETYPE (tree)));
tree->right = tree->left = NULL;
{
tree->left = addCast (tree->left, resultType, TRUE);
tree->right = addCast (tree->right, resultType, TRUE);
+
TETYPE (tree) = getSpec (TTYPE (tree) =
computeType (LTYPE (tree),
RTYPE (tree),
goto errorTreeReturn;
}
+ /* make smaller type only if it's a LEFT_OP */
+ if (tree->opval.op == LEFT_OP)
+ tree->left = addCast (tree->left, resultType, TRUE);
+
/* if they are both literal then */
/* rewrite the tree */
if (IS_LITERAL (RTYPE (tree)) && IS_LITERAL (LTYPE (tree)))
LRVAL (tree) = RRVAL (tree) = 1;
if (tree->opval.op == LEFT_OP)
{
- tree->left = addCast (tree->left, resultType, TRUE);
TETYPE (tree) = getSpec (TTYPE (tree) =
computeType (LTYPE (tree),
NULL,
}
}
- ctype = usualBinaryConversions (&left, &right, RESULT_TYPE_NOPROM, 0);
+ ctype = usualBinaryConversions (&left, &right, RESULT_TYPE_NONE, 0);
ic = newiCode (op, left, right);
IC_RESULT (ic) = newiTempOperand (newCharLink (), 1);
/*------------------------------------------------------------------*/
sym_link *
computeType (sym_link * type1, sym_link * type2,
- RESULT_TYPE resultType, char op)
+ RESULT_TYPE resultType, int op)
{
sym_link *rType;
sym_link *reType;
break;
case RESULT_TYPE_INT:
case RESULT_TYPE_NONE:
+ case RESULT_TYPE_OTHER:
if (IS_BIT (reType))
{
SPEC_NOUN (reType) = V_CHAR;
SPEC_USIGN (reType) = 1;
return rType;
}
- else
+ else if (op == '*')
+ {
+ SPEC_NOUN (reType) = V_INT;
+ SPEC_USIGN (reType) = 0;
+ return rType;
+ }
+ /* TODO: should be in SDCCast.c */
+ else if ( op == '/'
+ && ( !SPEC_USIGN (etype1)
+ || !SPEC_USIGN (etype2)))
{
SPEC_NOUN (reType) = V_INT;
SPEC_USIGN (reType) = 0;
RESULT_TYPE_INT,
RESULT_TYPE_OTHER, /* operands will be promoted to int */
RESULT_TYPE_IFX,
- RESULT_TYPE_NOPROM, /* operands will be promoted to int */
} RESULT_TYPE;
/* forward definitions for the symbol table related functions */
void addSymChain (symbol *);
sym_link *structElemType (sym_link *, value *);
symbol *getStructElement (structdef *, symbol *);
-sym_link *computeType (sym_link *, sym_link *, RESULT_TYPE, char);
+sym_link *computeType (sym_link *, sym_link *, RESULT_TYPE, int);
void processFuncArgs (symbol *);
int isSymbolEqual (symbol *, symbol *);
int powof2 (TYPE_UDWORD);