This is a simple patch to fix FlySpray issue #315. We don't panic if a  
parameter without a default value isn't set which is a problem if the  
reason a default isn't set is that the user really needs to set one.  
I'm sending this mostly for Nate to say he is fine with doing it this  
way.

Ali

On Jan 29, 2009, at 6:24 PM, Ali Saidi wrote:

> # HG changeset patch
> # User Ali Saidi <[email protected]>
> # Date 1233270761 18000
> # Node ID 5ca5f9050c0362cc54c386d19919c830d9e658f6
> # Parent  130e1935985739d0727c51fd94c0d0b26a8b8ce7
> Config: Cause a fatal() when a parameter without a default value  
> isn't set(FS #315).
>
> diff --git a/src/cpu/BaseCPU.py b/src/cpu/BaseCPU.py
> --- a/src/cpu/BaseCPU.py
> +++ b/src/cpu/BaseCPU.py
> @@ -69,7 +69,7 @@
>     function_trace = Param.Bool(False, "Enable function trace")
>     function_trace_start = Param.Tick(0, "Cycle to start function  
> trace")
>
> -    checker = Param.BaseCPU("checker CPU")
> +    checker = Param.BaseCPU(NULL, "checker CPU")
>
>     do_checkpoint_insts = Param.Bool(True,
>         "enable checkpoint pseudo instructions")
> diff --git a/src/dev/DiskImage.py b/src/dev/DiskImage.py
> --- a/src/dev/DiskImage.py
> +++ b/src/dev/DiskImage.py
> @@ -31,7 +31,7 @@
> class DiskImage(SimObject):
>     type = 'DiskImage'
>     abstract = True
> -    image_file = Param.String("disk image file")
> +    image_file = Param.String("", "disk image file")
>     read_only = Param.Bool(False, "read only image")
>
> class RawDiskImage(DiskImage):
> diff --git a/src/dev/disk_image.cc b/src/dev/disk_image.cc
> --- a/src/dev/disk_image.cc
> +++ b/src/dev/disk_image.cc
> @@ -75,6 +75,8 @@
>         stream.open(file.c_str(), mode);
>         if (!stream.is_open())
>             panic("Error opening %s", filename);
> +    } else {
> +        fatal("Could not open file: %s", filename);
>     }
> }
>
> diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
> --- a/src/python/m5/SimObject.py
> +++ b/src/python/m5/SimObject.py
> @@ -748,7 +748,9 @@
>         for param in param_names:
>             value = self._values.get(param)
>             if value is None:
> -                continue
> +                print >>sys.stderr, "fatal: %s.%s without default  
> or user set value" \
> +                        % (self.path(), param)
> +                sys.exit(1)
>
>             value = value.getValue()
>             if isinstance(self._params[param], VectorParamDesc):
> _______________________________________________
> m5-dev mailing list
> [email protected]
> http://m5sim.org/mailman/listinfo/m5-dev
>

_______________________________________________
m5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to