On 08/06/2013 03:15 PM, [email protected] wrote:
> Hi!
Hi, Cyril.
>> * to hide gcc warning "initialization discards qualifiers from pointer
>> target type"
> I think that correct solution is to declare the argv as:
>
> const char *const argv[]
>
> So that both the array and the stored strings are constant.
>
> (Feel free to do this in separate patch)
>
Hmm. But It will not work on its own.
If I change argv definition from
char *const argv[] = { "rmmod", mod_name, NULL };
to:
const char *const argv[] = { "rmmod", mod_name, NULL };
compiler will produce warning:
tst_module.c: In function ‘tst_module_unload’:
tst_module.c:104: warning: passing argument 2 of ‘tst_run_cmd’ from
incompatible pointer type
../include/test.h:238: note: expected ‘char * const*’ but argument is of
type ‘const char * const*’
I think that the solution to the initial problem is
1) either to make an explicit cast of mod_name to (char *)
2) or to change argv in tst_run_cmd function declaration to
const char *const argv[]
Declaration of argv in tst_run_cmd is inherited from execvp so I'm
trying to avoid changing its declaration and prefer the first way.
Maybe, it's not accurate but....
Or do you mean something different?
------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead.
Download for free and get started troubleshooting in minutes.
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list