Giter Club home page Giter Club logo

bcc's People

Contributors

caiosm1005 avatar drinkybird avatar positively-charged avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bcc's Issues

Non-void functions never tested for missing return value

In stmt.c test_return there is a condition that is never met.

if ( stmt->return_value ) {
   // ...
}
else {
   if ( target->func->return_type ) {
      t_diag( task, DIAG_POS_ERR, &stmt->pos,
         "missing return value in function `%s`", str.value );
      t_bail( task );
   }
}

Since this test occurs only when the parser finds a return statement, a non-void function without a return statement will be overlooked.

In the current state, the code below compiles without errors:

function str test()
{
    // No return
}

Functions taking array references error if they're unused

Not sure if I explained that right, but basically, if a function that takes an array reference isn't used anywhere, the compiler will error out with this:
"internal error: asked to update dimension information, but shared array is not allocated"
As soon as any usage of the function is added, it'll compile just fine.

Take this code for example:

#library "TEST"
#import "zcommon.bcs"

void TestBug (int[]& array)
{
	int len = array[0];
} 

private int testArray[1];

Script 1 (void)
{
	//TestBug(testArray);
}

It errors out as it is, but uncomment the TestBug(testArray); line and it'll compile fine.
This happens on the (as of writing) latest commit d58b44d, but not the 0.8.0 build.

Feature request

This can make bcc more useful.

  • c #defines
#define tan(x) FixedDiv(sin(x), cos(x))
  • Short (structure) declarations
struct Boss
{
int bosshp;
int bossarmor;
};

Boss a; // returns an error

struct Boss a; // right code
  • Named enums
enum BossType
{
    BOSSTYPE_REALMAN,
    BOSSTYPE_MONSTER
};

Bosstype type = BOSSTYPE_REALMAN;
  • Ability to return structures & enums in functions
Boss GetWeakBoss()
{
    Boss a;
    a.bosshp = 100;
    a.bossarmor = 200;
    return a;
}

BossType GetWeakBossType()
{
        return BOSSTYPE_MONSTER;
}

Compiling jm.bcs throws syntax error

Compiling with GZDB directly, throws a missing zcommon.h which it could be solved by deleting #include "zcommon.h" because zcommon.bcs does its job.

In some function declarations have a "msgbuild" keyword which generates a syntax error when we compile with GZDB and appears to be not declared too. Deleting that keyword from its corresponding functions solves the syntax error problem. However, the HudMessage depends of that keyword to generate a message to print.

For now, I'm icluding the zcommon.bcs and jm.bcs in their corresponding order.

[ACC Compatibility] "For" operator

For example, my acs code:

for (int i = 0; i < 10; i++)
{
...
}

for (i = a; i < 10; i++) // << error here
{
...
}

bcc says that variable 'i' is not declared. I have no such error with acc.

Passing structs to scripts?

I see that I cannot declare arguments for a script to accept struct references like I can for functions. Can this ever be a feature?

make error - gcc 5.4.0

Hi, when I tried to build bcc, I got the following error:

src/parse/dec.c: In function ‘read_func’:
src/parse/dec.c:1963:41: error: logical not is only applied to the left hand side of comparison [-Werror=logical-not-parentheses]
    if ( dec->static_qual && ! dec->area == DEC_LOCAL ) {
                                         ^
cc1: all warnings being treated as errors
Makefile:139: recipe for target 'build/parse/dec.o' failed
make: *** [build/parse/dec.o] Error 1

My specs are:
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.5) 5.4.0 20160609

I changed the line to if ( dec->static_qual && dec->area != DEC_LOCAL ) and the error disappeared but I am not sure if that has any other consequences.

Add program path to search path by default

monsterovich@asus:$ ./Games/ZDoomStuff/bcc/bcc acspack.acs
acspack.acs:14:9: error: failed to load file: zcommon.acs
monsterovich@asus:
$ ehh

Why bcc can't detect zcommon.acs? It's placed in "~/Games/ZDoomStuff/bcc/"
I have no such problems with acc compiler.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.