Re: [Tinycc-devel] Request push

2014-06-23 Thread Michael Matz

Hi,

On Sun, 22 Jun 2014, David Mertens wrote:


Hey jiang,
For each of these three patches, please explain the following:

1) When run with the version of tcc without your patch, what behavior do you
get? What does the C99 spec tell us we should get?
2) How does the proposed patch alter the behavior of tcc?

Also, it appears you did not read the links I provided about how to write
good commit messages. Please re-read those and write better ones.


Patch 2 at least also contains gratious whitespace changes creating lines 
longer than 80 character (I know, not a strict policy for TCC, but 
existing code mostly follows that).  And patch 3 (the bitfield fiddling) 
certainly is wrong as explained in some other mail.



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Tinycc-devel Digest, Vol 134, Issue 16

2014-06-23 Thread Michael Matz

Hi,

On Sun, 22 Jun 2014, jiang wrote:


This is my patch (see Annex)

tcc result is correct
-- 254 / 30 / 126


That's not the correct result.  If you think it is the probably because 
you're confused by the semantics of assignments as rvalue.



I guess gcc  mvc repeated use of the register, so wrong


No, GCC and MSVC are correct.


struct {
unsigned a:9, b:5, c:7;
} _s, *s = _s;
int n = 250;

s-a = s-b = s-c = n + 4;


To show that GCC is correct (and TCC wrong, and your patch still wrong) 
rewrite the above into the explicit expansion according to associativity 
of '=':


  s-c = n + 4;  // s-c == 254  127 == 126
  s-b = s-c;   // s-b == 126  31  == 30
  s-a = s-b;   // s-a == 30

In particular the value loaded into s-a comes from s-b, and hence is the 
truncated value, which isn't changed anymore as 5 bits fits into 9 bits.



Ciao,
Michael.

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] State of the tcc project

2014-06-23 Thread Michael Matz

Hi,

On Sun, 22 Jun 2014, David Mertens wrote:


Sorry, I decided to give more than 20 hours for folks to weigh in, and then
time got away from me. I'll revert jiang's changes with a push some time
around June 23 (tomorrow), 9:00PM New York time.

By the way, if the instructions at http://repo.or.cz/w/tinycc.git are
supposed to be the community rules, jiang was not really breaking any. We
should probably work with a different approach. I suggest that individuals
who have ideas should do the following:

1) Discuss bug reports or feature requests on the mailing list.
2) If individuals on the mailing list agree that the idea is a good one, the
individual should publish their work on a public git hosting site and submit
a pull request on the mailing list.
3) After somebody with commit access has checked it out, they can pull it
into the official release branch.


That would mean closing the mob branch (otherwise everybody has commit 
access :) ).


FWIW, I'd have never touched the x86-64 backend in TCC at all if it 
weren't for mob.  I think overall the mob branch worked reasonably well 
until recently, and I'd hate to see it thrown out because of people having 
a different notion of reasonable behaviour :-/


Unfortunately I have no good alternative suggestion, though :-(


Ciao,
Michael.___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] State of the tcc project

2014-06-23 Thread lifenjoiner
Hi,

Mob is mob. And there is master there.

  By the way, if the instructions at http://repo.or.cz/w/tinycc.git are
  supposed to be the community rules, jiang was not really breaking any. We
  should probably work with a different approach. I suggest that individuals
  who have ideas should do the following:
 
 That would mean closing the mob branch (otherwise everybody has commit
 access :) ).
 
 until recently, and I'd hate to see it thrown out because of people having
 a different notion of reasonable behaviour :-/
 

People listens to others could learn and contribute.

Things could have advantages and disadvantages.




___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Request push

2014-06-23 Thread jiang

I'll push a patch.

bug:

--
#define hexCh(c (c = 10 ? 'a' + c - 10 : '0' + c)
  hexCh(c);

out:
jiang@jiang:~/test$ ./tcc -E c4.c
# 1 c4.c

(c = 10 ? 'a' + c - 10 : '0' + c);
---

#define hexCh(c/3) (c = 10 ? 'a' + c - 10 : '0' + c)
hexCh(c);

out:
jiang@jiang:~/test$ ./tcc -E c4.c
# 1 c4.c

