hughperman / pure-lang

Automatically exported from code.google.com/p/pure-lang
0 stars 0 forks source link

pure-gen generates duplicate stubs #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Duplicate C prototypes are perfectly valid C, but pure-gen generates multiple 
stubs with the same name as a result, which is not valid C.  On my system, 
unless you mess around too much with #defines, gl.h and glext.h both define the 
gl-1.3 prototypes.

pure-gen should probably intelligently choose the best available prototype if 
more than one exists (e.g. it might even be a dummy k&r-style duplicate).  
However, simply removing duplicates (and tightening the NV inclusion regex) 
allows me to generate/compile pure-gl.  I've attached a patch which removes 
duplicates (probably sub-optimally, as I don't really know pure -- it's just a 
suggestion, anyway).

Original issue reported on code.google.com by dark...@gmail.com on 12 Jun 2012 at 2:59

Attachments:

GoogleCodeExporter commented 8 years ago
Do you have a test case?

Original comment by aggraef@gmail.com on 12 Jun 2012 at 8:10

GoogleCodeExporter commented 8 years ago
I have attached a change to run-tests which verifies the operation of the fix.  
I should have mentioned that the problem is with -fc, as used by pure-gl.  Note 
that without the fix, two identical Pure_rand() functions are generated.

Original comment by dark...@gmail.com on 12 Jun 2012 at 4:30

Attachments:

GoogleCodeExporter commented 8 years ago
This issue was closed by revision f777f557d785.

Original comment by aggraef@gmail.com on 15 Jun 2012 at 3:20

GoogleCodeExporter commented 8 years ago
Committed, thanks for the patches! I committed a slightly modified version 
which at least spits out a warning if the prototypes are different. Please let 
me know if this works for you.

Original comment by aggraef@gmail.com on 15 Jun 2012 at 3:23