This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 158188 - Code model do not see a usage of a variable in Macro
Summary: Code model do not see a usage of a variable in Macro
Status: REOPENED
Alias: None
Product: cnd
Classification: Unclassified
Component: Code Model (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-09 12:13 UTC by Leonid Lenyashin
Modified: 2012-10-31 13:04 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leonid Lenyashin 2009-02-09 12:13:28 UTC
In this code:

#include <dlfcn.h>
#include <stddef.h>
#include <stdio.h>
#include "sync.h"

volatile clock_t sync_wait;

#define ORIG(func) _orig_##func
#define QUOTE(nm) #nm
// dirty hack
#define VOID1P , void* p1
#define VOID2P , void* p1, void* p2
#define INT2P  , int p1, int* p2
#define ACTUAL1 , p1
#define ACTUAL2 , p1, p2

#define INSTRUMENT(func, param, actual) \
static int (* ORIG(func))(void* p param) = NULL; \
int func (void * p param) { \
    clock_t t = clock(); \
    int ret = ORIG(func) (p actual); \
    t = clock() - t; \
    if(t > 5000) \
        sync_wait += t; \
    return ret; \
}

#define INIT(func) \
    ORIG(func) = dlsym(hndl, QUOTE(__##func))     // <<<< hndl is used here

INSTRUMENT(pthread_cond_wait, VOID1P, ACTUAL1)
INSTRUMENT(pthread_cond_timedwait, VOID2P, ACTUAL2)
INSTRUMENT(pthread_mutex_lock, , )
INSTRUMENT(pthread_mutex_setprioceiling, INT2P, ACTUAL2)
INSTRUMENT(pthread_rwlock_rdlock, , )
INSTRUMENT(pthread_rwlock_wrlock, , )

int init_sync_tracing() {
    sync_wait = 0;
    void* hndl = dlopen("libpthread.so", RTLD_LAZY); // <<<< hndl is marked as unused

    INIT(pthread_cond_wait);
    INIT(pthread_cond_timedwait);
    INIT(pthread_mutex_lock);
    INIT(pthread_mutex_setprioceiling);
    INIT(pthread_rwlock_rdlock);
    INIT(pthread_rwlock_wrlock);

    return (_orig_pthread_mutex_lock != NULL);
}


hndl is marked as unused. However it is heavily used in INIT macro.
Comment 1 Vladimir Voskresensky 2009-09-25 14:06:09 UTC
consider for the next release due to lack of resources
Comment 2 Leonid Lenyashin 2012-10-30 21:09:36 UTC
There was no activity on this issue for quite a long time. We apologize that the issue was not addressed so far due to lack of development resources. We might not have time in near future to fix this problem, so it is closed as WONTFIX.
If the issue is still critical for you please do not hesitate to REOPEN it.
Thank you for using our product and reporting bugs. We are really sorry that we were not able to fix this issue timely.

Regards,
CND team.