/3) (c = 10 ? 'a' + c - 10 : '0' + c);
jiang@jiang:~/test$

after patch:

# 1 c4.c
c4.c:1: error: may not appear in macro parameter list: (
jiang@jiang:~/test$



jiang@jiang:~/test$ ./tcc -E c4.c
# 1 c4.c
c4.c:1: error: may not appear in macro parameter list: /
jiang@jiang:~/test$



-
g...@gitcafe.com:weixiao/tinycc.git

Thank you for reminding

jiang

? 2014?06?23? 09:50, tinycc-devel-requ...@nongnu.org ??:

Hey jiang,

For each of these three patches, please explain the following:

1) When run with the version of tcc without your patch, what behavior 
do you get? What does the C99 spec tell us we should get?

2) How does the proposed patch alter the behavior of tcc?

Also, it appears you did not read the links I provided about how to 
write good commit messages. Please re-read those and write better ones.


Thanks!
David


On Sun, Jun 22, 2014 at 3:41 AM, jiang 30155...@qq.com 
mailto:30155...@qq.com wrote:


Here is a patch to push
I hope to help you.

jiang

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org mailto:Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel




--
 Debugging is twice as hard as writing the code in the first place.
  Therefore, if you write the code as cleverly as possible, you are,
  by definition, not smart enough to debug it. -- Brian Kernighan

 tinycc is a great project, and I am honored to join a project  
commit 87373cd0ec7f5b0c0de77565090bf9710d7107a0
Author: jiang 30155...@qq.com
Date:   Mon Jun 16 16:43:40 2014 +0800

#define bug fixes
bug:
#define hexCh(c (c = 10 ? 'a' + c - 10 : '0' + c)
hexCh(c);

diff --git a/tccpp.c b/tccpp.c
index 053fd57..dfbc857 100644
--- a/tccpp.c
+++ b/tccpp.c
@@ -1253,16 +1253,15 @@ ST_FUNC void parse_define(void)
 next_nomacro();
 }
 if (varg  TOK_IDENT)
-tcc_error(badly punctuated parameter list);
+tcc_error(may not appear in macro parameter list: \%s\, 
get_tok_str(varg, NULL));
 s = sym_push2(define_stack, varg | SYM_FIELD, is_vaargs, 0);
 *ps = s;
 ps = s-next;
 if (tok != ',')
-break;
+continue;
 next_nomacro();
 }
-if (tok == ')')
-next_nomacro_spc();
+next_nomacro_spc();
 t = MACRO_FUNC;
 }
 tok_str_new(str);
___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Is static linking functional?

2014-06-23 Thread Wendell P
On Sun, Jun 22, 2014, at 11:40 AM, grischka wrote:
 Why should we comment about the usability of -static if you
 don't even know that it means?

I'll admit I'm confused by the operation of the -static switch in TCC.

tcc app.c lib.a

outputs an app.exe but

tcc -static app.c lib.a

gives an error

tcc: error: cannot find library: msvcrt


From looking at these lines in tccpe.c, it seems that should not happen.
--
if (0 == s1-nostdlib) {
static const char *libs[] = {
libtcc1.a, msvcrt, kernel32, , user32, gdi32,
NULL
};
const char **pp, *p;
for (pp = libs; 0 != (p = *pp); ++pp) {
if (0 == *p) {
if (PE_DLL != pe_type  PE_GUI != pe_type)
break;
} else if (pp == libs ? tcc_add_dll(s1, p, 0) :
tcc_add_library(s1, p)) {
tcc_error_noabort(cannot find library: %s, p);
break;
}
}
}
--

-- 
http://www.fastmail.fm - Choose from over 50 domains or use your own


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel


Re: [Tinycc-devel] Is static linking functional?

2014-06-23 Thread Daniel Glöckner
On Mon, Jun 23, 2014 at 12:07:45PM -0700, Wendell P wrote:
 I'll admit I'm confused by the operation of the -static switch in TCC.
 
 tcc app.c lib.a

Links a single static library

 tcc -static app.c lib.a

Instructs TinyCC to use only static libraries, even for implicitly
linked libraries like msvcrt.

I doubt you can create anything useful in Windows without dynamic
libraries.

  Daniel

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/tinycc-devel