[pjsip] Code Compilation Errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jim Gomes wrote:
> Hi Benny,
> 
> I am integrating the latest 0.7.1 code branch, and I have a few issues 
> I?d like to report back to you.
> 
> 1.    Unreachable code.
> 
> The following code in sip_auth_client.c produces four warnings of 
> ?unreachable code? for the code that comes after it.
> 
> #if !PJSIP_HAS_DIGEST_AKA_AUTH
> 
>             pj_assert(!"PJSIP_HAS_DIGEST_AKA_AUTH is not enabled");
> 
>             return PJSIP_EAUTHINAKACRED;
> 
> #endif
> 
> If this code could be changed to the following, it is functionally 
> equivalent, but eliminates the compiler warnings:
> 
> #if !PJSIP_HAS_DIGEST_AKA_AUTH
> 
>             if(!PJSIP_HAS_DIGEST_AKA_AUTH)
> 
>             {
> 
>                   pj_assert(!"PJSIP_HAS_DIGEST_AKA_AUTH is not enabled");
> 
>                   return PJSIP_EAUTHINAKACRED;
> 
>             }
> 
> #endif
> 
> By adding the if-statement, the compiler thinks that the code branch is 
> conditional.  However, it will always be true for the given compile 
> scenario.

Hi Jim!

Thanks. Fixed in r1514.

> 2.    Linker error: the constant PJ_SOL_TCP is not defined.  In the 
> sock_bsd.c source file, the following code precludes the definition of 
> the PJ_SOL_TCP constant:
> 
> #if defined(SOL_TCP)
> 
> const pj_uint16_t PJ_SOL_TCP  = SOL_TCP;
> 
> #elif defined(IPPROTO_TCP)
> 
> const pj_uint16_t PJ_SOL_TCP  = IPPROTO_TCP;
> 
> #endif /* SOL_TCP */
> 
> Since the preprocessor definitions for SOL_TCP and IPPROTO_TCP are not 
> defined anywhere, the PJ_SOL_TCP constant does not get defined.  The new 
> sock_common.c file references the PJ_SOL_TCP constant in the 
> pj_SOL_TCP() function, which produces the linker error.  There needs to 
> be a default value provided.  By studying the surrounding code, my best 
> guess is to default to 0xFFFF like so:
> 
> #if defined(SOL_TCP)
> 
> const pj_uint16_t PJ_SOL_TCP  = SOL_TCP;
> 
> #elif defined(IPPROTO_TCP)
> 
> const pj_uint16_t PJ_SOL_TCP  = IPPROTO_TCP;
> 
> #else
> 
> const pj_uint16_t PJ_SOL_TCP  = 0xFFFF;
> 
> #endif /* SOL_TCP */

Done in r1515. Although it's quite strange that you didn't get the 
error for PJ_SOL_UDP.


> 3.    Linker warning: ctype.obj no public symbols found; archive member 
> will be inaccessible.  The pj_hex_digits character array has been 
> refactored to a string, and the definition for the character array in  
> ctype.c has been commented out.  I?m sure you had reasons for changing 
> from a char array to a string, perhaps for fixing some issues with 
> embedded operating systems.  However, since there is nothing useful in 
> the ctype.c file, are you planning on getting rid of this file, or 
> adding code back in to it?

The change from pj_hex_digits array to string was mainly for Symbian 
S60 target, since it doesn't like exporting data from a .DSO 
(Dynamic Shared Object, Symbian's term for .DLL). And the same 
reason for accessor functions in the new sock_common.c.

For ctype.c, my for now I just added a dummy integer variable in it, 
in r1516. This is my approach that I use for other files too (mostly 
in pjmedia). In the long run maybe I'll just remove this file, if 
there isn't anything else to be added there. I just don't want to do 
this now since 0.7.1 release is pretty close and I want the source 
to get stabilized a bit.

Thanks for the reports!

regards,
  -benny

> By making the changes for item 1 and 2, I am able to successfully 
> compile the code.  Item #2 was a hard error and required a change.  The 
> other two items are more for cleaning up the code.
> 
>  
> 
> Regards,
> 
> Jim Gomes
> Senior Software Engineer
> Gate Technologies
> Tideworks Technology, Inc.
> (206) 382-2197
> 





[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux